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 */
16 INFO_ITYPE_ISDN_EXTENSION, /* call from internal extension */
21 enum { /* number types */
22 INFO_NTYPE_UNKNOWN = 0,
23 INFO_NTYPE_SUBSCRIBER,
25 INFO_NTYPE_INTERNATIONAL
28 enum { /* number presentation */
29 INFO_PRESENT_NULL = 0,
31 INFO_PRESENT_RESTRICTED,
35 enum { /* number presentation */
36 INFO_SCREEN_USER, /* user provided */
37 INFO_SCREEN_NETWORK /* network provided */
40 enum { /* redirection reason */
41 INFO_REDIR_UNKNOWN = 0,
43 INFO_REDIR_NORESPONSE,
44 INFO_REDIR_UNCONDITIONAL,
45 INFO_REDIR_OUTOFORDER,
46 INFO_REDIR_CALLDEFLECT
49 #define INFO_NOTIFY_NONE 0x00
50 #define INFO_NOTIFY_USER_SUSPENDED 0x80
51 #define INFO_NOTIFY_USER_RESUMED 0x81
52 #define INFO_NOTIFY_BEARER_SERVICE_CHANGED 0x82
53 #define INFO_NOTIFY_CALL_COMPLETION_DELAY 0x83
54 #define INFO_NOTIFY_CONFERENCE_ESTABLISHED 0xc2
55 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED 0xc3
56 #define INFO_NOTIFY_OTHER_PARTY_ADDED 0xc4
57 #define INFO_NOTIFY_ISOLATED 0xc5
58 #define INFO_NOTIFY_REATTACHED 0xc6
59 #define INFO_NOTIFY_OTHER_PARTY_ISOLATED 0xc7
60 #define INFO_NOTIFY_OTHER_PARTY_REATTACHED 0xc8
61 #define INFO_NOTIFY_OTHER_PARTY_SPLIT 0xc9
62 #define INFO_NOTIFY_OTHER_PARTY_DISCONNECTED 0xca
63 #define INFO_NOTIFY_CONFERENCE_FLOATING 0xcb
64 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED_P 0xcc /* preemted */
65 #define INFO_NOTIFY_CONFERENCE_FLOATING_S_U_P 0xcf /* served user preemted */
66 #define INFO_NOTIFY_CALL_IS_A_WAITING_CALL 0xe0
67 #define INFO_NOTIFY_DIVERSION_ACTIVATED 0xe8
68 #define INFO_NOTIFY_RESERVED_CT_1 0xe9
69 #define INFO_NOTIFY_RESERVED_CT_2 0xea
70 #define INFO_NOTIFY_REVERSE_CHARGING 0xee
71 #define INFO_NOTIFY_REMOTE_HOLD 0xf9
72 #define INFO_NOTIFY_REMOTE_RETRIEVAL 0xfa
73 #define INFO_NOTIFY_CALL_IS_DIVERTING 0xfb
75 enum { /* diversion types */
82 /* bearer capabilities */
83 #define INFO_BC_SPEECH 0x00
84 #define INFO_BC_DATAUNRESTRICTED 0x08
85 #define INFO_BC_DATARESTRICTED 0x09
86 #define INFO_BC_AUDIO 0x10
87 #define INFO_BC_DATAUNRESTRICTED_TONES 0x11
88 #define INFO_BC_VIDEO 0x18
91 #define INFO_BMODE_CIRCUIT 0
92 #define INFO_BMODE_PACKET 2
95 #define INFO_INFO1_NONE 0x00
96 #define INFO_INFO1_V110 0x81
97 #define INFO_INFO1_ULAW 0x82
98 #define INFO_INFO1_ALAW 0x83
99 #define INFO_INFO1_G721 0x84
100 #define INFO_INFO1_H221H242 0x85
101 #define INFO_INFO1_NONCCITT 0x87
102 #define INFO_INFO1_V120 0x88
103 #define INFO_INFO1_X31HDLC 0x89
106 #define INFO_HLC_NONE 0x00
107 #define INFO_HLC_TELEPHONY 0x81
108 #define INFO_HLC_FAXG2G3 0x84
109 #define INFO_HLC_FAXG4 0xa1
110 #define INFO_HLC_TELETEX1 0xa4
111 #define INFO_HLC_TELETEX2 0xa8
112 #define INFO_HLC_TELETEX3 0xb1
113 #define INFO_HLC_VIDEOTEX1 0xb2
114 #define INFO_HLC_VIDEOTEX2 0xb3
115 #define INFO_HLC_TELEX 0xb5
116 #define INFO_HLC_MHS 0xb8
117 #define INFO_HLC_OSI 0xc1
118 #define INFO_HLC_MAINTENANCE 0xde
119 #define INFO_HLC_MANAGEMENT 0xdf
120 #define INFO_HLC_AUDIOVISUAL 0xe0
122 enum { /* isdnsignal */
123 mISDNSIGNAL_VOLUME, /* change volume */
124 mISDNSIGNAL_CONF, /* joint/split conference */
125 mISDNSIGNAL_JOINDATA, /* data required by join instance */
126 mISDNSIGNAL_ECHO, /* enable/disable echoe */
127 mISDNSIGNAL_DELAY, /* use delay or adaptive jitter */
130 enum { /* bchannel assignment */
131 BCHANNEL_REQUEST, /* application requests bchannel */
132 BCHANNEL_RELEASE, /* application releases bchannel */
133 BCHANNEL_ASSIGN, /* bchannel assigned by LCR */
134 BCHANNEL_ASSIGN_ACK, /* application acknowledges */
135 BCHANNEL_REMOVE, /* bchannel removed by LCR */
136 BCHANNEL_REMOVE_ACK, /* application acknowledges */
139 B_STATE_IDLE, /* not open */
140 B_STATE_ACTIVATING, /* DL_ESTABLISH sent */
141 B_STATE_ACTIVE, /* channel active */
142 B_STATE_DEACTIVATING, /* DL_RELEASE sent */
143 B_STATE_EXPORTING, /* BCHANNEL_ASSIGN sent */
144 B_STATE_REMOTE, /* bchannel assigned to remote application */
145 B_STATE_IMPORTING, /* BCHANNEL_REMOVE sent */
148 /* call-info structure CALLER */
150 char id[32]; /* id of caller (user number) */
151 char extension[32]; /* internal id */
153 int isdn_port; /* internal/external port (if call is isdn) */
154 char interface[32]; /* interface name the call was from */
155 int itype; /* type of interface */
156 int ntype; /* type of number */
157 int present; /* presentation */
158 int screen; /* who provided the number */
159 char display[84]; /* display information */
162 /* call-info structure DIALING */
163 struct dialing_info {
164 char id[256]; /* number dialing (so far) */
165 char interfaces[128]; /* interfaces for extenal calls */
166 int itype; /* type of interface */
167 int ntype; /* type of number */
168 int sending_complete; /* end of dialing */
171 /* call-info structure CONNECT */
172 struct connect_info {
173 char id[32]; /* id of caller (user number) */
174 char extension[32]; /* internal id */
176 int isdn_port; /* internal/external port (if call is isdn) */
177 char interface[128]; /* interface for extenal calls */
178 int itype; /* type of interface */
179 int ntype; /* type of number */
180 int present; /* presentation */
181 int screen; /* who provided the number */
182 char display[84]; /* display information */
185 /* call-info structure DISCONNECT */
186 struct disconnect_info {
187 int cause; /* reason for disconnect */
188 int location; /* disconnect location */
189 char display[84]; /* optional display information */
192 /* call-info structure REDIR */
194 char id[32]; /* id of caller (user number) */
195 char extension[32]; /* internal id */
196 int isdn_port; /* internal/external port (if call is isdn) */
197 int itype; /* type of interface */
198 int ntype; /* type of number */
199 int present; /* presentation */
200 int screen; /* who provided the number */
201 int reason; /* reason for redirecing */
204 /* call-info structure capability */
206 int bearer_capa; /* capability */
207 int bearer_mode; /* circuit/packet */
208 int bearer_info1; /* alaw,ulaw,... */
209 int hlc; /* hlc capability */
210 int exthlc; /* extendet hlc */
213 /* call-info structure NOTIFY */
215 int notify; /* notifications (see INFO_NOTIFY_*) */
216 char id[32]; /* redirection id (user number) */
217 char extension[32]; /* internal id */
218 int isdn_port; /* internal/external port (if call is isdn) */
219 int itype; /* type of interface */
220 int ntype; /* type of number */
221 int present; /* redirection presentation */
222 char display[84]; /* display information */
223 int local; /* if set, endpoints gets information about audio channel (open/close) */
226 /* call-info structure FACILITY */
227 struct facility_info {
228 char data[256]; /* data info about facility */
229 int len; /* length of facility content */
232 /* call-info structure USERUSER */
233 struct useruser_info {
236 unsigned char data[128]; /* user-user info (not a sting!)*/
239 /* call-info structure SETUP */
240 struct message_setup {
241 int isdn_port; /* card number 1...n (only on calls from isdn port) */
242 int port_type; /* type of port (only required if message is port -> epoint) */
243 int dtmf; /* used to enabled dtmf dialing at setup state */
244 int partyline; /* if set, call will be a conference room */
245 int partyline_jingle; /* if set, the jingle will be played on conference join */
246 struct caller_info callerinfo; /* information about the caller */
247 struct dialing_info dialinginfo; /* information about dialing */
248 struct redir_info redirinfo; /* info on redirection (to the calling user) */
249 struct capa_info capainfo; /* info on l2,l3 capability */
250 struct useruser_info useruser; /* user-user */
251 char context[128]; /* asterisk context */
254 /* call-info structure PARK */
262 unsigned char data[ISDN_TRANSMIT]; /* audio/hdlc data */
263 int len; /* audio/hdlc data */
267 char file[512]; /* file name */
268 int offset; /* offset to start file at (in seconds) */
272 char dir[128]; /* directory */
273 char name[128]; /* file name */
276 struct param_counter {
277 int current; /* current counter in seconds */
278 int max; /* total size of file (0=no info) */
281 struct param_mISDNsignal {
292 /* encryption control structure CRYPT */
294 int type; /* see messages in crypt.h */
296 unsigned char data[512+32]; /* a block of 512 byte + some overhead */
300 char application[32]; /* name of remote application */
303 struct param_bchannel {
304 int type; /* BCHANNEL_* */
305 unsigned long handle; /* bchannel stack/portid */
306 int tx_gain, rx_gain;
308 unsigned char crypt[128];
310 int crypt_type; /* 1 = blowfish */
313 /* structure of message parameter */
315 struct param_tone tone; /* MESSAGE_TONE */
316 char dtmf; /* MESSAGE_DTMF */
317 struct message_setup setup; /* MESSAGE_SETUP */
318 struct dialing_info information; /* MESSAGE_INFO */
319 struct connect_info connectinfo; /* CONNECT INFO */
320 struct disconnect_info disconnectinfo; /* DISCONNECT INFO */
321 struct notify_info notifyinfo; /* some notifications */
322 struct facility_info facilityinfo; /* some notifications */
323 struct park_info parkinfo; /* MESSAGE_SUSPEND, MESSAGE_RESUME */
324 int state; /* MESSAGE_TIMEOUT */
325 int knock; /* MESSAGE_KNOCK 0=off !0=on */
326 int audiopath; /* MESSAGE_audiopath see RELATION_CHANNEL_* (join.h) */
327 struct param_data data; /* MESSAGE_DATA */
328 struct param_play play; /* MESSAGE_VBOX_PLAY */
329 int speed; /* MESSAGE_VBOX_PLAY_SPEED */
330 struct param_counter counter; /* MESSAGE_TONE_COUNTER */
331 struct param_mISDNsignal mISDNsignal; /* MESSAGE_mISDNSIGNAL */
332 struct extension ext; /* tell port about extension information */
333 struct param_crypt crypt; /* MESSAGE_CRYPT */
334 struct param_hello hello; /* MESSAGE_HELLO */
335 struct param_bchannel bchannel; /* MESSAGE_BCHANNEL */
336 int direction; /* MESSAGE_NEWREF */
339 enum { /* message flow */
346 /* message structure */
348 struct lcr_msg *next;
349 int type; /* type of message */
350 int flow; /* from where to where */
351 unsigned long id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */
354 union parameter param;
357 enum { /* messages between entities */
358 MESSAGE_NONE, /* no message */
359 MESSAGE_TONE, /* set information tone (to isdn port) */
360 MESSAGE_DTMF, /* dtmf digit (from isdn port) */
361 MESSAGE_mISDNSIGNAL, /* special mixer command (down to isdn port) */
362 MESSAGE_SETUP, /* setup message */
363 MESSAGE_INFORMATION, /* additional digit information */
364 MESSAGE_OVERLAP, /* call accepted, send more information */
365 MESSAGE_PROCEEDING, /* proceeding */
366 MESSAGE_ALERTING, /* ringing */
367 MESSAGE_CONNECT, /* connect */
368 MESSAGE_DISCONNECT, /* disconnect with cause */
369 MESSAGE_RELEASE, /* release with cause */
370 MESSAGE_TIMEOUT, /* protocol state has timed out (port->epoint) */
371 MESSAGE_NOTIFY, /* used to send progress and notify infos */
372 MESSAGE_FACILITY, /* used to facility infos, like aocd */
373 MESSAGE_SUSPEND, /* suspend port */
374 MESSAGE_RESUME, /* resume port */
375 MESSAGE_AUDIOPATH, /* set status of audio path to endpoint (to call, audio is also set) */
376 // MESSAGE_REMOTE_AUDIO, /* tell remote to set audio status */
377 MESSAGE_PATTERN, /* pattern information tones available */
378 MESSAGE_NOPATTERN, /* pattern information tones unavailable */
379 MESSAGE_CRYPT, /* encryption message */
380 MESSAGE_DATA, /* audio/hdlc data */
381 MESSAGE_VBOX_PLAY, /* play recorded file */
382 MESSAGE_VBOX_PLAY_SPEED,/* change speed of file */
383 MESSAGE_VBOX_TONE, /* set answering VBOX tone */
384 MESSAGE_TONE_COUNTER, /* tone counter (for VBOX tone use) */
385 MESSAGE_TONE_EOF, /* tone is end of file */
386 MESSAGE_BCHANNEL, /* request/assign/remove bchannel */
387 MESSAGE_HELLO, /* hello message for remote application */
388 MESSAGE_NEWREF, /* special message to create and inform ref */
391 #define MESSAGES static const char *messages_txt[] = { \
395 "MESSAGE_mISDNSIGNAL", \
397 "MESSAGE_INFORMATION", \
399 "MESSAGE_PROCEEDING", \
400 "MESSAGE_ALERTING", \
402 "MESSAGE_DISCONNECT", \
406 "MESSAGE_FACILITY", \
409 "MESSAGE_AUDIOPATH", \
410 /* "MESSAGE_REMOTE_AUDIO",*/ \
412 "MESSAGE_NOPATTERN", \
415 "MESSAGE_VBOX_PLAY", \
416 "MESSAGE_VBOX_PLAY_SPEED", \
417 "MESSAGE_VBOX_TONE", \
418 "MESSAGE_TONE_COUNTER", \
419 "MESSAGE_TONE_EOF", \
420 "MESSAGE_BCHANNEL", \
426 struct lcr_msg *message_create(int id_from, int id_to, int flow, int type);
427 void message_put(struct lcr_msg *message);
428 struct lcr_msg *message_forward(int id_from, int id_to, int flow, union parameter *param);
429 struct lcr_msg *message_get(void);
430 void message_free(struct lcr_msg *message);