1 /*****************************************************************************\
3 ** Linux Call Router **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** message types and parameters **
10 \*****************************************************************************/
12 #define ISDN_TRANSMIT 256 // samples
14 enum { /* interface types */
15 INFO_ITYPE_ISDN, /* call from external */
16 INFO_ITYPE_ISDN_EXTENSION, /* call from internal extension */
21 enum { /* number types */
22 INFO_NTYPE_NOTPRESENT = 0,
24 INFO_NTYPE_SUBSCRIBER,
26 INFO_NTYPE_INTERNATIONAL
29 enum { /* number presentation */
30 INFO_PRESENT_NOTAVAIL,
32 INFO_PRESENT_RESTRICTED
35 enum { /* number presentation */
36 INFO_SCREEN_USER, /* user provided */
37 INFO_SCREEN_USER_VERIFIED_PASSED,
38 INFO_SCREEN_USER_VERIFIED_FAILED,
39 INFO_SCREEN_NETWORK /* network provided */
42 enum { /* redirection reason */
43 INFO_REDIR_UNKNOWN = 0,
45 INFO_REDIR_NORESPONSE,
46 INFO_REDIR_UNCONDITIONAL,
47 INFO_REDIR_OUTOFORDER,
48 INFO_REDIR_CALLDEFLECT
51 #define INFO_NOTIFY_NONE 0x00
52 #define INFO_NOTIFY_USER_SUSPENDED 0x80
53 #define INFO_NOTIFY_USER_RESUMED 0x81
54 #define INFO_NOTIFY_BEARER_SERVICE_CHANGED 0x82
55 #define INFO_NOTIFY_CALL_COMPLETION_DELAY 0x83
56 #define INFO_NOTIFY_CONFERENCE_ESTABLISHED 0xc2
57 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED 0xc3
58 #define INFO_NOTIFY_OTHER_PARTY_ADDED 0xc4
59 #define INFO_NOTIFY_ISOLATED 0xc5
60 #define INFO_NOTIFY_REATTACHED 0xc6
61 #define INFO_NOTIFY_OTHER_PARTY_ISOLATED 0xc7
62 #define INFO_NOTIFY_OTHER_PARTY_REATTACHED 0xc8
63 #define INFO_NOTIFY_OTHER_PARTY_SPLIT 0xc9
64 #define INFO_NOTIFY_OTHER_PARTY_DISCONNECTED 0xca
65 #define INFO_NOTIFY_CONFERENCE_FLOATING 0xcb
66 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED_P 0xcc /* preemted */
67 #define INFO_NOTIFY_CONFERENCE_FLOATING_S_U_P 0xcf /* served user preemted */
68 #define INFO_NOTIFY_CALL_IS_A_WAITING_CALL 0xe0
69 #define INFO_NOTIFY_DIVERSION_ACTIVATED 0xe8
70 #define INFO_NOTIFY_RESERVED_CT_1 0xe9
71 #define INFO_NOTIFY_RESERVED_CT_2 0xea
72 #define INFO_NOTIFY_REVERSE_CHARGING 0xee
73 #define INFO_NOTIFY_REMOTE_HOLD 0xf9
74 #define INFO_NOTIFY_REMOTE_RETRIEVAL 0xfa
75 #define INFO_NOTIFY_CALL_IS_DIVERTING 0xfb
77 enum { /* diversion types */
84 /* bearer capabilities */
85 #define INFO_BC_SPEECH 0x00
86 #define INFO_BC_DATAUNRESTRICTED 0x08
87 #define INFO_BC_DATARESTRICTED 0x09
88 #define INFO_BC_AUDIO 0x10
89 #define INFO_BC_DATAUNRESTRICTED_TONES 0x11
90 #define INFO_BC_VIDEO 0x18
93 #define INFO_BMODE_CIRCUIT 0
94 #define INFO_BMODE_PACKET 2
97 #define INFO_INFO1_NONE 0x00
98 #define INFO_INFO1_V110 0x81
99 #define INFO_INFO1_ULAW 0x82
100 #define INFO_INFO1_ALAW 0x83
101 #define INFO_INFO1_G721 0x84
102 #define INFO_INFO1_H221H242 0x85
103 #define INFO_INFO1_NONCCITT 0x87
104 #define INFO_INFO1_V120 0x88
105 #define INFO_INFO1_X31HDLC 0x89
108 #define INFO_HLC_NONE 0x00
109 #define INFO_HLC_TELEPHONY 0x81
110 #define INFO_HLC_FAXG2G3 0x84
111 #define INFO_HLC_FAXG4 0xa1
112 #define INFO_HLC_TELETEX1 0xa4
113 #define INFO_HLC_TELETEX2 0xa8
114 #define INFO_HLC_TELETEX3 0xb1
115 #define INFO_HLC_VIDEOTEX1 0xb2
116 #define INFO_HLC_VIDEOTEX2 0xb3
117 #define INFO_HLC_TELEX 0xb5
118 #define INFO_HLC_MHS 0xb8
119 #define INFO_HLC_OSI 0xc1
120 #define INFO_HLC_MAINTENANCE 0xde
121 #define INFO_HLC_MANAGEMENT 0xdf
122 #define INFO_HLC_AUDIOVISUAL 0xe0
124 enum { /* isdnsignal */
125 mISDNSIGNAL_VOLUME, /* change volume */
126 mISDNSIGNAL_CONF, /* joint/split conference */
127 mISDNSIGNAL_JOINDATA, /* data required by join instance */
128 mISDNSIGNAL_ECHO, /* enable/disable echoe */
129 mISDNSIGNAL_DELAY, /* use delay or adaptive jitter */
132 enum { /* bchannel assignment */
133 BCHANNEL_REQUEST, /* application requests bchannel */
134 BCHANNEL_RELEASE, /* application releases bchannel */
135 BCHANNEL_ASSIGN, /* bchannel assigned by LCR */
136 BCHANNEL_ASSIGN_ACK, /* application acknowledges */
137 BCHANNEL_REMOVE, /* bchannel removed by LCR */
138 BCHANNEL_REMOVE_ACK, /* application acknowledges */
141 B_STATE_IDLE, /* not open */
142 B_STATE_ACTIVATING, /* DL_ESTABLISH sent */
143 B_STATE_ACTIVE, /* channel active */
144 B_STATE_DEACTIVATING, /* DL_RELEASE sent */
145 B_STATE_EXPORTING, /* BCHANNEL_ASSIGN sent */
146 B_STATE_REMOTE, /* bchannel assigned to remote application */
147 B_STATE_IMPORTING, /* BCHANNEL_REMOVE sent */
150 B_MODE_TRANSPARENT, /* normal transparent audio */
151 B_MODE_HDLC, /* hdlc data mode */
154 /* call-info structure CALLER */
156 char id[32]; /* id of caller (user number) */
157 char extension[32]; /* internal id */
159 int isdn_port; /* internal/external port (if call is isdn) */
160 char interface[32]; /* interface name the call was from */
161 int itype; /* type of interface */
162 int ntype; /* type of number */
163 int present; /* presentation */
164 int screen; /* who provided the number */
165 char display[84]; /* display information */
166 char id2[32]; /* second callerid */
167 int ntype2; /* second type of number */
168 int present2; /* second presentation */
169 int screen2; /* second who provided the number */
170 char imsi[16]; /* IMSI for gsm originated calls */
173 /* call-info structure DIALING */
174 struct dialing_info {
175 char id[256]; /* number dialing (so far) */
176 char interfaces[128]; /* interfaces for extenal calls */
177 int itype; /* type of interface */
178 int ntype; /* type of number */
179 int sending_complete; /* end of dialing */
180 char display[84]; /* display information */
181 char keypad[33]; /* send keypad facility */
184 /* call-info structure CONNECT */
185 struct connect_info {
186 char id[32]; /* id of caller (user number) */
187 char extension[32]; /* internal id */
189 int isdn_port; /* internal/external port (if call is isdn) */
190 char interface[128]; /* interface for extenal calls */
191 int itype; /* type of interface */
192 int ntype; /* type of number */
193 int present; /* presentation */
194 int screen; /* who provided the number */
195 char display[84]; /* display information */
196 char imsi[16]; /* IMSI for gsm terminated calls */
199 /* call-info structure DISCONNECT */
200 struct disconnect_info {
201 int cause; /* reason for disconnect */
202 int location; /* disconnect location */
203 char display[84]; /* optional display information */
206 /* call-info structure REDIR */
208 char id[32]; /* id of caller (user number) */
209 char extension[32]; /* internal id */
210 int isdn_port; /* internal/external port (if call is isdn) */
211 int itype; /* type of interface */
212 int ntype; /* type of number */
213 int present; /* presentation */
214 int screen; /* who provided the number */
215 int reason; /* reason for redirecing */
218 /* call-info structure capability */
220 int source_mode; /* forward mode */
221 int bearer_capa; /* capability */
222 int bearer_mode; /* circuit/packet */
223 int bearer_info1; /* alaw,ulaw,... */
224 int hlc; /* hlc capability */
225 int exthlc; /* extendet hlc */
228 /* call-info structure NOTIFY */
230 int notify; /* notifications (see INFO_NOTIFY_*) */
231 char id[32]; /* redirection id (user number) */
232 char extension[32]; /* internal id */
233 int isdn_port; /* internal/external port (if call is isdn) */
234 int itype; /* type of interface */
235 int ntype; /* type of number */
236 int present; /* redirection presentation */
237 char display[84]; /* display information */
238 int local; /* if set, endpoints gets information about audio channel (open/close) */
241 /* call-info structure FACILITY */
242 struct facility_info {
243 char data[256]; /* data info about facility */
244 int len; /* length of facility content */
247 /* call-info structure USERUSER */
248 struct useruser_info {
251 unsigned char data[128]; /* user-user info (not a sting!)*/
254 /* call-info structure SETUP */
255 struct message_setup {
256 int isdn_port; /* card number 1...n (only on calls from isdn port) */
257 int port_type; /* type of port (only required if message is port -> epoint) */
258 int partyline; /* if set, call will be a conference room */
259 int partyline_jingle; /* if set, the jingle will be played on conference join */
260 struct caller_info callerinfo; /* information about the caller */
261 struct dialing_info dialinginfo; /* information about dialing */
262 struct redir_info redirinfo; /* info on redirection (to the calling user) */
263 struct capa_info capainfo; /* info on l2,l3 capability */
264 struct useruser_info useruser; /* user-user */
265 char context[128]; /* asterisk context */
268 /* call-info structure PARK */
276 unsigned char data[ISDN_TRANSMIT]; /* audio/hdlc data */
277 int len; /* audio/hdlc data */
281 char file[512]; /* file name */
282 int offset; /* offset to start file at (in seconds) */
286 char dir[128]; /* directory */
287 char name[128]; /* file name */
290 struct param_counter {
291 int current; /* current counter in seconds */
292 int max; /* total size of file (0=no info) */
295 struct param_mISDNsignal {
306 /* encryption control structure CRYPT */
308 int type; /* see messages in crypt.h */
310 unsigned char data[512+32]; /* a block of 512 byte + some overhead */
314 char application[32]; /* name of remote application */
317 struct param_bchannel {
318 int type; /* BCHANNEL_* */
319 unsigned int handle; /* bchannel stack/portid */
320 int tx_gain, rx_gain;
322 unsigned char crypt[128];
324 int crypt_type; /* 1 = blowfish */
327 /* structure of message parameter */
329 struct param_tone tone; /* MESSAGE_TONE */
330 char dtmf; /* MESSAGE_DTMF */
331 struct message_setup setup; /* MESSAGE_SETUP */
332 struct dialing_info information; /* MESSAGE_INFO */
333 struct connect_info connectinfo; /* CONNECT INFO */
334 struct disconnect_info disconnectinfo; /* DISCONNECT INFO */
335 struct notify_info notifyinfo; /* some notifications */
336 struct facility_info facilityinfo; /* some notifications */
337 struct park_info parkinfo; /* MESSAGE_SUSPEND, MESSAGE_RESUME */
338 int state; /* MESSAGE_TIMEOUT */
339 int knock; /* MESSAGE_KNOCK 0=off !0=on */
340 int audiopath; /* MESSAGE_audiopath see RELATION_CHANNEL_* (join.h) */
341 struct param_data data; /* MESSAGE_DATA */
342 struct param_play play; /* MESSAGE_VBOX_PLAY */
343 int speed; /* MESSAGE_VBOX_PLAY_SPEED */
344 struct param_counter counter; /* MESSAGE_TONE_COUNTER */
345 struct param_mISDNsignal mISDNsignal; /* MESSAGE_mISDNSIGNAL */
346 struct extension ext; /* tell port about extension information */
347 struct param_crypt crypt; /* MESSAGE_CRYPT */
348 struct param_hello hello; /* MESSAGE_HELLO */
349 struct param_bchannel bchannel; /* MESSAGE_BCHANNEL */
350 int direction; /* MESSAGE_NEWREF */
353 enum { /* message flow */
360 /* message structure */
362 struct lcr_msg *next;
363 int type; /* type of message */
364 int flow; /* from where to where */
365 unsigned int id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */
368 union parameter param;
371 enum { /* messages between entities */
372 MESSAGE_NONE, /* no message */
373 MESSAGE_TONE, /* set information tone (to isdn port) */
374 MESSAGE_DTMF, /* dtmf digit (from isdn port) */
375 MESSAGE_ENABLEKEYPAD, /* remote application requests keypad/dtmf */
376 MESSAGE_mISDNSIGNAL, /* special mixer command (down to isdn port) */
377 MESSAGE_SETUP, /* setup message */
378 MESSAGE_INFORMATION, /* additional digit information */
379 MESSAGE_OVERLAP, /* call accepted, send more information */
380 MESSAGE_PROCEEDING, /* proceeding */
381 MESSAGE_ALERTING, /* ringing */
382 MESSAGE_CONNECT, /* connect */
383 MESSAGE_DISCONNECT, /* disconnect with cause */
384 MESSAGE_RELEASE, /* release with cause */
385 MESSAGE_TIMEOUT, /* protocol state has timed out (port->epoint) */
386 MESSAGE_NOTIFY, /* used to send progress and notify infos */
387 MESSAGE_FACILITY, /* used to facility infos, like aocd */
388 MESSAGE_SUSPEND, /* suspend port */
389 MESSAGE_RESUME, /* resume port */
390 MESSAGE_AUDIOPATH, /* set status of audio path to endpoint (to call, audio is also set) */
391 // MESSAGE_REMOTE_AUDIO, /* tell remote to set audio status */
392 MESSAGE_PATTERN, /* pattern information tones available */
393 MESSAGE_NOPATTERN, /* pattern information tones unavailable */
394 MESSAGE_CRYPT, /* encryption message */
395 MESSAGE_DATA, /* audio/hdlc data */
396 MESSAGE_VBOX_PLAY, /* play recorded file */
397 MESSAGE_VBOX_PLAY_SPEED,/* change speed of file */
398 MESSAGE_VBOX_TONE, /* set answering VBOX tone */
399 MESSAGE_TONE_COUNTER, /* tone counter (for VBOX tone use) */
400 MESSAGE_TONE_EOF, /* tone is end of file */
401 MESSAGE_BCHANNEL, /* request/assign/remove bchannel */
402 MESSAGE_HELLO, /* hello message for remote application */
403 MESSAGE_NEWREF, /* special message to create and inform ref */
406 #define MESSAGES static const char *messages_txt[] = { \
410 "MESSAGE_ENABLEKEYPAD", \
411 "MESSAGE_mISDNSIGNAL", \
413 "MESSAGE_INFORMATION", \
415 "MESSAGE_PROCEEDING", \
416 "MESSAGE_ALERTING", \
418 "MESSAGE_DISCONNECT", \
422 "MESSAGE_FACILITY", \
425 "MESSAGE_AUDIOPATH", \
426 /* "MESSAGE_REMOTE_AUDIO",*/ \
428 "MESSAGE_NOPATTERN", \
431 "MESSAGE_VBOX_PLAY", \
432 "MESSAGE_VBOX_PLAY_SPEED", \
433 "MESSAGE_VBOX_TONE", \
434 "MESSAGE_TONE_COUNTER", \
435 "MESSAGE_TONE_EOF", \
436 "MESSAGE_BCHANNEL", \
442 struct lcr_msg *message_create(int id_from, int id_to, int flow, int type);
443 void message_put(struct lcr_msg *message);
444 struct lcr_msg *message_forward(int id_from, int id_to, int flow, union parameter *param);
445 struct lcr_msg *message_get(void);
446 void message_free(struct lcr_msg *message);