FreeCalypso > hg > themwi-system-sw
annotate sip-out/call.h @ 267:81958b35f74d
NANP validation: allow made-up area codes of N9X form
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 13 Nov 2023 15:28:09 -0800 |
parents | bfa9f0c0f0ac |
children |
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:
141
diff
changeset
|
2 * In this header file we define two key structures for call state |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
3 * in themwi-sip-out: struct call exists for each call just like in |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
4 * themwi-sip-in, and struct mncc_conn exists for every connection |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
5 * to our outcall socket. |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
8 struct mncc_conn { |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
9 int fd; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
10 struct mncc_conn *next; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
11 }; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
12 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
13 #define MAX_SIP_CALL_ID 30 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
14 #define MAX_SIP_FROM_HEADER (MAX_SIP_USER_PART + 5 + 17 + 5 + 8) |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
15 #define MAX_SIP_TO_URI (MAX_SIP_USER_PART + MAX_SIP_DEST_DOMAIN + 5) |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
16 #define MAX_SIP_TO_TAG 63 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
17 |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 struct call { |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
19 /* global call list */ |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 struct call *next; |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
21 char sip_call_id[MAX_SIP_CALL_ID+1]; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
22 int sip_call_exists; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
23 /* MNCC call origin */ |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
24 struct mncc_conn *mncc; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
25 uint32_t mncc_callref; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
26 /* call routing info */ |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
27 char from_user[MAX_SIP_USER_PART+1]; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
28 char from_header[MAX_SIP_FROM_HEADER+1]; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
29 char to_uri[MAX_SIP_TO_URI+1]; |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
30 char to_tag[MAX_SIP_TO_TAG+1]; |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 struct sockaddr_in udp_sin; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 /* PSTN side RTP info */ |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 struct sockaddr_in pstn_rtp_local; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 struct sockaddr_in pstn_rtp_remote; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 int use_pcma; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 /* GSM side RTP info */ |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 struct sockaddr_storage gsm_rtp_osmo; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 struct sockaddr_storage gsm_rtp_tmgw; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 uint32_t gsm_payload_type; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 uint32_t gsm_payload_msg_type; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 /* state machines */ |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 uint32_t overall_state; |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
43 uint32_t mncc_state; |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 uint32_t sip_state; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 uint32_t mgw_state; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 uint32_t mgw_ep_id; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 uint32_t mgw_xact; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 uint32_t mgw_xact_id; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 unsigned sip_tx_count; |
109
9b87894704eb
sip-in: first step toward final call clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
50 time_t sip_clear_time; |
128
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
51 int dtmf_digit; |
5685412bd6aa
sip-in: pass DTMF start & stop to themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
52 int dtmf_pending_stop; |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 }; |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
55 #define OVERALL_STATE_GSM_RTP 1 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
56 #define OVERALL_STATE_CRCX 2 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
57 #define OVERALL_STATE_SIP_OUT 3 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
58 #define OVERALL_STATE_RINGING 4 |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 #define OVERALL_STATE_CONNECTED 5 |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #define OVERALL_STATE_TEARDOWN 6 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
61 #define OVERALL_STATE_SIP_FINISH 7 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
62 #define OVERALL_STATE_GC 8 |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
64 #define MNCC_STATE_MO_PROC 1 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
65 #define MNCC_STATE_GOT_RTP 2 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
66 #define MNCC_STATE_ALERTING 3 |
63
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
67 #define MNCC_STATE_CONNECTED 4 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
68 #define MNCC_STATE_DISCONNECT 5 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
69 #define MNCC_STATE_RELEASE 6 |
e5aee661e3b2
sip-in: beginning to handle incoming MNCC messages from themwi-mncc
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
70 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
71 #define SIP_STATE_INV_SENT 1 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
72 #define SIP_STATE_100_RCVD 2 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
73 #define SIP_STATE_CONNECTED 3 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
74 #define SIP_STATE_CANCEL_SENT 4 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
75 #define SIP_STATE_BYE_SENT 5 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
76 #define SIP_STATE_ACCEPT_100 6 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
77 #define SIP_STATE_ACCEPT_200 7 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
78 #define SIP_STATE_ENDED 8 |
163
bfa9f0c0f0ac
sip-out: handle incoming BYE as UAS
Mychaela Falconia <falcon@freecalypso.org>
parents:
154
diff
changeset
|
79 #define SIP_STATE_MSG_SIZE_ERR 9 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
80 |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 #define MGW_STATE_NO_EXIST 0 |
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 #define MGW_STATE_ALLOCATED 1 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
83 #define MGW_STATE_IBT_CONN 2 |
60
02761f1ae5e5
sip-in INVITE processing: got as far as CRCX completion
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 #define MGW_STATE_COMPLETE 3 |
154
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
85 #define MGW_STATE_HELD 4 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
86 #define MGW_STATE_MDCX_IBT 5 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
87 #define MGW_STATE_MDCX_CONN 6 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
88 #define MGW_STATE_MDCX_HOLD 7 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
89 #define MGW_STATE_MDCX_RETR 8 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
90 #define MGW_STATE_DTMF_OP 9 |
e54b0a9e322f
beginning of themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
91 #define MGW_STATE_DELETING 10 |