diff sip-in/call_list.c @ 112:6aa63cf4620a

sip-in call clearing: select timeout implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 18:59:55 -0800
parents 9b87894704eb
children
line wrap: on
line diff
--- a/sip-in/call_list.c	Wed Sep 28 18:45:16 2022 -0800
+++ b/sip-in/call_list.c	Wed Sep 28 18:59:55 2022 -0800
@@ -55,10 +55,12 @@
 }
 
 void
-scan_call_list_for_timeouts(retrans)
-	int *retrans;
+scan_call_list_for_timeouts(retrans, dead_sip_flag, dead_sip_time)
+	int *retrans, *dead_sip_flag;
+	time_t *dead_sip_time;
 {
 	struct call *call;
+	int got_dead_sip = 0;
 
 	for (call = call_list; call; call = call->next) {
 		switch (call->sip_state) {
@@ -68,6 +70,18 @@
 		case SIP_STATE_BYE_SENT:
 			*retrans = 1;
 			break;
+		case SIP_STATE_ENDED:
+		case SIP_STATE_MSG_SIZE_ERR:
+			if (call->overall_state != OVERALL_STATE_DEAD_SIP)
+				continue;
+			if (got_dead_sip) {
+				if (call->sip_clear_time < *dead_sip_time)
+					*dead_sip_time = call->sip_clear_time;
+			} else {
+				got_dead_sip = 1;
+				*dead_sip_flag = 1;
+				*dead_sip_time = call->sip_clear_time;
+			}
 		}
 	}
 }