annotate sip-in/mgw_resp.c @ 151:0ecbc3dc8f93

sip-in: split mgw_resp.c from mgw_ops.c
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2022 15:58:42 -0800
parents sip-in/mgw_ops.c@e499e8db8b82
children 7176dc850d7a
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 /*
151
0ecbc3dc8f93 sip-in: split mgw_resp.c from mgw_ops.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 141
diff changeset
2 * In this module we implement our handling of all responses
0ecbc3dc8f93 sip-in: split mgw_resp.c from mgw_ops.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 141
diff changeset
3 * from themwi-mgw.
60
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>
98
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
16 #include "../include/gsm48_const.h"
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
17 #include "../include/mncc.h"
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "../include/tmgw_ctrl.h"
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "../include/tmgw_const.h"
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "call.h"
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
151
0ecbc3dc8f93 sip-in: split mgw_resp.c from mgw_ops.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 141
diff changeset
22 extern struct call *find_call_with_mgw_xact();
128
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
23
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 static void
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 handle_crcx_fail(call, msg)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 struct tmgw_ctrl_resp *msg;
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 call->overall_state = OVERALL_STATE_TEARDOWN;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 strcpy(call->invite_fail, "503 Gateway resource allocation failure");
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 signal_invite_error(call);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
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 static void
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 crcx_response(call, msg)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 struct tmgw_ctrl_resp *msg;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (msg->res == TMGW_RESP_OK) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 call->mgw_state = MGW_STATE_ALLOCATED;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 call->mgw_ep_id = msg->ep_id;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 bcopy(&msg->gsm_addr, &call->gsm_rtp_tmgw,
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 sizeof(struct sockaddr_storage));
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 bcopy(&msg->pstn_addr, &call->pstn_rtp_local,
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 sizeof(struct sockaddr_in));
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 switch (call->overall_state) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 case OVERALL_STATE_CRCX:
62
75b7a7b61824 sip-in: got as far as sending MNCC_SETUP_REQ to themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents: 61
diff changeset
48 proceed_with_call_setup(call);
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 case OVERALL_STATE_TEARDOWN:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 tmgw_send_dlcx(call);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 default:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 bad_state:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 syslog(LOG_CRIT,
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 "FATAL: invalid overall state 0x%x on CRCX response",
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 call->overall_state);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 exit(1);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 } else {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 switch (call->overall_state) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 case OVERALL_STATE_CRCX:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 handle_crcx_fail(call, msg);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 case OVERALL_STATE_TEARDOWN:
110
c1c94b7fc2e2 sip-in call clearing: DEAD_SIP transition implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 109
diff changeset
66 transition_dead_sip(call);
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 default:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 goto bad_state;
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 }
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
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 static void
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
75 handle_mdcx_connect_fail(call, msg)
98
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
76 struct call *call;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
77 struct tmgw_ctrl_resp *msg;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
78 {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
79 call->overall_state = OVERALL_STATE_TEARDOWN;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
80 switch (msg->res) {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
81 case TMGW_RESP_ERR_RSRC:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
82 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
83 GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
84 strcpy(call->invite_fail,
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
85 "503 Gateway resource allocation failure");
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
86 break;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
87 case TMGW_RESP_ERR_NOTSUP:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
88 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
89 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
90 strcpy(call->invite_fail, "502 Gateway internal error");
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
91 break;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
92 default:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
93 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
94 GSM48_CC_CAUSE_PROTO_ERR);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
95 strcpy(call->invite_fail, "502 Gateway internal error");
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
96 }
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
97 signal_invite_error(call);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
98 }
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
99
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
100 static void
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
101 mdcx_connect_response(call, msg)
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 struct tmgw_ctrl_resp *msg;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 {
98
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
105 if (msg->res == TMGW_RESP_OK) {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
106 call->mgw_state = MGW_STATE_COMPLETE;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
107 switch (call->overall_state) {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
108 case OVERALL_STATE_ANSWERED:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
109 signal_invite_200(call);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
110 return;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
111 case OVERALL_STATE_TEARDOWN:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
112 tmgw_send_dlcx(call);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
113 return;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
114 default:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
115 bad_state:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
116 syslog(LOG_CRIT,
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
117 "FATAL: invalid overall state 0x%x on MDCX response",
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
118 call->overall_state);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
119 exit(1);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
120 }
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
121 } else {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
122 tmgw_send_dlcx(call);
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
123 switch (call->overall_state) {
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
124 case OVERALL_STATE_ANSWERED:
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
125 handle_mdcx_connect_fail(call, msg);
98
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
126 return;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
127 case OVERALL_STATE_TEARDOWN:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
128 return;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
129 default:
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
130 goto bad_state;
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
131 }
423610bb2c9e sip-in: send MDCX to TMGW to connect the call through
Mychaela Falconia <falcon@freecalypso.org>
parents: 86
diff changeset
132 }
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
141
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
135 static struct gsm_mncc_cause mgw_hold_retrieve_error = {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
136 .coding = GSM48_CAUSE_CODING_GSM,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
137 .location = GSM48_CAUSE_LOC_PRN_S_LU,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
138 .value = GSM48_CC_CAUSE_NETWORK_OOO,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
139 };
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
140
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
141 static void
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
142 mdcx_hold_response(call, msg)
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
143 struct call *call;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
144 struct tmgw_ctrl_resp *msg;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
145 {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
146 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
147 tmgw_send_dlcx(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
148 return;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
149 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
150 if (msg->res == TMGW_RESP_OK) {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
151 call->mgw_state = MGW_STATE_HELD;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
152 mncc_send_hold_ack(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
153 } else {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
154 call->overall_state = OVERALL_STATE_TEARDOWN;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
155 tmgw_send_dlcx(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
156 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
157 GSM48_CC_CAUSE_NETWORK_OOO);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
158 disconnect_sip(call, &mgw_hold_retrieve_error);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
159 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
160 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
161
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
162 static void
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
163 mdcx_retrieve_response(call, msg)
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
164 struct call *call;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
165 struct tmgw_ctrl_resp *msg;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
166 {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
167 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
168 tmgw_send_dlcx(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
169 return;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
170 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
171 if (msg->res == TMGW_RESP_OK) {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
172 call->mgw_state = MGW_STATE_COMPLETE;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
173 mncc_send_retrieve_ack(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
174 } else {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
175 call->overall_state = OVERALL_STATE_TEARDOWN;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
176 tmgw_send_dlcx(call);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
177 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
178 GSM48_CC_CAUSE_NETWORK_OOO);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
179 disconnect_sip(call, &mgw_hold_retrieve_error);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
180 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
181 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
182
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
183 static void
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
184 mdcx_response(call, msg)
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
185 struct call *call;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
186 struct tmgw_ctrl_resp *msg;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
187 {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
188 switch (call->mgw_state) {
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
189 case MGW_STATE_CONNECTING:
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
190 mdcx_connect_response(call, msg);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
191 return;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
192 case MGW_STATE_HOLD_OP:
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
193 mdcx_hold_response(call, msg);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
194 return;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
195 case MGW_STATE_RETRIEVE_OP:
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
196 mdcx_retrieve_response(call, msg);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
197 return;
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
198 default:
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
199 syslog(LOG_CRIT,
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
200 "FATAL: invalid MGW state 0x%x on MDCX response",
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
201 call->mgw_state);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
202 exit(1);
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
203 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
204 }
e499e8db8b82 sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
205
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 static void
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 dlcx_response(call, msg)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 struct tmgw_ctrl_resp *msg;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 if (msg->res != TMGW_RESP_OK) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 syslog(LOG_CRIT, "FATAL: TMGW DLCX failed with code 0x%x",
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 msg->res);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 exit(1);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 call->mgw_state = MGW_STATE_NO_EXIST;
110
c1c94b7fc2e2 sip-in call clearing: DEAD_SIP transition implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 109
diff changeset
217 transition_dead_sip(call);
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219
128
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
220 static void
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
221 dtmf_start_response(call, msg)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
222 struct call *call;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
223 struct tmgw_ctrl_resp *msg;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
224 {
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
225 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
226 tmgw_send_dlcx(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
227 return;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
228 }
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
229 if (msg->res == TMGW_RESP_OK)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
230 mncc_dtmf_start_ok(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
231 else
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
232 mncc_dtmf_start_err(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
233 if (call->dtmf_pending_stop)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
234 tmgw_send_dtmf_stop(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
235 else
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
236 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
237 }
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
238
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
239 static void
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
240 dtmf_stop_response(call, msg)
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
241 struct call *call;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
242 struct tmgw_ctrl_resp *msg;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
243 {
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
244 if (call->overall_state == OVERALL_STATE_TEARDOWN) {
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
245 tmgw_send_dlcx(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
246 return;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
247 }
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
248 mncc_dtmf_stop_ok(call);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
249 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
250 call->dtmf_pending_stop = 0;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
251 }
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
252
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 void
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 process_tmgw_response(msg)
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 struct tmgw_ctrl_resp *msg;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 struct call *call;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 unsigned opc;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 call = find_call_with_mgw_xact(msg->transact_ref);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 if (!call) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 syslog(LOG_CRIT,
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 "FATAL: response from TMGW xact 0x%x does not match any call",
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 msg->transact_ref);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 exit(1);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 opc = call->mgw_xact;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 call->mgw_xact = 0;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 switch (opc) {
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 case TMGW_CTRL_OP_CRCX:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 crcx_response(call, msg);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 case TMGW_CTRL_OP_MDCX:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 mdcx_response(call, msg);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 return;
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 case TMGW_CTRL_OP_DLCX:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 dlcx_response(call, msg);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 return;
128
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
279 case TMGW_CTRL_OP_DTMF_START:
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
280 dtmf_start_response(call, msg);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
281 return;
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
282 case TMGW_CTRL_OP_DTMF_STOP:
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
283 dtmf_stop_response(call, msg);
5685412bd6aa sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
284 return;
60
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 default:
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 syslog(LOG_CRIT,
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 "FATAL: invalid opcode 0x%x in call->msg_xact", opc);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 exit(1);
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 }
02761f1ae5e5 sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 }