annotate sip-out/mgw_ops.c @ 275:def9f6e4f49e default tip

doc/Use-outside-USA: Fake-NANP-numbers article is here
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 27 Nov 2023 21:49:19 -0800
parents e54b0a9e322f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
2 * In this module we implement all transactions from themwi-sip-out
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * toward themwi-mgw.
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
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>
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <netinet/in.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdio.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdint.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdlib.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <string.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <strings.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include <syslog.h>
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include "../include/tmgw_ctrl.h"
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "../include/tmgw_const.h"
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
18 #include "../include/out_routes.h"
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "call.h"
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 extern struct call *call_list;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 struct call *
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 find_call_with_mgw_xact(xact_id)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 uint32_t xact_id;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 for (call = call_list; call; call = call->next)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 if (call->mgw_xact && call->mgw_xact_id == xact_id)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 return call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 return 0;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 uint32_t
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 get_new_tmgw_xact_id()
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 static uint32_t next_xact_id;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 for (;;) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 next_xact_id++;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if (!find_call_with_mgw_xact(next_xact_id))
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 return next_xact_id;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 void
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 tmgw_send_crcx(call)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 struct tmgw_ctrl_req req;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 bzero(&req, sizeof req);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 req.opcode = TMGW_CTRL_OP_CRCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 req.transact_ref = get_new_tmgw_xact_id();
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 req.ep_id = TMGW_EP_TYPE_GATEWAY;
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
57 req.setup_mask = TMGW_CTRL_MASK_GSM_CONN;
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
58 bcopy(&call->gsm_rtp_osmo, &req.gsm_addr,
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
59 sizeof(struct sockaddr_storage));
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
60 req.gsm_payload_type = call->gsm_payload_type;
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
61 req.gsm_payload_msg_type = call->gsm_payload_msg_type;
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 send_req_to_tmgw(&req);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 call->mgw_xact = TMGW_CTRL_OP_CRCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 call->mgw_xact_id = req.transact_ref;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 void
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
68 tmgw_send_mdcx_connect(call, ibt)
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 struct tmgw_ctrl_req req;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 bzero(&req, sizeof req);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 req.opcode = TMGW_CTRL_OP_MDCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 req.transact_ref = get_new_tmgw_xact_id();
61
e12036337412 sip-in/mgw_ops.c: fix double semicolon
Mychaela Falconia <falcon@freecalypso.org>
parents: 60
diff changeset
76 req.ep_id = call->mgw_ep_id;
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
77 req.setup_mask = TMGW_CTRL_MASK_PSTN_CONN | TMGW_CTRL_MASK_FWD_MODE;
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
78 bcopy(&call->pstn_rtp_remote, &req.pstn_addr,
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
79 sizeof(struct sockaddr_in));
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
80 req.pstn_payload_type =
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
81 call->use_pcma ? PSTN_CODEC_PCMA : PSTN_CODEC_PCMU;
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
82 req.fwd_mode = ibt ? TMGW_FWD_MODE_RECVONLY : TMGW_FWD_MODE_SENDRECV;
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 send_req_to_tmgw(&req);
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
84 call->mgw_state = ibt ? MGW_STATE_MDCX_IBT : MGW_STATE_MDCX_CONN;
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 call->mgw_xact = TMGW_CTRL_OP_MDCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 call->mgw_xact_id = req.transact_ref;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 void
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
90 tmgw_send_mdcx_hold(call)
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
91 struct call *call;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
92 {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
93 struct tmgw_ctrl_req req;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
94
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
95 bzero(&req, sizeof req);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
96 req.opcode = TMGW_CTRL_OP_MDCX;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
97 req.transact_ref = get_new_tmgw_xact_id();
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
98 req.ep_id = call->mgw_ep_id;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
99 req.setup_mask = TMGW_CTRL_MASK_FWD_MODE;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
100 req.fwd_mode = TMGW_FWD_MODE_INACTIVE;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
101 send_req_to_tmgw(&req);
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
102 call->mgw_state = MGW_STATE_MDCX_HOLD;
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
103 call->mgw_xact = TMGW_CTRL_OP_MDCX;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
104 call->mgw_xact_id = req.transact_ref;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
105 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
106
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
107 void
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
108 tmgw_send_mdcx_retrieve(call)
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
109 struct call *call;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
110 {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
111 struct tmgw_ctrl_req req;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
112
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
113 bzero(&req, sizeof req);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
114 req.opcode = TMGW_CTRL_OP_MDCX;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
115 req.transact_ref = get_new_tmgw_xact_id();
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
116 req.ep_id = call->mgw_ep_id;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
117 req.setup_mask = TMGW_CTRL_MASK_FWD_MODE;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
118 req.fwd_mode = TMGW_FWD_MODE_SENDRECV;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
119 send_req_to_tmgw(&req);
154
e54b0a9e322f beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
120 call->mgw_state = MGW_STATE_MDCX_RETR;
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
121 call->mgw_xact = TMGW_CTRL_OP_MDCX;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
122 call->mgw_xact_id = req.transact_ref;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
123 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
124
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
125 void
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 tmgw_send_dlcx(call)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 struct tmgw_ctrl_req req;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 bzero(&req, sizeof req);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 req.opcode = TMGW_CTRL_OP_DLCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 req.transact_ref = get_new_tmgw_xact_id();
61
e12036337412 sip-in/mgw_ops.c: fix double semicolon
Mychaela Falconia <falcon@freecalypso.org>
parents: 60
diff changeset
134 req.ep_id = call->mgw_ep_id;
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 send_req_to_tmgw(&req);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 call->mgw_state = MGW_STATE_DELETING;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 call->mgw_xact = TMGW_CTRL_OP_DLCX;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 call->mgw_xact_id = req.transact_ref;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140
128
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
141 void
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
142 tmgw_send_dtmf_start(call)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
143 struct call *call;
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 struct tmgw_ctrl_req req;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
146
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
147 bzero(&req, sizeof req);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
148 req.opcode = TMGW_CTRL_OP_DTMF_START;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
149 req.transact_ref = get_new_tmgw_xact_id();
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
150 req.ep_id = call->mgw_ep_id;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
151 req.fwd_mode = call->dtmf_digit;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
152 send_req_to_tmgw(&req);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
153 call->mgw_state = MGW_STATE_DTMF_OP;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
154 call->mgw_xact = TMGW_CTRL_OP_DTMF_START;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
155 call->mgw_xact_id = req.transact_ref;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
156 }
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
157
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
158 void
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
159 tmgw_send_dtmf_stop(call)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
160 struct call *call;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
161 {
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
162 struct tmgw_ctrl_req req;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
163
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
164 bzero(&req, sizeof req);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
165 req.opcode = TMGW_CTRL_OP_DTMF_STOP;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
166 req.transact_ref = get_new_tmgw_xact_id();
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
167 req.ep_id = call->mgw_ep_id;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
168 send_req_to_tmgw(&req);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
169 call->mgw_state = MGW_STATE_DTMF_OP;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
170 call->mgw_xact = TMGW_CTRL_OP_DTMF_STOP;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
171 call->mgw_xact_id = req.transact_ref;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
172 }