comparison sip-in/mgw_ops.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 e499e8db8b82
comparison
equal deleted inserted replaced
127:f062c32a5116 128:5685412bd6aa
97 req.transact_ref = get_new_tmgw_xact_id(); 97 req.transact_ref = get_new_tmgw_xact_id();
98 req.ep_id = call->mgw_ep_id; 98 req.ep_id = call->mgw_ep_id;
99 send_req_to_tmgw(&req); 99 send_req_to_tmgw(&req);
100 call->mgw_state = MGW_STATE_DELETING; 100 call->mgw_state = MGW_STATE_DELETING;
101 call->mgw_xact = TMGW_CTRL_OP_DLCX; 101 call->mgw_xact = TMGW_CTRL_OP_DLCX;
102 call->mgw_xact_id = req.transact_ref;
103 }
104
105 void
106 tmgw_send_dtmf_start(call)
107 struct call *call;
108 {
109 struct tmgw_ctrl_req req;
110
111 bzero(&req, sizeof req);
112 req.opcode = TMGW_CTRL_OP_DTMF_START;
113 req.transact_ref = get_new_tmgw_xact_id();
114 req.ep_id = call->mgw_ep_id;
115 req.fwd_mode = call->dtmf_digit;
116 send_req_to_tmgw(&req);
117 call->mgw_state = MGW_STATE_DTMF_OP;
118 call->mgw_xact = TMGW_CTRL_OP_DTMF_START;
119 call->mgw_xact_id = req.transact_ref;
120 }
121
122 void
123 tmgw_send_dtmf_stop(call)
124 struct call *call;
125 {
126 struct tmgw_ctrl_req req;
127
128 bzero(&req, sizeof req);
129 req.opcode = TMGW_CTRL_OP_DTMF_STOP;
130 req.transact_ref = get_new_tmgw_xact_id();
131 req.ep_id = call->mgw_ep_id;
132 send_req_to_tmgw(&req);
133 call->mgw_state = MGW_STATE_DTMF_OP;
134 call->mgw_xact = TMGW_CTRL_OP_DTMF_STOP;
102 call->mgw_xact_id = req.transact_ref; 135 call->mgw_xact_id = req.transact_ref;
103 } 136 }
104 137
105 static void 138 static void
106 handle_crcx_fail(call, msg) 139 handle_crcx_fail(call, msg)
225 } 258 }
226 call->mgw_state = MGW_STATE_NO_EXIST; 259 call->mgw_state = MGW_STATE_NO_EXIST;
227 transition_dead_sip(call); 260 transition_dead_sip(call);
228 } 261 }
229 262
263 static void
264 dtmf_start_response(call, msg)
265 struct call *call;
266 struct tmgw_ctrl_resp *msg;
267 {
268 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
269 tmgw_send_dlcx(call);
270 return;
271 }
272 if (msg->res == TMGW_RESP_OK)
273 mncc_dtmf_start_ok(call);
274 else
275 mncc_dtmf_start_err(call);
276 if (call->dtmf_pending_stop)
277 tmgw_send_dtmf_stop(call);
278 else
279 call->mgw_state = MGW_STATE_COMPLETE;
280 }
281
282 static void
283 dtmf_stop_response(call, msg)
284 struct call *call;
285 struct tmgw_ctrl_resp *msg;
286 {
287 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
288 tmgw_send_dlcx(call);
289 return;
290 }
291 mncc_dtmf_stop_ok(call);
292 call->mgw_state = MGW_STATE_COMPLETE;
293 call->dtmf_pending_stop = 0;
294 }
295
230 void 296 void
231 process_tmgw_response(msg) 297 process_tmgw_response(msg)
232 struct tmgw_ctrl_resp *msg; 298 struct tmgw_ctrl_resp *msg;
233 { 299 {
234 struct call *call; 300 struct call *call;
251 mdcx_response(call, msg); 317 mdcx_response(call, msg);
252 return; 318 return;
253 case TMGW_CTRL_OP_DLCX: 319 case TMGW_CTRL_OP_DLCX:
254 dlcx_response(call, msg); 320 dlcx_response(call, msg);
255 return; 321 return;
322 case TMGW_CTRL_OP_DTMF_START:
323 dtmf_start_response(call, msg);
324 return;
325 case TMGW_CTRL_OP_DTMF_STOP:
326 dtmf_stop_response(call, msg);
327 return;
256 default: 328 default:
257 syslog(LOG_CRIT, 329 syslog(LOG_CRIT,
258 "FATAL: invalid opcode 0x%x in call->msg_xact", opc); 330 "FATAL: invalid opcode 0x%x in call->msg_xact", opc);
259 exit(1); 331 exit(1);
260 } 332 }