FreeCalypso > hg > themwi-system-sw
annotate sip-in/mncc_handle.c @ 147:94b5831c017f
sip-manual-out code: split bye_in.c from uas.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 08 Oct 2022 23:01:32 -0800 |
parents | e499e8db8b82 |
children | 99fd4ae573ae |
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 |
87
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
28 void |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
29 send_mncc_connect_ack(call) |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
30 struct call *call; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
31 { |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
32 struct gsm_mncc ack; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
33 |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
34 bzero(&ack, sizeof(struct gsm_mncc)); |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
35 ack.msg_type = MNCC_SETUP_COMPL_REQ; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
36 ack.callref = call->mncc_callref; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
37 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc)); |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
38 call->mncc_state = MNCC_STATE_CONNECTED; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
39 call->overall_state = OVERALL_STATE_CONNECTED; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
40 } |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
41 |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
42 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
43 mncc_dtmf_start_ok(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
44 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
45 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
46 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
47 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
48 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
49 msg.msg_type = MNCC_START_DTMF_RSP; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
50 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
51 msg.fields |= MNCC_F_KEYPAD; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
52 msg.keypad = call->dtmf_digit; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
53 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
|
54 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
55 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
56 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
57 mncc_dtmf_start_err(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
58 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
59 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
60 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
61 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
62 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
63 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
|
64 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
65 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
|
66 GSM48_CC_CAUSE_PROTO_ERR); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
67 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
|
68 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
69 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
70 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
71 mncc_dtmf_stop_ok(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
72 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
73 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
74 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
75 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
76 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
77 msg.msg_type = MNCC_STOP_DTMF_RSP; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
78 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
79 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
|
80 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
81 |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
82 void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
83 mncc_send_hold_ack(call) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
84 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
85 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
86 struct gsm_mncc msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
87 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
88 bzero(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
89 msg.msg_type = MNCC_HOLD_CNF; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
90 msg.callref = call->mncc_callref; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
91 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
|
92 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
93 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
94 void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
95 mncc_send_retrieve_ack(call) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
96 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
97 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
98 struct gsm_mncc msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
99 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
100 bzero(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
101 msg.msg_type = MNCC_RETRIEVE_CNF; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
102 msg.callref = call->mncc_callref; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
103 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
|
104 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
105 |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 static void |
140
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
107 send_rtp_connect(call) |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
108 struct call *call; |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
109 { |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
110 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
|
111 |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 } |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
118 |
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
119 static void |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 handle_alerting(call, msg) |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 { |
65
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
124 if (call->mncc_state != MNCC_STATE_STARTED) { |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
125 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
|
126 call->mncc_state); |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
127 return; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
128 } |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
129 call->mncc_state = MNCC_STATE_ALERTING; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
130 call->overall_state = OVERALL_STATE_ALERTING; |
7c0309df59f8
sip-in: handling of ALERTING state
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
131 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
|
132 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 handle_answer(call, msg) |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 { |
66
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 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
|
143 return; |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
144 } |
5beb51de1bae
sip-in: got as far as propagating GSM CC CONNECT to INVITE 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
65
diff
changeset
|
145 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
|
146 call->overall_state = OVERALL_STATE_ANSWERED; |
86
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
147 /* 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
|
148 if (!call->gsm_payload_msg_type) { |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
149 call->overall_state = OVERALL_STATE_TEARDOWN; |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
150 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
|
151 GSM48_CC_CAUSE_PROTO_ERR); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
152 disconnect_tmgw(call); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
153 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
|
154 signal_invite_error(call); |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
155 return; |
f332ccc240f1
sip-in: preparations toward TMGW connect-through
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
156 } |
140
01fe81914bd6
sip-in: move MNCC_RTP_CONNECT sending to answer time
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
157 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
|
158 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
|
159 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 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
|
163 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 { |
83
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
166 struct gsm_mncc_cause *cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
167 |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
168 /* release back to MNCC */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
169 msg->msg_type = MNCC_REL_REQ; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
170 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
|
171 call->mncc_state = MNCC_STATE_RELEASE; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
172 /* signal disconnect to SIP */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
173 call->overall_state = OVERALL_STATE_TEARDOWN; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
174 if (msg->fields & MNCC_F_CAUSE) |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
175 cause = &msg->cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
176 else |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
177 cause = &default_cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
178 disconnect_sip(call, cause); |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
179 disconnect_tmgw(call); |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 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
|
184 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 { |
83
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
187 struct gsm_mncc_cause *cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
188 |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
189 /* MNCC call leg is gone */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
190 call->mncc_state = MNCC_STATE_NO_EXIST; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
191 /* signal disconnect to SIP */ |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
192 call->overall_state = OVERALL_STATE_TEARDOWN; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
193 if (msg->fields & MNCC_F_CAUSE) |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
194 cause = &msg->cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
195 else |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
196 cause = &default_cause; |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
197 disconnect_sip(call, cause); |
3e3fbf44f9d7
sip-in: disconnect and call clearing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
66
diff
changeset
|
198 disconnect_tmgw(call); |
110
c1c94b7fc2e2
sip-in call clearing: DEAD_SIP transition implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
109
diff
changeset
|
199 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
|
200 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 static void |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
203 handle_dtmf_start(call, msg) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
204 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
205 struct gsm_mncc *msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
206 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
207 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
|
208 !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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 return; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
214 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
220 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
|
221 return; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
222 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
223 call->dtmf_digit = msg->keypad; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
224 tmgw_send_dtmf_start(call); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
225 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
226 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
227 static void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
228 handle_dtmf_stop(call, msg) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
229 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
230 struct gsm_mncc *msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
231 { |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
232 if (call->overall_state != OVERALL_STATE_CONNECTED) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
233 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
234 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
|
235 tmgw_send_dtmf_stop(call); |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
236 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
|
237 call->dtmf_pending_stop = 1; |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
238 else { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
239 /* dummy OK response */ |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
240 msg->msg_type = MNCC_STOP_DTMF_RSP; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
241 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
|
242 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
243 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
244 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
245 static void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
246 handle_call_hold(call, msg) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
247 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
248 struct gsm_mncc *msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
249 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
250 if (call->overall_state != OVERALL_STATE_CONNECTED || |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
251 call->mgw_state != MGW_STATE_COMPLETE) { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
252 msg->msg_type = MNCC_HOLD_REJ; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
253 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
|
254 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
255 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
|
256 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
257 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
258 tmgw_send_mdcx_hold(call); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
259 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
260 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
261 static void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
262 handle_call_retrieve(call, msg) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
263 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
264 struct gsm_mncc *msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
265 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
266 if (call->overall_state != OVERALL_STATE_CONNECTED || |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
267 call->mgw_state != MGW_STATE_HELD) { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
268 msg->msg_type = MNCC_RETRIEVE_REJ; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
269 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
|
270 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
271 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
|
272 return; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
273 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
274 send_rtp_connect(call); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
275 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
|
276 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
277 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
278 static void |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 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
|
280 struct gsm_mncc *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 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
|
286 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 "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
|
288 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 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
|
292 if (!call) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 "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
|
295 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
|
296 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 switch (msg->msg_type) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 case MNCC_SETUP_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 handle_answer(call, msg); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 case MNCC_ALERT_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 handle_alerting(call, msg); |
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_DISC_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 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
|
307 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 case MNCC_REL_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 case MNCC_REL_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 case MNCC_REJ_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 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
|
312 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 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
|
314 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
|
315 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 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
|
317 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
|
318 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 case MNCC_MODIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 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
|
324 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 case MNCC_HOLD_IND: |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
326 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
|
327 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 case MNCC_RETRIEVE_IND: |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
329 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
|
330 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 static void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 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
|
336 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
|
337 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 struct call *call; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 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
|
342 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 "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
|
344 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 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
|
348 if (!call) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 "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
|
351 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
|
352 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 } |
84
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
354 /* save Osmocom network RTP information */ |
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
355 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
|
356 call->gsm_payload_type = msg->payload_type; |
f82157ac7303
sip-in: handle MNCC_RTP_CREATE
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
357 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
|
358 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 void |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 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
|
362 union mncc_msg *msg; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 unsigned msglen; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 switch (msg->msg_type) { |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 case MNCC_SETUP_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 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
|
368 case MNCC_ALERT_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 case MNCC_NOTIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 case MNCC_DISC_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 case MNCC_FACILITY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 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
|
373 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
|
374 case MNCC_MODIFY_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 case MNCC_HOLD_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 case MNCC_RETRIEVE_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 case MNCC_USERINFO_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 case MNCC_REL_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 case MNCC_REL_CNF: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 case MNCC_REJ_IND: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 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
|
382 return; |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 case MNCC_RTP_CREATE: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 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
|
385 return; |
85
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
386 case MNCC_RTP_CONNECT: |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
387 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
|
388 return; |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
389 case MNCC_RTP_FREE: |
70c3c8ebee33
sip-in: handle MNCC RTP bogons from OsmoMSC
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
390 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
|
391 return; |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 default: |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 syslog(LOG_CRIT, |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 "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
|
395 msg->msg_type); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 exit(1); |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 } |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 } |