changeset 110:c1c94b7fc2e2

sip-in call clearing: DEAD_SIP transition implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 18:37:19 -0800
parents 9b87894704eb
children 7a4d4b8d5f04
files sip-in/bye_in.c sip-in/bye_out.c sip-in/call_clear.c sip-in/invite.c sip-in/mgw_ops.c sip-in/mncc_handle.c sip-in/prack.c sip-in/retrans.c sip-in/shutdown.c sip-in/sip_ack.c
diffstat 10 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/bye_in.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/bye_in.c	Wed Sep 28 18:37:19 2022 -0800
@@ -67,6 +67,7 @@
 	case SIP_STATE_BYE_SENT:
 		call->sip_state = SIP_STATE_ENDED;
 		sip_mark_end_time(call, sip_linger_gotbye);
+		transition_dead_sip(call);
 		break;
 	case SIP_STATE_INVITE_ERR:
 	case SIP_STATE_ENDED:
--- a/sip-in/bye_out.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/bye_out.c	Wed Sep 28 18:37:19 2022 -0800
@@ -73,7 +73,8 @@
 	if (rc < 0) {
 		syslog(LOG_ERR, "outgoing BYE request msg length exceeded");
 		call->sip_state = SIP_STATE_MSG_SIZE_ERR;
-		/* TODO: transition from TEARDOWN to DEAD_SIP */
+		sip_mark_end_time(call, sip_linger_error);
+		transition_dead_sip(call);
 		return;
 	}
 	sip_tx_packet(&msg, &call->udp_sin);
@@ -116,5 +117,6 @@
 			sip_mark_end_time(call, sip_linger_acked);
 		else
 			sip_mark_end_time(call, sip_linger_error);
+		transition_dead_sip(call);
 	}
 }
--- a/sip-in/call_clear.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/call_clear.c	Wed Sep 28 18:37:19 2022 -0800
@@ -26,3 +26,21 @@
 {
 	call->sip_clear_time = cur_event_time.tv_sec + linger;
 }
+
+void
+transition_dead_sip(call)
+	struct call *call;
+{
+	if (call->overall_state != OVERALL_STATE_TEARDOWN)
+		return;
+	if (call->sip_state != SIP_STATE_ENDED &&
+	    call->sip_state != SIP_STATE_MSG_SIZE_ERR)
+		return;
+	if (call->mncc_state != MNCC_STATE_NO_EXIST)
+		return;
+	if (call->mgw_state != MGW_STATE_NO_EXIST)
+		return;
+	if (call->mgw_xact)
+		return;
+	call->overall_state = OVERALL_STATE_DEAD_SIP;
+}
--- a/sip-in/invite.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/invite.c	Wed Sep 28 18:37:19 2022 -0800
@@ -411,7 +411,6 @@
 				GSM48_CC_CAUSE_INTERWORKING);
 		disconnect_tmgw(call);
 		sip_mark_end_time(call, sip_linger_error);
-		/* TODO: transition from TEARDOWN to DEAD_SIP */
 		return;
 	}
 	if (call->use_100rel) {
@@ -447,7 +446,6 @@
 				GSM48_CC_CAUSE_INTERWORKING);
 		disconnect_tmgw(call);
 		sip_mark_end_time(call, sip_linger_error);
-		/* TODO: transition from TEARDOWN to DEAD_SIP */
 		return;
 	}
 	sip_tx_packet(&resp, &call->udp_sin);
@@ -468,7 +466,7 @@
 		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 */
+		transition_dead_sip(call);
 		return;
 	}
 	out_msg_finish(&resp);
--- a/sip-in/mgw_ops.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/mgw_ops.c	Wed Sep 28 18:37:19 2022 -0800
@@ -144,6 +144,7 @@
 			handle_crcx_fail(call, msg);
 			return;
 		case OVERALL_STATE_TEARDOWN:
+			transition_dead_sip(call);
 			return;
 		default:
 			goto bad_state;
@@ -223,7 +224,7 @@
 		exit(1);
 	}
 	call->mgw_state = MGW_STATE_NO_EXIST;
-	/* TODO: transition from TEARDOWN to DEAD_SIP */
+	transition_dead_sip(call);
 }
 
 void
--- a/sip-in/mncc_handle.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/mncc_handle.c	Wed Sep 28 18:37:19 2022 -0800
@@ -118,6 +118,7 @@
 		cause = &default_cause;
 	disconnect_sip(call, cause);
 	disconnect_tmgw(call);
+	transition_dead_sip(call);
 }
 
 static void
--- a/sip-in/prack.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/prack.c	Wed Sep 28 18:37:19 2022 -0800
@@ -94,7 +94,6 @@
 					GSM48_CC_CAUSE_INTERWORKING);
 			disconnect_tmgw(call);
 			sip_mark_end_time(call, sip_linger_error);
-			/* TODO: transition from TEARDOWN to DEAD_SIP */
 			return;
 		}
 		out_msg_finish(&resp);
--- a/sip-in/retrans.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/retrans.c	Wed Sep 28 18:37:19 2022 -0800
@@ -71,6 +71,7 @@
 			} else {
 				call->sip_state = SIP_STATE_ENDED;
 				sip_mark_end_time(call, sip_linger_error);
+				transition_dead_sip(call);
 			}
 			break;
 		case SIP_STATE_BYE_SENT:
@@ -81,6 +82,7 @@
 			} else {
 				call->sip_state = SIP_STATE_ENDED;
 				sip_mark_end_time(call, sip_linger_error);
+				transition_dead_sip(call);
 			}
 			break;
 		}
--- a/sip-in/shutdown.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/shutdown.c	Wed Sep 28 18:37:19 2022 -0800
@@ -41,6 +41,7 @@
 			call->overall_state = OVERALL_STATE_TEARDOWN;
 			disconnect_tmgw(call);
 			disconnect_sip(call, &shutdown_cause);
+			transition_dead_sip(call);
 		}
 	}
 }
@@ -58,6 +59,7 @@
 			disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
 					GSM48_CC_CAUSE_NETWORK_OOO);
 			disconnect_sip(call, &shutdown_cause);
+			transition_dead_sip(call);
 		}
 	}
 }
--- a/sip-in/sip_ack.c	Wed Sep 28 16:32:13 2022 -0800
+++ b/sip-in/sip_ack.c	Wed Sep 28 18:37:19 2022 -0800
@@ -55,6 +55,7 @@
 	case SIP_STATE_INVITE_ERR:
 		call->sip_state = SIP_STATE_ENDED;
 		sip_mark_end_time(call, sip_linger_acked);
+		transition_dead_sip(call);
 		break;
 	}
 }