diff sip-in/call_clear.c @ 111:7a4d4b8d5f04

sip-in call clearing: unlink and free implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 18:45:16 -0800
parents c1c94b7fc2e2
children bfc97065bf51
line wrap: on
line diff
--- a/sip-in/call_clear.c	Wed Sep 28 18:37:19 2022 -0800
+++ b/sip-in/call_clear.c	Wed Sep 28 18:45:16 2022 -0800
@@ -44,3 +44,20 @@
 		return;
 	call->overall_state = OVERALL_STATE_DEAD_SIP;
 }
+
+void
+clear_dead_sip_calls()
+{
+	struct call *call, **pp;
+
+	for (pp = &call_list; *pp; ) {
+		call = *pp;
+		if (call->overall_state == OVERALL_STATE_DEAD_SIP &&
+		    call->sip_clear_time >= cur_event_time.tv_sec) {
+			*pp = call->next;
+			free(call);
+			continue;
+		}
+		pp = &call->next;
+	}
+}