diff sip-in/retrans.c @ 81:915f0f397fb6

sip-in: beginning of outgoing BYE support
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 20 Sep 2022 20:11:44 -0800
parents 72b7d85d6354
children 0d6435808bcd
line wrap: on
line diff
--- a/sip-in/retrans.c	Tue Sep 20 19:35:34 2022 -0800
+++ b/sip-in/retrans.c	Tue Sep 20 20:11:44 2022 -0800
@@ -33,12 +33,11 @@
 				sip_tx_packet(&msg, &call->udp_sin);
 				call->sip_tx_count++;
 			} else {
-				/* TODO: send BYE */
-				call->sip_state = SIP_STATE_ENDED;
 				call->overall_state = OVERALL_STATE_TEARDOWN;
 				disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
 						GSM48_CC_CAUSE_INTERWORKING);
 				disconnect_tmgw(call);
+				initiate_bye(call);
 			}
 			break;
 		case SIP_STATE_INVITE_ERR:
@@ -51,6 +50,14 @@
 			} else
 				call->sip_state = SIP_STATE_ENDED;
 			break;
+		case SIP_STATE_BYE_SENT:
+			if (call->sip_tx_count < cfg_retrans_count) {
+				fill_bye_out_msg(&msg, call);
+				sip_tx_packet(&msg, &call->udp_sin);
+				call->sip_tx_count++;
+			} else
+				call->sip_state = SIP_STATE_ENDED;
+			break;
 		}
 	}
 }