annotate sip-in/mncc_handle.c @ 63:e5aee661e3b2

sip-in: beginning to handle incoming MNCC messages from themwi-mncc
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 18 Sep 2022 15:01:11 -0800
parents
children 7c0309df59f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
63
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement our handling of call control messages
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * from OsmoMSC relayed to us via themwi-mncc.
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/socket.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <netinet/in.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdio.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdint.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdlib.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <string.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <strings.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <syslog.h>
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "../include/mncc.h"
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include "../include/gsm48_const.h"
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "call.h"
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 extern struct call *find_call_by_mncc_callref();
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 handle_alerting(call, msg)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 struct gsm_mncc *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /* handling to be implemented */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 handle_answer(call, msg)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 struct gsm_mncc *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* handling to be implemented */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 handle_disconnect_ind(call, msg)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 struct gsm_mncc *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 /* handling to be implemented */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 handle_final_release(call, msg)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 struct gsm_mncc *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 /* handling to be implemented */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 handle_signaling_msg(msg, msglen)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 struct gsm_mncc *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 unsigned msglen;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 if (msglen != sizeof(struct gsm_mncc)) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 syslog(LOG_CRIT,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 "FATAL: Rx MNCC message type 0x%x has wrong length",
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 msg->msg_type);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 exit(1);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 call = find_call_by_mncc_callref(msg->callref);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if (!call) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 syslog(LOG_CRIT,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 "error: Rx MNCC message type 0x%x has invalid callref 0x%x",
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 msg->msg_type, msg->callref);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 exit(1);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 switch (msg->msg_type) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 case MNCC_SETUP_CNF:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 handle_answer(call, msg);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 case MNCC_ALERT_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 handle_alerting(call, msg);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 case MNCC_DISC_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 handle_disconnect_ind(call, msg);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 case MNCC_REL_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 case MNCC_REL_CNF:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 case MNCC_REJ_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 handle_final_release(call, msg);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 case MNCC_START_DTMF_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 msg->msg_type = MNCC_START_DTMF_REJ;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 case MNCC_STOP_DTMF_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 msg->msg_type = MNCC_STOP_DTMF_RSP;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 case MNCC_MODIFY_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 msg->msg_type = MNCC_MODIFY_REJ;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 case MNCC_HOLD_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 msg->msg_type = MNCC_HOLD_REJ;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 case MNCC_RETRIEVE_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 msg->msg_type = MNCC_RETRIEVE_REJ;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 static void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 handle_rtp_create(msg, msglen)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 struct gsm_mncc_rtp *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 unsigned msglen;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 struct call *call;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 if (msglen != sizeof(struct gsm_mncc_rtp)) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 syslog(LOG_CRIT,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 "FATAL: Rx MNCC message type 0x%x has wrong length",
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 msg->msg_type);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 exit(1);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 call = find_call_by_mncc_callref(msg->callref);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 if (!call) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 syslog(LOG_CRIT,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 "error: Rx MNCC message type 0x%x has invalid callref 0x%x",
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 msg->msg_type, msg->callref);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 exit(1);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 /* handling to be implemented */
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 void
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 msg_from_mncc(msg, msglen)
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 union mncc_msg *msg;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 unsigned msglen;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 switch (msg->msg_type) {
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 case MNCC_SETUP_CNF:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 case MNCC_CALL_CONF_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 case MNCC_ALERT_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 case MNCC_NOTIFY_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 case MNCC_DISC_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 case MNCC_FACILITY_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 case MNCC_START_DTMF_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 case MNCC_STOP_DTMF_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 case MNCC_MODIFY_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 case MNCC_HOLD_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 case MNCC_RETRIEVE_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 case MNCC_USERINFO_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 case MNCC_REL_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 case MNCC_REL_CNF:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 case MNCC_REJ_IND:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 handle_signaling_msg(msg, msglen);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 case MNCC_RTP_CREATE:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 handle_rtp_create(msg, msglen);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 return;
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 default:
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 syslog(LOG_CRIT,
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 "FATAL: received unexpected MNCC message type 0x%x",
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 msg->msg_type);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 exit(1);
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 }
e5aee661e3b2 sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 }