diff mncc/mncc_recv.c @ 28:660126bd5f59

themwi-mncc: fix one bug, add debug syslog output
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 Jun 2022 21:47:04 -0800
parents ccc5ab6d8388
children
line wrap: on
line diff
--- a/mncc/mncc_recv.c	Tue Jun 28 19:21:51 2022 -0800
+++ b/mncc/mncc_recv.c	Tue Jun 28 21:47:04 2022 -0800
@@ -13,6 +13,8 @@
 #include "struct.h"
 #include "gsm_call.h"
 
+extern char *mncc_msg_name();
+
 static void
 report_runt(msg)
 	union mncc_msg *msg;
@@ -32,6 +34,8 @@
 		report_runt(msg);
 		return;
 	}
+	syslog(LOG_DEBUG, "Rx MNCC_SETUP_IND from GSM, callref=0x%x",
+		msg->callref);
 	call = find_gsm_callref(msg->callref);
 	if (call) {
 		syslog(LOG_ERR, "duplicate MNCC_SETUP_IND for callref 0x%x",
@@ -54,11 +58,12 @@
 		report_runt(msg);
 		return;
 	}
+	syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x",
+		mncc_msg_name(msg->msg_type), msg->callref);
 	call = find_gsm_callref(msg->callref);
 	if (!call) {
-		syslog(LOG_ERR,
-			"MNCC message type 0x%x: callref 0x%x not found",
-			msg->msg_type, msg->callref);
+		syslog(LOG_ERR, "%s from GSM: callref 0x%x not found",
+			mncc_msg_name(msg->msg_type), msg->callref);
 		/* drop it like OsmoMSC's mncc_builtin does */
 		return;
 	}
@@ -82,17 +87,21 @@
 		report_runt(msg);
 		return;
 	}
+	syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x",
+		mncc_msg_name(msg->msg_type), msg->callref);
 	call = find_gsm_callref(msg->callref);
 	if (!call) {
-		syslog(LOG_ERR,
-			"MNCC message type 0x%x: callref 0x%x not found",
-			msg->msg_type, msg->callref);
+		syslog(LOG_ERR, "%s from GSM: callref 0x%x not found",
+			mncc_msg_name(msg->msg_type), msg->callref);
 		/* drop it like OsmoMSC's mncc_builtin does */
 		return;
 	}
 	/* dispatch according to internal switch or socket */
 	if (call->socket) {
 		mncc_signal_to_socket(call, msg);
+		syslog(LOG_DEBUG,
+		"clearing socket call: GSM callref 0x%x, socket ref 0x%x",
+			call->callref, call->socket_ref);
 		extsock_dec_refcount(call->socket);
 		call->gc_flag = 1;
 	} else
@@ -110,11 +119,12 @@
 		report_runt(msg);
 		return;
 	}
+	syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x",
+		mncc_msg_name(msg->msg_type), msg->callref);
 	call = find_gsm_callref(msg->callref);
 	if (!call) {
-		syslog(LOG_ERR,
-			"MNCC message type 0x%x: callref 0x%x not found",
-			msg->msg_type, msg->callref);
+		syslog(LOG_ERR, "%s from GSM: callref 0x%x not found",
+			mncc_msg_name(msg->msg_type), msg->callref);
 		/* drop it like OsmoMSC's mncc_builtin does */
 		return;
 	}