diff sip-in/retrans.c @ 108:0d6435808bcd

sip-in: implement 100rel for 180 Ringing response
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 14:29:10 -0800
parents 915f0f397fb6
children 9b87894704eb
line wrap: on
line diff
--- a/sip-in/retrans.c	Tue Sep 27 23:45:40 2022 -0800
+++ b/sip-in/retrans.c	Wed Sep 28 14:29:10 2022 -0800
@@ -27,6 +27,25 @@
 
 	for (call = call_list; call; call = call->next) {
 		switch (call->sip_state) {
+		case SIP_STATE_RINGING_REL:
+			if (call->sip_tx_count < cfg_retrans_count) {
+				start_response_out_msg(&msg, "180 Ringing");
+				fill_invite_resp_from_call(&msg, call);
+				out_msg_add_header(&msg, "Require", "100rel");
+				out_msg_add_header(&msg, "RSeq", "1");
+				out_msg_finish(&msg);
+				sip_tx_packet(&msg, &call->udp_sin);
+				call->sip_tx_count++;
+			} else {
+				call->overall_state = OVERALL_STATE_TEARDOWN;
+				disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
+						GSM48_CC_CAUSE_INTERWORKING);
+				disconnect_tmgw(call);
+				strcpy(call->invite_fail,
+					"504 100rel retransmissions exhausted");
+				signal_invite_error(call);
+			}
+			break;
 		case SIP_STATE_INVITE_200:
 			if (call->sip_tx_count < cfg_retrans_count) {
 				fill_invite_200_resp(&msg, call);