FreeCalypso > hg > themwi-system-sw
comparison sip-in/mncc_handle.c @ 128:5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 01 Oct 2022 23:07:01 -0800 |
parents | c1c94b7fc2e2 |
children | 01fe81914bd6 |
comparison
equal
deleted
inserted
replaced
127:f062c32a5116 | 128:5685412bd6aa |
---|---|
37 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc)); | 37 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc)); |
38 call->mncc_state = MNCC_STATE_CONNECTED; | 38 call->mncc_state = MNCC_STATE_CONNECTED; |
39 call->overall_state = OVERALL_STATE_CONNECTED; | 39 call->overall_state = OVERALL_STATE_CONNECTED; |
40 } | 40 } |
41 | 41 |
42 void | |
43 mncc_dtmf_start_ok(call) | |
44 struct call *call; | |
45 { | |
46 struct gsm_mncc msg; | |
47 | |
48 bzero(&msg, sizeof(struct gsm_mncc)); | |
49 msg.msg_type = MNCC_START_DTMF_RSP; | |
50 msg.callref = call->mncc_callref; | |
51 msg.fields |= MNCC_F_KEYPAD; | |
52 msg.keypad = call->dtmf_digit; | |
53 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
54 } | |
55 | |
56 void | |
57 mncc_dtmf_start_err(call) | |
58 struct call *call; | |
59 { | |
60 struct gsm_mncc msg; | |
61 | |
62 bzero(&msg, sizeof(struct gsm_mncc)); | |
63 msg.msg_type = MNCC_START_DTMF_REJ; | |
64 msg.callref = call->mncc_callref; | |
65 mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
66 GSM48_CC_CAUSE_PROTO_ERR); | |
67 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
68 } | |
69 | |
70 void | |
71 mncc_dtmf_stop_ok(call) | |
72 struct call *call; | |
73 { | |
74 struct gsm_mncc msg; | |
75 | |
76 bzero(&msg, sizeof(struct gsm_mncc)); | |
77 msg.msg_type = MNCC_STOP_DTMF_RSP; | |
78 msg.callref = call->mncc_callref; | |
79 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
80 } | |
81 | |
42 static void | 82 static void |
43 handle_alerting(call, msg) | 83 handle_alerting(call, msg) |
44 struct call *call; | 84 struct call *call; |
45 struct gsm_mncc *msg; | 85 struct gsm_mncc *msg; |
46 { | 86 { |
120 disconnect_tmgw(call); | 160 disconnect_tmgw(call); |
121 transition_dead_sip(call); | 161 transition_dead_sip(call); |
122 } | 162 } |
123 | 163 |
124 static void | 164 static void |
165 handle_dtmf_start(call, msg) | |
166 struct call *call; | |
167 struct gsm_mncc *msg; | |
168 { | |
169 if (!(msg->fields & MNCC_F_KEYPAD) || | |
170 !is_valid_dtmf_digit(msg->keypad)) { | |
171 msg->msg_type = MNCC_START_DTMF_REJ; | |
172 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
173 GSM48_CC_CAUSE_INVAL_MAND_INF); | |
174 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
175 return; | |
176 } | |
177 if (call->overall_state != OVERALL_STATE_CONNECTED || | |
178 call->mgw_state != MGW_STATE_COMPLETE) { | |
179 msg->msg_type = MNCC_START_DTMF_REJ; | |
180 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
181 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); | |
182 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
183 return; | |
184 } | |
185 call->dtmf_digit = msg->keypad; | |
186 tmgw_send_dtmf_start(call); | |
187 } | |
188 | |
189 static void | |
190 handle_dtmf_stop(call, msg) | |
191 struct call *call; | |
192 struct gsm_mncc *msg; | |
193 { | |
194 if (call->overall_state == OVERALL_STATE_CONNECTED && | |
195 call->mgw_state == MGW_STATE_COMPLETE) | |
196 tmgw_send_dtmf_stop(call); | |
197 else | |
198 call->dtmf_pending_stop = 1; | |
199 } | |
200 | |
201 static void | |
125 handle_signaling_msg(msg, msglen) | 202 handle_signaling_msg(msg, msglen) |
126 struct gsm_mncc *msg; | 203 struct gsm_mncc *msg; |
127 unsigned msglen; | 204 unsigned msglen; |
128 { | 205 { |
129 struct call *call; | 206 struct call *call; |
155 case MNCC_REL_CNF: | 232 case MNCC_REL_CNF: |
156 case MNCC_REJ_IND: | 233 case MNCC_REJ_IND: |
157 handle_final_release(call, msg); | 234 handle_final_release(call, msg); |
158 return; | 235 return; |
159 case MNCC_START_DTMF_IND: | 236 case MNCC_START_DTMF_IND: |
160 msg->msg_type = MNCC_START_DTMF_REJ; | 237 handle_dtmf_start(call, msg); |
161 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
162 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); | |
163 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
164 return; | 238 return; |
165 case MNCC_STOP_DTMF_IND: | 239 case MNCC_STOP_DTMF_IND: |
166 msg->msg_type = MNCC_STOP_DTMF_RSP; | 240 handle_dtmf_stop(call, msg); |
167 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
168 return; | 241 return; |
169 case MNCC_MODIFY_IND: | 242 case MNCC_MODIFY_IND: |
170 msg->msg_type = MNCC_MODIFY_REJ; | 243 msg->msg_type = MNCC_MODIFY_REJ; |
171 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | 244 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
172 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); | 245 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |