FreeCalypso > hg > themwi-system-sw
annotate sip-in/mncc_sig_out.c @ 216:6aa2cd650943
tcpserv-dump: specify bind IP on the command line
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jul 2023 22:19:08 -0800 |
parents | 99fd4ae573ae |
children |
rev | line source |
---|---|
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
153
99fd4ae573ae
sip-in: split mncc_sig_out.c from mncc_handle.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
2 * In this module we implement functions that send MNCC messages |
99fd4ae573ae
sip-in: split mncc_sig_out.c from mncc_handle.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
3 * to OsmoMSC via themwi-mncc, to be called by SIP and TMGW events. |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
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> |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <netinet/in.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdio.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdint.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdlib.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <string.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <strings.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <syslog.h> |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "../include/mncc.h" |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "../include/gsm48_const.h" |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "call.h" |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
87
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
20 void |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
21 send_mncc_connect_ack(call) |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
22 struct call *call; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
23 { |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
24 struct gsm_mncc ack; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
25 |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
26 bzero(&ack, sizeof(struct gsm_mncc)); |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
27 ack.msg_type = MNCC_SETUP_COMPL_REQ; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
28 ack.callref = call->mncc_callref; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
29 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc)); |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
30 call->mncc_state = MNCC_STATE_CONNECTED; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
31 call->overall_state = OVERALL_STATE_CONNECTED; |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
32 } |
9e9034ef476c
sip-in: send CONNECT ACK to GSM upon SIP ACK after 200
Mychaela Falconia <falcon@freecalypso.org>
parents:
86
diff
changeset
|
33 |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
34 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
35 mncc_dtmf_start_ok(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
36 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
37 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
38 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
39 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
40 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
41 msg.msg_type = MNCC_START_DTMF_RSP; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
42 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
43 msg.fields |= MNCC_F_KEYPAD; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
44 msg.keypad = call->dtmf_digit; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
45 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
46 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
47 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
48 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
49 mncc_dtmf_start_err(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
50 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
51 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
52 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
53 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
54 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
55 msg.msg_type = MNCC_START_DTMF_REJ; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
56 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
57 mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU, |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
58 GSM48_CC_CAUSE_PROTO_ERR); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
59 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
60 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
61 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
62 void |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
63 mncc_dtmf_stop_ok(call) |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
64 struct call *call; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
65 { |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
66 struct gsm_mncc msg; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
67 |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
68 bzero(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
69 msg.msg_type = MNCC_STOP_DTMF_RSP; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
70 msg.callref = call->mncc_callref; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
71 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
72 } |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
110
diff
changeset
|
73 |
141
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
74 void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
75 mncc_send_hold_ack(call) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
76 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
77 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
78 struct gsm_mncc msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
79 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
80 bzero(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
81 msg.msg_type = MNCC_HOLD_CNF; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
82 msg.callref = call->mncc_callref; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
83 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
84 } |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
85 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
86 void |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
87 mncc_send_retrieve_ack(call) |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
88 struct call *call; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
89 { |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
90 struct gsm_mncc msg; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
91 |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
92 bzero(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
93 msg.msg_type = MNCC_RETRIEVE_CNF; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
94 msg.callref = call->mncc_callref; |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
95 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
e499e8db8b82
sip-in: handle call hold and retrieve
Mychaela Falconia <falcon@freecalypso.org>
parents:
140
diff
changeset
|
96 } |