FreeCalypso > hg > themwi-system-sw
annotate sip-in/mncc_handle.c @ 197:73bbe7da45cd
add LICENSE
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 26 Mar 2023 15:29:48 -0800 |
parents | 99fd4ae573ae |
children |
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> |
109
9b87894704eb
sip-in: first step toward final call clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
98
diff
changeset
|
8 #include <sys/time.h> |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <netinet/in.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdio.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdint.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdlib.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <string.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <strings.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <syslog.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "../include/mncc.h" |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #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
|
18 #include "call.h" |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 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
|
21 |
83
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
22 static struct gsm_mncc_cause default_cause = { |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
23 .coding = GSM48_CAUSE_CODING_GSM, |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
24 .location = GSM48_CAUSE_LOC_PRN_S_LU, |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
25 .value = GSM48_CC_CAUSE_NORMAL_UNSPEC, |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
26 }; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
27 |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 static void |
140
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
29 send_rtp_connect(call) |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
30 struct call *call; |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
31 { |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
32 struct gsm_mncc_rtp rtp; |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
33 |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
34 bzero(&rtp, sizeof(struct gsm_mncc_rtp)); |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
35 rtp.msg_type = MNCC_RTP_CONNECT; |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
36 rtp.callref = call->mncc_callref; |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
37 bcopy(&call->gsm_rtp_tmgw, &rtp.addr, sizeof(struct sockaddr_storage)); |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
38 send_mncc_to_gsm(&rtp, sizeof(struct gsm_mncc_rtp)); |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
39 } |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
40 |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
41 static void |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 handle_alerting(call, msg) |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 { |
65
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
46 if (call->mncc_state != MNCC_STATE_STARTED) { |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
47 syslog(LOG_ERR, "MNCC_ALERT_IND in wrong MNCC state 0x%x", |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
48 call->mncc_state); |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
49 return; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
50 } |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
51 call->mncc_state = MNCC_STATE_ALERTING; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
52 call->overall_state = OVERALL_STATE_ALERTING; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
53 signal_invite_ringing(call); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 handle_answer(call, msg) |
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 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 { |
66
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
61 if (call->mncc_state != MNCC_STATE_STARTED && |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
62 call->mncc_state != MNCC_STATE_ALERTING) { |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
63 syslog(LOG_ERR, "MNCC_SETUP_CNF in wrong MNCC state 0x%x", |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
64 call->mncc_state); |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
65 return; |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
66 } |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
67 call->mncc_state = MNCC_STATE_ANSWERED; |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
68 call->overall_state = OVERALL_STATE_ANSWERED; |
86
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
69 /* right now we require MNCC_RTP_CREATE to have come first */ |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
70 if (!call->gsm_payload_msg_type) { |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
71 call->overall_state = OVERALL_STATE_TEARDOWN; |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
72 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
73 GSM48_CC_CAUSE_PROTO_ERR); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
74 disconnect_tmgw(call); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
75 strcpy(call->invite_fail, "502 Internal protocol error"); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
76 signal_invite_error(call); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
77 return; |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
78 } |
140
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
79 send_rtp_connect(call); |
98
423610bb2c9e
sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents:
87
diff
changeset
|
80 tmgw_send_mdcx_connect(call); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 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
|
85 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 { |
83
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
88 struct gsm_mncc_cause *cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
89 |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
90 /* release back to MNCC */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
91 msg->msg_type = MNCC_REL_REQ; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
92 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
93 call->mncc_state = MNCC_STATE_RELEASE; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
94 /* signal disconnect to SIP */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
95 call->overall_state = OVERALL_STATE_TEARDOWN; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
96 if (msg->fields & MNCC_F_CAUSE) |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
97 cause = &msg->cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
98 else |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
99 cause = &default_cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
100 disconnect_sip(call, cause); |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
101 disconnect_tmgw(call); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 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
|
106 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 { |
83
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
109 struct gsm_mncc_cause *cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
110 |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
111 /* MNCC call leg is gone */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
112 call->mncc_state = MNCC_STATE_NO_EXIST; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
113 /* signal disconnect to SIP */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
114 call->overall_state = OVERALL_STATE_TEARDOWN; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
115 if (msg->fields & MNCC_F_CAUSE) |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
116 cause = &msg->cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
117 else |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
118 cause = &default_cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
119 disconnect_sip(call, cause); |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
120 disconnect_tmgw(call); |
110
c1c94b7fc2e2
sip-in call clearing: DEAD_SIP transition implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
109
diff
changeset
|
121 transition_dead_sip(call); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 } |
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 static void |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
125 handle_dtmf_start(call, msg) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
126 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
127 struct gsm_mncc *msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
128 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
129 if (!(msg->fields & MNCC_F_KEYPAD) || |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
130 !is_valid_dtmf_digit(msg->keypad)) { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
131 msg->msg_type = MNCC_START_DTMF_REJ; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
132 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
133 GSM48_CC_CAUSE_INVAL_MAND_INF); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
134 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
135 return; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
136 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
137 if (call->overall_state != OVERALL_STATE_CONNECTED || |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
138 call->mgw_state != MGW_STATE_COMPLETE) { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
139 msg->msg_type = MNCC_START_DTMF_REJ; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
140 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
141 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
142 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
143 return; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
144 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
145 call->dtmf_digit = msg->keypad; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
146 tmgw_send_dtmf_start(call); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
147 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
148 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
149 static void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
150 handle_dtmf_stop(call, msg) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
151 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
152 struct gsm_mncc *msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
153 { |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
154 if (call->overall_state != OVERALL_STATE_CONNECTED) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
155 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
156 if (call->mgw_state == MGW_STATE_COMPLETE) |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
157 tmgw_send_dtmf_stop(call); |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
158 else if (call->mgw_state == MGW_STATE_DTMF_OP) |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
159 call->dtmf_pending_stop = 1; |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
160 else { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
161 /* dummy OK response */ |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
162 msg->msg_type = MNCC_STOP_DTMF_RSP; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
163 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
164 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
165 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
166 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
167 static void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
168 handle_call_hold(call, msg) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
169 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
170 struct gsm_mncc *msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
171 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
172 if (call->overall_state != OVERALL_STATE_CONNECTED || |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
173 call->mgw_state != MGW_STATE_COMPLETE) { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
174 msg->msg_type = MNCC_HOLD_REJ; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
175 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
176 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
177 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
178 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
179 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
180 tmgw_send_mdcx_hold(call); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
181 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
182 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
183 static void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
184 handle_call_retrieve(call, msg) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
185 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
186 struct gsm_mncc *msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
187 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
188 if (call->overall_state != OVERALL_STATE_CONNECTED || |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
189 call->mgw_state != MGW_STATE_HELD) { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
190 msg->msg_type = MNCC_RETRIEVE_REJ; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
191 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
192 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
193 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
194 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
195 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
196 send_rtp_connect(call); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
197 tmgw_send_mdcx_retrieve(call); |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
198 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
199 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
200 static void |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 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
|
202 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 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
|
208 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 "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
|
210 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 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
|
214 if (!call) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 "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
|
217 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
|
218 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 switch (msg->msg_type) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 case MNCC_SETUP_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 handle_answer(call, msg); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 case MNCC_ALERT_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 handle_alerting(call, msg); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 case MNCC_DISC_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 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
|
229 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 case MNCC_REL_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 case MNCC_REL_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 case MNCC_REJ_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 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
|
234 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 case MNCC_START_DTMF_IND: |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
236 handle_dtmf_start(call, msg); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 case MNCC_STOP_DTMF_IND: |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
239 handle_dtmf_stop(call, msg); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 case MNCC_MODIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 case MNCC_HOLD_IND: |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
248 handle_call_hold(call, msg); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 case MNCC_RETRIEVE_IND: |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
251 handle_call_retrieve(call, msg); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 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
|
258 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
|
259 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 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
|
264 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 "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
|
266 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 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
|
270 if (!call) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 "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
|
273 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
|
274 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 } |
84
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
276 /* save Osmocom network RTP information */ |
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
277 bcopy(&msg->addr, &call->gsm_rtp_osmo, sizeof(struct sockaddr_storage)); |
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
278 call->gsm_payload_type = msg->payload_type; |
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
279 call->gsm_payload_msg_type = msg->payload_msg_type; |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 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
|
284 union mncc_msg *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 switch (msg->msg_type) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 case MNCC_SETUP_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 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
|
290 case MNCC_ALERT_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 case MNCC_NOTIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 case MNCC_DISC_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 case MNCC_FACILITY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 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
|
295 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
|
296 case MNCC_MODIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 case MNCC_HOLD_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 case MNCC_RETRIEVE_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 case MNCC_USERINFO_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 case MNCC_REL_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 case MNCC_REL_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 case MNCC_REJ_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 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
|
304 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 case MNCC_RTP_CREATE: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 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
|
307 return; |
85
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
308 case MNCC_RTP_CONNECT: |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
309 syslog(LOG_ERR, "MNCC_RTP_CONNECT error from OsmoMSC"); |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
310 return; |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
311 case MNCC_RTP_FREE: |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
312 syslog(LOG_ERR, "MNCC_RTP_FREE bogon from OsmoMSC"); |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
313 return; |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 default: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 "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
|
317 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 } |