diff mtctest/disconnect.c @ 5:e7b192a5dee5

mtctest: initial import from old ThemWi
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 Jun 2024 00:58:38 +0000
parents
children a902ccbf6bbc
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mtctest/disconnect.c	Sun Jun 09 00:58:38 2024 +0000
@@ -0,0 +1,33 @@
+/*
+ * In this module we implement the sending of MNCC_DISC_REQ,
+ * signaling a caller-requested disconnect aka hang-up.
+ * It is the graceful way of signaling disconnect,
+ * as opposed to simply killing the test call process with ^C
+ * and letting themwi-mncc handle the broken socket.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include "../include/mncc.h"
+#include "../include/gsm48_const.h"
+
+int disconnect_mode;
+
+send_disconnect_req()
+{
+	struct gsm_mncc msg;
+
+	printf("Sending disconnect request\n");
+	bzero(&msg, sizeof(struct gsm_mncc));
+	msg.msg_type = MNCC_DISC_REQ;
+	msg.callref = 1;
+	mncc_set_cause(&msg, GSM48_CAUSE_LOC_USER,
+			GSM48_CC_CAUSE_NORM_CALL_CLEAR);
+	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
+	disconnect_mode = 1;
+}