Fixed audio bridge to mISDN ports
[lcr.git] / mncc.h
1
2 #define MNCC_SETUP_REQ          0x0101
3 #define MNCC_SETUP_IND          0x0102
4 #define MNCC_SETUP_RSP          0x0103
5 #define MNCC_SETUP_CNF          0x0104
6 #define MNCC_SETUP_COMPL_REQ    0x0105
7 #define MNCC_SETUP_COMPL_IND    0x0106
8 /* MNCC_REJ_* is perfomed via MNCC_REL_* */
9 #define MNCC_CALL_CONF_IND      0x0107
10 #define MNCC_CALL_PROC_REQ      0x0108
11 #define MNCC_PROGRESS_REQ       0x0109
12 #define MNCC_ALERT_REQ          0x010a
13 #define MNCC_ALERT_IND          0x010b
14 #define MNCC_NOTIFY_REQ         0x010c
15 #define MNCC_NOTIFY_IND         0x010d
16 #define MNCC_DISC_REQ           0x010e
17 #define MNCC_DISC_IND           0x010f
18 #define MNCC_REL_REQ            0x0110
19 #define MNCC_REL_IND            0x0111
20 #define MNCC_REL_CNF            0x0112
21 #define MNCC_FACILITY_REQ       0x0113
22 #define MNCC_FACILITY_IND       0x0114
23 #define MNCC_START_DTMF_IND     0x0115
24 #define MNCC_START_DTMF_RSP     0x0116
25 #define MNCC_START_DTMF_REJ     0x0117
26 #define MNCC_STOP_DTMF_IND      0x0118
27 #define MNCC_STOP_DTMF_RSP      0x0119
28 #define MNCC_MODIFY_REQ         0x011a
29 #define MNCC_MODIFY_IND         0x011b
30 #define MNCC_MODIFY_RSP         0x011c
31 #define MNCC_MODIFY_CNF         0x011d
32 #define MNCC_MODIFY_REJ         0x011e
33 #define MNCC_HOLD_IND           0x011f
34 #define MNCC_HOLD_CNF           0x0120
35 #define MNCC_HOLD_REJ           0x0121
36 #define MNCC_RETRIEVE_IND       0x0122
37 #define MNCC_RETRIEVE_CNF       0x0123
38 #define MNCC_RETRIEVE_REJ       0x0124
39 #define MNCC_USERINFO_REQ       0x0125
40 #define MNCC_USERINFO_IND       0x0126
41 #define MNCC_REJ_REQ            0x0127
42 #define MNCC_REJ_IND            0x0128
43 #define MNCC_PROGRESS_IND       0x0129
44 #define MNCC_CALL_PROC_IND      0x012a
45 #define MNCC_CALL_CONF_REQ      0x012b
46 #define MNCC_START_DTMF_REQ     0x012c
47 #define MNCC_STOP_DTMF_REQ      0x012d
48 #define MNCC_HOLD_REQ           0x012e
49 #define MNCC_RETRIEVE_REQ       0x012f
50
51 #define MNCC_BRIDGE             0x0200
52 #define MNCC_FRAME_RECV         0x0201
53 #define MNCC_FRAME_DROP         0x0202
54 #define MNCC_LCHAN_MODIFY       0x0203
55 #define MNCC_RTP_CREATE         0x0204
56 #define MNCC_RTP_CONNECT        0x0205
57 #define MNCC_RTP_FREE           0x0206
58
59 #define GSM_TCHF_FRAME          0x0300
60 #define GSM_TCHF_FRAME_EFR      0x0301
61
62 #define GSM_MAX_FACILITY        128
63 #define GSM_MAX_SSVERSION       128
64 #define GSM_MAX_USERUSER        128
65
66 #define MNCC_F_BEARER_CAP       0x0001
67 #define MNCC_F_CALLED           0x0002
68 #define MNCC_F_CALLING          0x0004
69 #define MNCC_F_REDIRECTING      0x0008
70 #define MNCC_F_CONNECTED        0x0010
71 #define MNCC_F_CAUSE            0x0020
72 #define MNCC_F_USERUSER         0x0040
73 #define MNCC_F_PROGRESS         0x0080
74 #define MNCC_F_EMERGENCY        0x0100
75 #define MNCC_F_FACILITY         0x0200
76 #define MNCC_F_SSVERSION        0x0400
77 #define MNCC_F_CCCAP            0x0800
78 #define MNCC_F_KEYPAD           0x1000
79 #define MNCC_F_SIGNAL           0x2000
80
81 #define GSM_MAX_FACILITY       128
82 #define GSM_MAX_SSVERSION      128
83 #define GSM_MAX_USERUSER       128
84
85 /* Expanded fields from GSM TS 04.08, Table 10.5.102 */
86 struct gsm_mncc_bearer_cap {
87         int             transfer;       /* Information Transfer Capability */
88         int             mode;           /* Transfer Mode */
89         int             coding;         /* Coding Standard */
90         int             radio;          /* Radio Channel Requirement */
91         int             speech_ctm;     /* CTM text telephony indication */
92         int             speech_ver[8];  /* Speech version indication */
93 };
94
95 struct gsm_mncc_number {
96         int             type;
97         int             plan;
98         int             present;
99         int             screen;
100         char            number[33];
101 };
102
103 struct gsm_mncc_cause {
104         int             location;
105         int             coding;
106         int             rec;
107         int             rec_val;
108         int             value;
109         int             diag_len;
110         char            diag[32];
111 };
112
113 struct gsm_mncc_useruser {
114         int             proto;
115         char            info[GSM_MAX_USERUSER + 1]; /* + termination char */
116 };
117
118 struct gsm_mncc_progress {
119         int             coding;
120         int             location;
121         int             descr;
122 };
123
124 struct gsm_mncc_facility {
125         int             len;
126         char            info[GSM_MAX_FACILITY];
127 };
128
129 struct gsm_mncc_ssversion {
130         int             len;
131         char            info[GSM_MAX_SSVERSION];
132 };
133
134 struct gsm_mncc_cccap {
135         int             dtmf;
136         int             pcp;
137 };
138
139 enum {
140         GSM_MNCC_BCAP_SPEECH    = 0,
141         GSM_MNCC_BCAP_UNR_DIG   = 1,
142         GSM_MNCC_BCAP_AUDIO     = 2,
143         GSM_MNCC_BCAP_FAX_G3    = 3,
144         GSM_MNCC_BCAP_OTHER_ITC = 5,
145         GSM_MNCC_BCAP_RESERVED  = 7,
146 };
147
148 struct gsm_mncc {
149         /* context based information */
150         u_int32_t       msg_type;
151         u_int32_t       callref;
152
153         /* which fields are present */
154         u_int32_t       fields;
155
156         /* data derived informations (MNCC_F_ based) */
157         struct gsm_mncc_bearer_cap      bearer_cap;
158         struct gsm_mncc_number          called;
159         struct gsm_mncc_number          calling;
160         struct gsm_mncc_number          redirecting;
161         struct gsm_mncc_number          connected;
162         struct gsm_mncc_cause           cause;
163         struct gsm_mncc_progress        progress;
164         struct gsm_mncc_useruser        useruser;
165         struct gsm_mncc_facility        facility;
166         struct gsm_mncc_cccap           cccap;
167         struct gsm_mncc_ssversion       ssversion;
168         struct  {
169                 int             sup;
170                 int             inv;
171         } clir;
172         int             signal;
173
174         /* data derived information, not MNCC_F based */
175         int             keypad;
176         int             more;
177         int             notify; /* 0..127 */
178         int             emergency;
179         char            imsi[16];
180
181         unsigned char   lchan_type;
182         unsigned char   lchan_mode;
183 };
184
185 struct gsm_data_frame {
186         u_int32_t       msg_type;
187         u_int32_t       callref;
188         unsigned char   data[0];
189 };
190
191 struct gsm_mncc_rtp {
192         uint32_t        msg_type;
193         uint32_t        callref;
194         uint32_t        ip;
195         uint16_t        port;
196 };
197
198