diff sip-in/sip_ack.c @ 83:3e3fbf44f9d7

sip-in: disconnect and call clearing implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 20 Sep 2022 22:06:37 -0800
parents 8cf85edca543
children 9e9034ef476c
line wrap: on
line diff
--- a/sip-in/sip_ack.c	Tue Sep 20 20:33:09 2022 -0800
+++ b/sip-in/sip_ack.c	Tue Sep 20 22:06:37 2022 -0800
@@ -34,7 +34,19 @@
 		return;
 	switch (call->sip_state) {
 	case SIP_STATE_INVITE_200:
-		call->sip_state = SIP_STATE_CONNECTED;
+		switch (call->overall_state) {
+		case OVERALL_STATE_ANSWERED:
+			call->sip_state = SIP_STATE_CONNECTED;
+			break;
+		case OVERALL_STATE_TEARDOWN:
+			initiate_bye(call);
+			break;
+		default:
+			syslog(LOG_CRIT,
+			"FATAL: invalid overall state 0x%x on SIP ACK",
+				call->overall_state);
+			exit(1);
+		}
 		break;
 	case SIP_STATE_INVITE_ERR:
 		call->sip_state = SIP_STATE_ENDED;