FreeCalypso > hg > themwi-system-sw
comparison sip-out/mncc_sig_out.c @ 154:e54b0a9e322f
beginning of themwi-sip-out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2022 23:04:01 -0800 |
parents | sip-in/mncc_handle.c@99fd4ae573ae |
children |
comparison
equal
deleted
inserted
replaced
153:99fd4ae573ae | 154:e54b0a9e322f |
---|---|
1 /* | |
2 * In this module we implement functions that send MNCC messages | |
3 * to OsmoMSC via themwi-mncc, to be called by SIP and TMGW events. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <sys/socket.h> | |
8 #include <sys/time.h> | |
9 #include <netinet/in.h> | |
10 #include <stdio.h> | |
11 #include <stdint.h> | |
12 #include <stdlib.h> | |
13 #include <string.h> | |
14 #include <strings.h> | |
15 #include <syslog.h> | |
16 #include "../include/mncc.h" | |
17 #include "../include/gsm48_const.h" | |
18 #include "../include/out_routes.h" | |
19 #include "call.h" | |
20 | |
21 void | |
22 mncc_signal_alerting(call) | |
23 struct call *call; | |
24 { | |
25 struct gsm_mncc msg; | |
26 | |
27 if (call->mncc_state == MNCC_STATE_ALERTING) | |
28 return; | |
29 bzero(&msg, sizeof(struct gsm_mncc)); | |
30 msg.msg_type = MNCC_ALERT_REQ; | |
31 msg.callref = call->mncc_callref; | |
32 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
33 call->mncc_state = MNCC_STATE_ALERTING; | |
34 } | |
35 | |
36 void | |
37 mncc_signal_ibt_ring(call) | |
38 struct call *call; | |
39 { | |
40 struct gsm_mncc msg; | |
41 | |
42 bzero(&msg, sizeof(struct gsm_mncc)); | |
43 if (call->overall_state == OVERALL_STATE_RINGING && | |
44 call->mncc_state != MNCC_STATE_ALERTING) { | |
45 msg.msg_type = MNCC_ALERT_REQ; | |
46 call->mncc_state = MNCC_STATE_ALERTING; | |
47 } else | |
48 msg.msg_type = MNCC_PROGRESS_REQ; | |
49 msg.callref = call->mncc_callref; | |
50 msg.fields |= MNCC_F_PROGRESS; | |
51 msg.progress.coding = GSM48_CAUSE_CODING_GSM; | |
52 msg.progress.location = GSM48_CAUSE_LOC_NET_BEYOND; | |
53 msg.progress.descr = GSM48_PROGR_IN_BAND_AVAIL; | |
54 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
55 } | |
56 | |
57 void | |
58 mncc_signal_answer_sup(call) | |
59 struct call *call; | |
60 { | |
61 struct gsm_mncc msg; | |
62 | |
63 bzero(&msg, sizeof(struct gsm_mncc)); | |
64 msg.msg_type = MNCC_SETUP_RSP; | |
65 msg.callref = call->mncc_callref; | |
66 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
67 call->mncc_state = MNCC_STATE_CONNECTED; | |
68 } | |
69 | |
70 void | |
71 mncc_dtmf_start_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_START_DTMF_RSP; | |
78 msg.callref = call->mncc_callref; | |
79 msg.fields |= MNCC_F_KEYPAD; | |
80 msg.keypad = call->dtmf_digit; | |
81 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
82 } | |
83 | |
84 void | |
85 mncc_dtmf_start_err(call) | |
86 struct call *call; | |
87 { | |
88 struct gsm_mncc msg; | |
89 | |
90 bzero(&msg, sizeof(struct gsm_mncc)); | |
91 msg.msg_type = MNCC_START_DTMF_REJ; | |
92 msg.callref = call->mncc_callref; | |
93 mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU, | |
94 GSM48_CC_CAUSE_PROTO_ERR); | |
95 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
96 } | |
97 | |
98 void | |
99 mncc_dtmf_stop_ok(call) | |
100 struct call *call; | |
101 { | |
102 struct gsm_mncc msg; | |
103 | |
104 bzero(&msg, sizeof(struct gsm_mncc)); | |
105 msg.msg_type = MNCC_STOP_DTMF_RSP; | |
106 msg.callref = call->mncc_callref; | |
107 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
108 } | |
109 | |
110 void | |
111 mncc_send_hold_ack(call) | |
112 struct call *call; | |
113 { | |
114 struct gsm_mncc msg; | |
115 | |
116 bzero(&msg, sizeof(struct gsm_mncc)); | |
117 msg.msg_type = MNCC_HOLD_CNF; | |
118 msg.callref = call->mncc_callref; | |
119 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
120 } | |
121 | |
122 void | |
123 mncc_send_retrieve_ack(call) | |
124 struct call *call; | |
125 { | |
126 struct gsm_mncc msg; | |
127 | |
128 bzero(&msg, sizeof(struct gsm_mncc)); | |
129 msg.msg_type = MNCC_RETRIEVE_CNF; | |
130 msg.callref = call->mncc_callref; | |
131 send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); | |
132 } | |
133 | |
134 void | |
135 send_rtp_connect(call) | |
136 struct call *call; | |
137 { | |
138 struct gsm_mncc_rtp rtp; | |
139 | |
140 bzero(&rtp, sizeof(struct gsm_mncc_rtp)); | |
141 rtp.msg_type = MNCC_RTP_CONNECT; | |
142 rtp.callref = call->mncc_callref; | |
143 bcopy(&call->gsm_rtp_tmgw, &rtp.addr, sizeof(struct sockaddr_storage)); | |
144 send_mncc_to_sock(call->mncc, &rtp, sizeof(struct gsm_mncc_rtp)); | |
145 } |