changeset 153:99fd4ae573ae

sip-in: split mncc_sig_out.c from mncc_handle.c
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2022 16:23:44 -0800
parents 7176dc850d7a
children e54b0a9e322f
files sip-in/Makefile sip-in/mncc_handle.c sip-in/mncc_sig_out.c
diffstat 3 files changed, 98 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/Makefile	Tue Oct 11 16:11:21 2022 -0800
+++ b/sip-in/Makefile	Tue Oct 11 16:23:44 2022 -0800
@@ -3,8 +3,8 @@
 PROG=	themwi-sip-in
 OBJS=	bye_in.o bye_out.o call_clear.o call_list.o call_setup.o cancel.o \
 	disconnect.o invite_dup.o invite_init.o invite_resp.o main.o mgw_ops.o \
-	mgw_resp.o mgw_sock.o mncc_handle.o mncc_sock.o prack.o readconf.o \
-	retrans.o shutdown.o sip_ack.o sip_log.o sip_uas.o sip_udp.o
+	mgw_resp.o mgw_sock.o mncc_handle.o mncc_sig_out.o mncc_sock.o prack.o \
+	readconf.o retrans.o shutdown.o sip_ack.o sip_log.o sip_uas.o sip_udp.o
 LIBS=	../libnumdb/libnumdb.a ../libsip/libsip.a ../libutil/libutil.a
 INSTBIN=/usr/local/bin
 
--- a/sip-in/mncc_handle.c	Tue Oct 11 16:11:21 2022 -0800
+++ b/sip-in/mncc_handle.c	Tue Oct 11 16:23:44 2022 -0800
@@ -25,84 +25,6 @@
 	.value		= GSM48_CC_CAUSE_NORMAL_UNSPEC,
 };
 
-void
-send_mncc_connect_ack(call)
-	struct call *call;
-{
-	struct gsm_mncc ack;
-
-	bzero(&ack, sizeof(struct gsm_mncc));
-	ack.msg_type = MNCC_SETUP_COMPL_REQ;
-	ack.callref = call->mncc_callref;
-	send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc));
-	call->mncc_state = MNCC_STATE_CONNECTED;
-	call->overall_state = OVERALL_STATE_CONNECTED;
-}
-
-void
-mncc_dtmf_start_ok(call)
-	struct call *call;
-{
-	struct gsm_mncc msg;
-
-	bzero(&msg, sizeof(struct gsm_mncc));
-	msg.msg_type = MNCC_START_DTMF_RSP;
-	msg.callref = call->mncc_callref;
-	msg.fields |= MNCC_F_KEYPAD;
-	msg.keypad = call->dtmf_digit;
-	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
-}
-
-void
-mncc_dtmf_start_err(call)
-	struct call *call;
-{
-	struct gsm_mncc msg;
-
-	bzero(&msg, sizeof(struct gsm_mncc));
-	msg.msg_type = MNCC_START_DTMF_REJ;
-	msg.callref = call->mncc_callref;
-	mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU,
-			GSM48_CC_CAUSE_PROTO_ERR);
-	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
-}
-
-void
-mncc_dtmf_stop_ok(call)
-	struct call *call;
-{
-	struct gsm_mncc msg;
-
-	bzero(&msg, sizeof(struct gsm_mncc));
-	msg.msg_type = MNCC_STOP_DTMF_RSP;
-	msg.callref = call->mncc_callref;
-	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
-}
-
-void
-mncc_send_hold_ack(call)
-	struct call *call;
-{
-	struct gsm_mncc msg;
-
-	bzero(&msg, sizeof(struct gsm_mncc));
-	msg.msg_type = MNCC_HOLD_CNF;
-	msg.callref = call->mncc_callref;
-	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
-}
-
-void
-mncc_send_retrieve_ack(call)
-	struct call *call;
-{
-	struct gsm_mncc msg;
-
-	bzero(&msg, sizeof(struct gsm_mncc));
-	msg.msg_type = MNCC_RETRIEVE_CNF;
-	msg.callref = call->mncc_callref;
-	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
-}
-
 static void
 send_rtp_connect(call)
 	struct call *call;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sip-in/mncc_sig_out.c	Tue Oct 11 16:23:44 2022 -0800
@@ -0,0 +1,96 @@
+/*
+ * In this module we implement functions that send MNCC messages
+ * to OsmoMSC via themwi-mncc, to be called by SIP and TMGW events.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <syslog.h>
+#include "../include/mncc.h"
+#include "../include/gsm48_const.h"
+#include "call.h"
+
+void
+send_mncc_connect_ack(call)
+	struct call *call;
+{
+	struct gsm_mncc ack;
+
+	bzero(&ack, sizeof(struct gsm_mncc));
+	ack.msg_type = MNCC_SETUP_COMPL_REQ;
+	ack.callref = call->mncc_callref;
+	send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc));
+	call->mncc_state = MNCC_STATE_CONNECTED;
+	call->overall_state = OVERALL_STATE_CONNECTED;
+}
+
+void
+mncc_dtmf_start_ok(call)
+	struct call *call;
+{
+	struct gsm_mncc msg;
+
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_START_DTMF_RSP;
+	msg.callref = call->mncc_callref;
+	msg.fields |= MNCC_F_KEYPAD;
+	msg.keypad = call->dtmf_digit;
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+}
+
+void
+mncc_dtmf_start_err(call)
+	struct call *call;
+{
+	struct gsm_mncc msg;
+
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_START_DTMF_REJ;
+	msg.callref = call->mncc_callref;
+	mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU,
+			GSM48_CC_CAUSE_PROTO_ERR);
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+}
+
+void
+mncc_dtmf_stop_ok(call)
+	struct call *call;
+{
+	struct gsm_mncc msg;
+
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_STOP_DTMF_RSP;
+	msg.callref = call->mncc_callref;
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+}
+
+void
+mncc_send_hold_ack(call)
+	struct call *call;
+{
+	struct gsm_mncc msg;
+
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_HOLD_CNF;
+	msg.callref = call->mncc_callref;
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+}
+
+void
+mncc_send_retrieve_ack(call)
+	struct call *call;
+{
+	struct gsm_mncc msg;
+
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_RETRIEVE_CNF;
+	msg.callref = call->mncc_callref;
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+}