FreeCalypso > hg > themwi-interim
annotate mncc/mncc_recv.c @ 13:c71801aa0039 default tip
themwi-test-mtc: increase maximum play length
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Oct 2024 00:06:28 +0000 |
parents | 053f04687106 |
children |
rev | line source |
---|---|
2
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we implement initial handling of MNCC messages |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * coming from OsmoMSC, dispatching them further as appropriate. |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <sys/socket.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdio.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdint.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <syslog.h> |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "../include/mncc.h" |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "struct.h" |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "gsm_call.h" |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern char *mncc_msg_name(); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 report_runt(msg) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 union mncc_msg *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 syslog(LOG_CRIT, "MNCC message type 0x%x from GSM is too short!", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 msg->msg_type); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 handle_setup_ind(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 struct gsm_mncc *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 struct gsm_call *call; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 if (msglen < sizeof(struct gsm_mncc)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 report_runt(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 syslog(LOG_DEBUG, "Rx MNCC_SETUP_IND from GSM, callref=0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 call = find_gsm_callref(msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 if (call) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 syslog(LOG_ERR, "duplicate MNCC_SETUP_IND for callref 0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /* drop it like OsmoMSC's mncc_builtin does */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /* further processing */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 process_mo_call_setup(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 handle_signaling_msg(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 struct gsm_mncc *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 struct gsm_call *call; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 if (msglen < sizeof(struct gsm_mncc)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 report_runt(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 call = find_gsm_callref(msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 if (!call) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 /* drop it like OsmoMSC's mncc_builtin does */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 if (msg->msg_type == MNCC_SETUP_CNF) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 preen_connected_number(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 /* dispatch according to internal switch or socket */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (call->socket) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 mncc_signal_to_socket(call, msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 else |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 internal_switch_mncc(call, msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 handle_release_msg(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 struct gsm_mncc *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 struct gsm_call *call; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 if (msglen < sizeof(struct gsm_mncc)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 report_runt(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 call = find_gsm_callref(msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 if (!call) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 /* drop it like OsmoMSC's mncc_builtin does */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 /* dispatch according to internal switch or socket */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (call->socket) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 mncc_signal_to_socket(call, msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 syslog(LOG_DEBUG, |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 "clearing socket call: GSM callref 0x%x, socket ref 0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 call->callref, call->socket_ref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 extsock_dec_refcount(call->socket); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 call->gc_flag = 1; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 } else |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 internal_switch_mncc(call, msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 handle_rtp_msg(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 struct gsm_mncc_rtp *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 struct gsm_call *call; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 if (msglen < sizeof(struct gsm_mncc_rtp)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 report_runt(msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 syslog(LOG_DEBUG, "Rx %s from GSM, callref=0x%x", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 call = find_gsm_callref(msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 if (!call) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 syslog(LOG_ERR, "%s from GSM: callref 0x%x not found", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 mncc_msg_name(msg->msg_type), msg->callref); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 /* drop it like OsmoMSC's mncc_builtin does */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 /* only for socket connections - no RTP handling for internal */ |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 if (call->socket) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 mncc_rtp_to_socket(call, msg); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 static void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 handle_mncc_hello(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 struct gsm_mncc_hello *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 if (msglen < sizeof(struct gsm_mncc_hello)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 syslog(LOG_CRIT, "MNCC_SOCKET_HELLO message is too short!"); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 exit(1); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 if (msg->version != MNCC_SOCK_VERSION) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 syslog(LOG_CRIT, "MNCC hello error: version number mismatch"); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 exit(1); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 if (msg->mncc_size != sizeof(struct gsm_mncc)) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 syslog(LOG_CRIT, "MNCC hello error: mncc_size mismatch"); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 exit(1); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 void |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 mncc_msg_from_gsm(msg, msglen) |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 union mncc_msg *msg; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 unsigned msglen; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 switch (msg->msg_type) { |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 case MNCC_SETUP_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 handle_setup_ind(msg, msglen); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 case MNCC_SETUP_CNF: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 case MNCC_SETUP_COMPL_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 case MNCC_CALL_CONF_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 case MNCC_ALERT_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 case MNCC_NOTIFY_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 case MNCC_DISC_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 case MNCC_FACILITY_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 case MNCC_START_DTMF_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 case MNCC_STOP_DTMF_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 case MNCC_MODIFY_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 case MNCC_MODIFY_CNF: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 case MNCC_MODIFY_REJ: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 case MNCC_HOLD_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 case MNCC_RETRIEVE_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 case MNCC_USERINFO_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 handle_signaling_msg(msg, msglen); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 case MNCC_REL_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 case MNCC_REL_CNF: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 case MNCC_REJ_IND: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 handle_release_msg(msg, msglen); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 case MNCC_RTP_CREATE: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 case MNCC_RTP_CONNECT: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 case MNCC_RTP_FREE: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 handle_rtp_msg(msg, msglen); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 case MNCC_SOCKET_HELLO: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 handle_mncc_hello(msg, msglen); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 return; |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 default: |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 syslog(LOG_CRIT, "unknown MNCC message type 0x%x from GSM", |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 msg->msg_type); |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 } |
053f04687106
mncc: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 } |