diff sip-in/invite.c @ 109:9b87894704eb

sip-in: first step toward final call clearing
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 16:32:13 -0800
parents 0d6435808bcd
children c1c94b7fc2e2
line wrap: on
line diff
--- a/sip-in/invite.c	Wed Sep 28 14:29:10 2022 -0800
+++ b/sip-in/invite.c	Wed Sep 28 16:32:13 2022 -0800
@@ -4,6 +4,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdio.h>
@@ -26,6 +27,7 @@
 extern int cfg_use_100rel;
 extern int cfg_force_pcma;
 extern struct call *call_list;
+extern unsigned sip_linger_error;
 
 extern struct call *find_call_by_sip_id();
 extern char *get_single_header();
@@ -408,6 +410,7 @@
 		disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
 				GSM48_CC_CAUSE_INTERWORKING);
 		disconnect_tmgw(call);
+		sip_mark_end_time(call, sip_linger_error);
 		/* TODO: transition from TEARDOWN to DEAD_SIP */
 		return;
 	}
@@ -443,6 +446,7 @@
 		disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
 				GSM48_CC_CAUSE_INTERWORKING);
 		disconnect_tmgw(call);
+		sip_mark_end_time(call, sip_linger_error);
 		/* TODO: transition from TEARDOWN to DEAD_SIP */
 		return;
 	}
@@ -463,6 +467,7 @@
 	if (rc < 0) {
 		syslog(LOG_ERR, "INVITE late error response length exceeded");
 		call->sip_state = SIP_STATE_MSG_SIZE_ERR;
+		sip_mark_end_time(call, sip_linger_error);
 		/* TODO: transition from TEARDOWN to DEAD_SIP */
 		return;
 	}