diff sip-in/invite.c @ 66:5beb51de1bae

sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 18 Sep 2022 16:17:31 -0800
parents 7c0309df59f8
children 21276f045026
line wrap: on
line diff
--- a/sip-in/invite.c	Sun Sep 18 15:44:22 2022 -0800
+++ b/sip-in/invite.c	Sun Sep 18 16:17:31 2022 -0800
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <strings.h>
 #include <syslog.h>
+#include "../include/gsm48_const.h"
 #include "../libsip/parse.h"
 #include "../libsip/uas_basic.h"
 #include "../libsip/grok_from.h"
@@ -365,6 +366,29 @@
 }
 
 void
+signal_invite_200(call)
+	struct call *call;
+{
+	struct sip_msg_out resp;
+	int rc;
+
+	rc = fill_invite_200_resp(&resp, call);
+	if (rc < 0) {
+		syslog(LOG_ERR, "INVITE 200 response length exceeded");
+		call->sip_state = SIP_STATE_MSG_SIZE_ERR;
+		call->overall_state = OVERALL_STATE_TEARDOWN;
+		disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_INTERWORKING);
+		disconnect_tmgw(call);
+		/* TODO: transition from TEARDOWN to DEAD_SIP */
+		return;
+	}
+	sip_tx_packet(&resp, &call->udp_sin);
+	call->sip_state = SIP_STATE_INVITE_200;
+	call->sip_tx_count = 1;
+}
+
+void
 signal_invite_error(call)
 	struct call *call;
 {