FreeCalypso > hg > themwi-system-sw
comparison sip-in/mncc_handle.c @ 141:e499e8db8b82
sip-in: handle call hold and retrieve
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 08 Oct 2022 13:28:30 -0800 |
parents | 01fe81914bd6 |
children | 99fd4ae573ae |
comparison
equal
deleted
inserted
replaced
140:01fe81914bd6 | 141:e499e8db8b82 |
---|---|
77 msg.msg_type = MNCC_STOP_DTMF_RSP; | 77 msg.msg_type = MNCC_STOP_DTMF_RSP; |
78 msg.callref = call->mncc_callref; | 78 msg.callref = call->mncc_callref; |
79 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | 79 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
80 } | 80 } |
81 | 81 |
82 void | |
83 mncc_send_hold_ack(call) | |
84 struct call *call; | |
85 { | |
86 struct gsm_mncc msg; | |
87 | |
88 bzero(&msg, sizeof(struct gsm_mncc)); | |
89 msg.msg_type = MNCC_HOLD_CNF; | |
90 msg.callref = call->mncc_callref; | |
91 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
92 } | |
93 | |
94 void | |
95 mncc_send_retrieve_ack(call) | |
96 struct call *call; | |
97 { | |
98 struct gsm_mncc msg; | |
99 | |
100 bzero(&msg, sizeof(struct gsm_mncc)); | |
101 msg.msg_type = MNCC_RETRIEVE_CNF; | |
102 msg.callref = call->mncc_callref; | |
103 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
104 } | |
105 | |
82 static void | 106 static void |
83 send_rtp_connect(call) | 107 send_rtp_connect(call) |
84 struct call *call; | 108 struct call *call; |
85 { | 109 { |
86 struct gsm_mncc_rtp rtp; | 110 struct gsm_mncc_rtp rtp; |
203 static void | 227 static void |
204 handle_dtmf_stop(call, msg) | 228 handle_dtmf_stop(call, msg) |
205 struct call *call; | 229 struct call *call; |
206 struct gsm_mncc *msg; | 230 struct gsm_mncc *msg; |
207 { | 231 { |
208 if (call->overall_state == OVERALL_STATE_CONNECTED && | 232 if (call->overall_state != OVERALL_STATE_CONNECTED) |
209 call->mgw_state == MGW_STATE_COMPLETE) | 233 return; |
234 if (call->mgw_state == MGW_STATE_COMPLETE) | |
210 tmgw_send_dtmf_stop(call); | 235 tmgw_send_dtmf_stop(call); |
211 else | 236 else if (call->mgw_state == MGW_STATE_DTMF_OP) |
212 call->dtmf_pending_stop = 1; | 237 call->dtmf_pending_stop = 1; |
238 else { | |
239 /* dummy OK response */ | |
240 msg->msg_type = MNCC_STOP_DTMF_RSP; | |
241 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
242 } | |
243 } | |
244 | |
245 static void | |
246 handle_call_hold(call, msg) | |
247 struct call *call; | |
248 struct gsm_mncc *msg; | |
249 { | |
250 if (call->overall_state != OVERALL_STATE_CONNECTED || | |
251 call->mgw_state != MGW_STATE_COMPLETE) { | |
252 msg->msg_type = MNCC_HOLD_REJ; | |
253 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
254 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); | |
255 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
256 return; | |
257 } | |
258 tmgw_send_mdcx_hold(call); | |
259 } | |
260 | |
261 static void | |
262 handle_call_retrieve(call, msg) | |
263 struct call *call; | |
264 struct gsm_mncc *msg; | |
265 { | |
266 if (call->overall_state != OVERALL_STATE_CONNECTED || | |
267 call->mgw_state != MGW_STATE_HELD) { | |
268 msg->msg_type = MNCC_RETRIEVE_REJ; | |
269 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
270 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT); | |
271 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
272 return; | |
273 } | |
274 send_rtp_connect(call); | |
275 tmgw_send_mdcx_retrieve(call); | |
213 } | 276 } |
214 | 277 |
215 static void | 278 static void |
216 handle_signaling_msg(msg, msglen) | 279 handle_signaling_msg(msg, msglen) |
217 struct gsm_mncc *msg; | 280 struct gsm_mncc *msg; |
258 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | 321 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, |
259 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); | 322 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
260 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | 323 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); |
261 return; | 324 return; |
262 case MNCC_HOLD_IND: | 325 case MNCC_HOLD_IND: |
263 msg->msg_type = MNCC_HOLD_REJ; | 326 handle_call_hold(call, msg); |
264 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
265 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); | |
266 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
267 return; | 327 return; |
268 case MNCC_RETRIEVE_IND: | 328 case MNCC_RETRIEVE_IND: |
269 msg->msg_type = MNCC_RETRIEVE_REJ; | 329 handle_call_retrieve(call, msg); |
270 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
271 GSM48_CC_CAUSE_SERV_OPT_UNIMPL); | |
272 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc)); | |
273 return; | 330 return; |
274 } | 331 } |
275 } | 332 } |
276 | 333 |
277 static void | 334 static void |