FreeCalypso > hg > themwi-system-sw
comparison 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 |
comparison
equal
deleted
inserted
replaced
27:c6572f4c31d2 | 28:660126bd5f59 |
---|---|
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include <syslog.h> | 11 #include <syslog.h> |
12 #include "../include/mncc.h" | 12 #include "../include/mncc.h" |
13 #include "struct.h" | 13 #include "struct.h" |
14 #include "gsm_call.h" | 14 #include "gsm_call.h" |
15 | |
16 extern char *mncc_msg_name(); | |
15 | 17 |
16 static void | 18 static void |
17 report_runt(msg) | 19 report_runt(msg) |
18 union mncc_msg *msg; | 20 union mncc_msg *msg; |
19 { | 21 { |
30 | 32 |
31 if (msglen < sizeof(struct gsm_mncc)) { | 33 if (msglen < sizeof(struct gsm_mncc)) { |
32 report_runt(msg); | 34 report_runt(msg); |
33 return; | 35 return; |
34 } | 36 } |
37 syslog(LOG_DEBUG, "Rx MNCC_SETUP_IND from GSM, callref=0x%x", | |
38 msg->callref); | |
35 call = find_gsm_callref(msg->callref); | 39 call = find_gsm_callref(msg->callref); |
36 if (call) { | 40 if (call) { |
37 syslog(LOG_ERR, "duplicate MNCC_SETUP_IND for callref 0x%x", | 41 syslog(LOG_ERR, "duplicate MNCC_SETUP_IND for callref 0x%x", |
38 msg->callref); | 42 msg->callref); |
39 /* drop it like OsmoMSC's mncc_builtin does */ | 43 /* drop it like OsmoMSC's mncc_builtin does */ |
52 | 56 |
53 if (msglen < sizeof(struct gsm_mncc)) { | 57 if (msglen < sizeof(struct gsm_mncc)) { |
54 report_runt(msg); | 58 report_runt(msg); |
55 return; | 59 return; |
56 } | 60 } |
61 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", | |
62 mncc_msg_name(msg->msg_type), msg->callref); | |
57 call = find_gsm_callref(msg->callref); | 63 call = find_gsm_callref(msg->callref); |
58 if (!call) { | 64 if (!call) { |
59 syslog(LOG_ERR, | 65 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
60 "MNCC message type 0x%x: callref 0x%x not found", | 66 mncc_msg_name(msg->msg_type), msg->callref); |
61 msg->msg_type, msg->callref); | |
62 /* drop it like OsmoMSC's mncc_builtin does */ | 67 /* drop it like OsmoMSC's mncc_builtin does */ |
63 return; | 68 return; |
64 } | 69 } |
65 if (msg->msg_type == MNCC_SETUP_CNF) | 70 if (msg->msg_type == MNCC_SETUP_CNF) |
66 preen_connected_number(msg); | 71 preen_connected_number(msg); |
80 | 85 |
81 if (msglen < sizeof(struct gsm_mncc)) { | 86 if (msglen < sizeof(struct gsm_mncc)) { |
82 report_runt(msg); | 87 report_runt(msg); |
83 return; | 88 return; |
84 } | 89 } |
90 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", | |
91 mncc_msg_name(msg->msg_type), msg->callref); | |
85 call = find_gsm_callref(msg->callref); | 92 call = find_gsm_callref(msg->callref); |
86 if (!call) { | 93 if (!call) { |
87 syslog(LOG_ERR, | 94 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
88 "MNCC message type 0x%x: callref 0x%x not found", | 95 mncc_msg_name(msg->msg_type), msg->callref); |
89 msg->msg_type, msg->callref); | |
90 /* drop it like OsmoMSC's mncc_builtin does */ | 96 /* drop it like OsmoMSC's mncc_builtin does */ |
91 return; | 97 return; |
92 } | 98 } |
93 /* dispatch according to internal switch or socket */ | 99 /* dispatch according to internal switch or socket */ |
94 if (call->socket) { | 100 if (call->socket) { |
95 mncc_signal_to_socket(call, msg); | 101 mncc_signal_to_socket(call, msg); |
102 syslog(LOG_DEBUG, | |
103 "clearing socket call: GSM callref 0x%x, socket ref 0x%x", | |
104 call->callref, call->socket_ref); | |
96 extsock_dec_refcount(call->socket); | 105 extsock_dec_refcount(call->socket); |
97 call->gc_flag = 1; | 106 call->gc_flag = 1; |
98 } else | 107 } else |
99 internal_switch_mncc(call, msg); | 108 internal_switch_mncc(call, msg); |
100 } | 109 } |
108 | 117 |
109 if (msglen < sizeof(struct gsm_mncc_rtp)) { | 118 if (msglen < sizeof(struct gsm_mncc_rtp)) { |
110 report_runt(msg); | 119 report_runt(msg); |
111 return; | 120 return; |
112 } | 121 } |
122 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", | |
123 mncc_msg_name(msg->msg_type), msg->callref); | |
113 call = find_gsm_callref(msg->callref); | 124 call = find_gsm_callref(msg->callref); |
114 if (!call) { | 125 if (!call) { |
115 syslog(LOG_ERR, | 126 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
116 "MNCC message type 0x%x: callref 0x%x not found", | 127 mncc_msg_name(msg->msg_type), msg->callref); |
117 msg->msg_type, msg->callref); | |
118 /* drop it like OsmoMSC's mncc_builtin does */ | 128 /* drop it like OsmoMSC's mncc_builtin does */ |
119 return; | 129 return; |
120 } | 130 } |
121 /* only for socket connections - no RTP handling for internal */ | 131 /* only for socket connections - no RTP handling for internal */ |
122 if (call->socket) | 132 if (call->socket) |