1 /*****************************************************************************\
3 ** Linux Call Router **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** message types and parameters **
10 \*****************************************************************************/
12 enum { /* interface types */
14 INFO_ITYPE_ISDN_EXTENSION, /* call from internal extension */
19 enum { /* number types */
21 INFO_NTYPE_SUBSCRIBER,
23 INFO_NTYPE_INTERNATIONAL,
26 enum { /* number presentation */
29 INFO_PRESENT_RESTRICTED,
30 INFO_PRESENT_NOTAVAIL,
33 enum { /* number presentation */
34 INFO_SCREEN_USER, /* user provided */
35 INFO_SCREEN_NETWORK, /* network provided */
38 enum { /* redirection reason */
41 INFO_REDIR_NORESPONSE,
42 INFO_REDIR_UNCONDITIONAL,
43 INFO_REDIR_OUTOFORDER,
44 INFO_REDIR_CALLDEFLECT,
47 #define INFO_NOTIFY_NONE 0x00
48 #define INFO_NOTIFY_USER_SUSPENDED 0x80
49 #define INFO_NOTIFY_USER_RESUMED 0x81
50 #define INFO_NOTIFY_BEARER_SERVICE_CHANGED 0x82
51 #define INFO_NOTIFY_CALL_COMPLETION_DELAY 0x83
52 #define INFO_NOTIFY_CONFERENCE_ESTABLISHED 0xc2
53 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED 0xc3
54 #define INFO_NOTIFY_OTHER_PARTY_ADDED 0xc4
55 #define INFO_NOTIFY_ISOLATED 0xc5
56 #define INFO_NOTIFY_REATTACHED 0xc6
57 #define INFO_NOTIFY_OTHER_PARTY_ISOLATED 0xc7
58 #define INFO_NOTIFY_OTHER_PARTY_REATTACHED 0xc8
59 #define INFO_NOTIFY_OTHER_PARTY_SPLIT 0xc9
60 #define INFO_NOTIFY_OTHER_PARTY_DISCONNECTED 0xca
61 #define INFO_NOTIFY_CONFERENCE_FLOATING 0xcb
62 #define INFO_NOTIFY_CONFERENCE_DISCONNECTED_P 0xcc /* preemted */
63 #define INFO_NOTIFY_CONFERENCE_FLOATING_S_U_P 0xcf /* served user preemted */
64 #define INFO_NOTIFY_CALL_IS_A_WAITING_CALL 0xe0
65 #define INFO_NOTIFY_DIVERSION_ACTIVATED 0xe8
66 #define INFO_NOTIFY_RESERVED_CT_1 0xe9
67 #define INFO_NOTIFY_RESERVED_CT_2 0xea
68 #define INFO_NOTIFY_REVERSE_CHARGING 0xee
69 #define INFO_NOTIFY_REMOTE_HOLD 0xf9
70 #define INFO_NOTIFY_REMOTE_RETRIEVAL 0xfa
71 #define INFO_NOTIFY_CALL_IS_DIVERTING 0xfb
73 enum { /* diversion types */
80 /* bearer capabilities */
81 #define INFO_BC_SPEECH 0x00
82 #define INFO_BC_DATAUNRESTRICTED 0x08
83 #define INFO_BC_DATARESTRICTED 0x09
84 #define INFO_BC_AUDIO 0x10
85 #define INFO_BC_DATAUNRESTRICTED_TONES 0x11
86 #define INFO_BC_VIDEO 0x18
89 #define INFO_BMODE_CIRCUIT 0
90 #define INFO_BMODE_PACKET 2
93 #define INFO_INFO1_NONE 0x00
94 #define INFO_INFO1_V110 0x81
95 #define INFO_INFO1_ULAW 0x82
96 #define INFO_INFO1_ALAW 0x83
97 #define INFO_INFO1_G721 0x84
98 #define INFO_INFO1_H221H242 0x85
99 #define INFO_INFO1_NONCCITT 0x87
100 #define INFO_INFO1_V120 0x88
101 #define INFO_INFO1_X31HDLC 0x89
104 #define INFO_HLC_NONE 0x00
105 #define INFO_HLC_TELEPHONY 0x81
106 #define INFO_HLC_FAXG2G3 0x84
107 #define INFO_HLC_FAXG4 0xa1
108 #define INFO_HLC_TELETEX1 0xa4
109 #define INFO_HLC_TELETEX2 0xa8
110 #define INFO_HLC_TELETEX3 0xb1
111 #define INFO_HLC_VIDEOTEX1 0xb2
112 #define INFO_HLC_VIDEOTEX2 0xb3
113 #define INFO_HLC_TELEX 0xb5
114 #define INFO_HLC_MHS 0xb8
115 #define INFO_HLC_OSI 0xc1
116 #define INFO_HLC_MAINTENANCE 0xde
117 #define INFO_HLC_MANAGEMENT 0xdf
118 #define INFO_HLC_AUDIOVISUAL 0xe0
120 enum { /* isdnsignal */
121 mISDNSIGNAL_VOLUME, /* change volume */
122 mISDNSIGNAL_CONF, /* joint/split conference */
123 mISDNSIGNAL_JOINDATA, /* data required by join instance */
124 mISDNSIGNAL_ECHO, /* enable/disable echoe */
125 mISDNSIGNAL_DELAY, /* use delay or adaptive jitter */
128 /* call-info structure CALLER */
130 char id[32]; /* id of caller (user number) */
131 char extension[32]; /* internal id */
133 int isdn_port; /* internal/external port (if call is isdn) */
134 char interface[32]; /* interface name the call was from */
135 int itype; /* type of interface */
136 int ntype; /* type of number */
137 int present; /* presentation */
138 int screen; /* who provided the number */
139 char display[84]; /* display information */
142 /* call-info structure DIALING */
143 struct dialing_info {
144 char id[256]; /* number dialing (so far) */
145 char interfaces[128]; /* interfaces for extenal calls */
146 int itype; /* type of interface */
147 int ntype; /* type of number */
148 int sending_complete; /* end of dialing */
151 /* call-info structure CONNECT */
152 struct connect_info {
153 char id[32]; /* id of caller (user number) */
154 char extension[32]; /* internal id */
156 int isdn_port; /* internal/external port (if call is isdn) */
157 char interface[128]; /* interface for extenal calls */
158 int itype; /* type of interface */
159 int ntype; /* type of number */
160 int present; /* presentation */
161 int screen; /* who provided the number */
162 char display[84]; /* display information */
165 /* call-info structure DISCONNECT */
166 struct disconnect_info {
167 int cause; /* reason for disconnect */
168 int location; /* disconnect location */
169 char display[84]; /* optional display information */
172 /* call-info structure REDIR */
174 char id[32]; /* id of caller (user number) */
175 char extension[32]; /* internal id */
176 int isdn_port; /* internal/external port (if call is isdn) */
177 int itype; /* type of interface */
178 int ntype; /* type of number */
179 int present; /* presentation */
180 int screen; /* who provided the number */
181 int reason; /* reason for redirecing */
184 /* call-info structure capability */
186 int bearer_capa; /* capability */
187 int bearer_mode; /* circuit/packet */
188 int bearer_info1; /* alaw,ulaw,... */
189 int hlc; /* hlc capability */
190 int exthlc; /* extendet hlc */
193 /* call-info structure NOTIFY */
195 int notify; /* notifications (see INFO_NOTIFY_*) */
196 char id[32]; /* redirection id (user number) */
197 char extension[32]; /* internal id */
198 int isdn_port; /* internal/external port (if call is isdn) */
199 int itype; /* type of interface */
200 int ntype; /* type of number */
201 int present; /* redirection presentation */
202 char display[84]; /* display information */
203 int local; /* if set, endpoints gets information about audio channel (open/close) */
206 /* call-info structure FACILITY */
207 struct facility_info {
208 char data[256]; /* data info about facility */
209 int len; /* length of facility content */
212 /* call-info structure USERUSER */
213 struct useruser_info {
216 unsigned char data[128]; /* user-user info (not a sting!)*/
219 /* call-info structure SETUP */
220 struct message_setup {
221 int isdn_port; /* card number 1...n (only on calls from isdn port) */
222 int port_type; /* type of port (only required if message is port -> epoint) */
223 int dtmf; /* used to enabled dtmf dialing at setup state */
224 int partyline; /* if set, call will be a conference room */
225 struct caller_info callerinfo; /* information about the caller */
226 struct dialing_info dialinginfo; /* information about dialing */
227 struct redir_info redirinfo; /* info on redirection (to the calling user) */
228 struct capa_info capainfo; /* info on l2,l3 capability */
229 struct useruser_info useruser; /* user-user */
232 /* call-info structure PARK */
240 unsigned char data[512]; /* audio/hdlc data */
241 int len; /* audio/hdlc data */
245 char file[512]; /* file name */
246 int offset; /* offset to start file at (in seconds) */
250 char dir[128]; /* directory */
251 char name[128]; /* file name */
254 struct param_counter {
255 int current; /* current counter in seconds */
256 int max; /* total size of file (0=no info) */
259 struct param_mISDNsignal {
270 /* encryption control structure CRYPT */
272 int type; /* see messages in crypt.h */
274 unsigned char data[512+32]; /* a block of 512 byte + some overhead */
278 char application[32]; /* name of remote application */
281 struct param_bchannel {
282 unsigned long addr; /* bchannel stack address */
285 /* structure of message parameter */
287 struct param_tone tone; /* MESSAGE_TONE */
288 char dtmf; /* MESSAGE_DTMF */
289 struct message_setup setup; /* MESSAGE_SETUP */
290 struct dialing_info information; /* MESSAGE_INFO */
291 struct connect_info connectinfo; /* CONNECT INFO */
292 struct disconnect_info disconnectinfo; /* DISCONNECT INFO */
293 struct notify_info notifyinfo; /* some notifications */
294 struct facility_info facilityinfo; /* some notifications */
295 struct park_info parkinfo; /* MESSAGE_SUSPEND, MESSAGE_RESUME */
296 int state; /* MESSAGE_TIMEOUT */
297 int knock; /* MESSAGE_KNOCK 0=off !0=on */
298 int audiopath; /* MESSAGE_audiopath see RELATION_CHANNEL_* (join.h) */
299 struct param_data data; /* MESSAGE_DATA */
300 struct param_play play; /* MESSAGE_VBOX_PLAY */
301 int speed; /* MESSAGE_VBOX_PLAY_SPEED */
302 struct param_counter counter; /* MESSAGE_TONE_COUNTER */
303 struct param_mISDNsignal mISDNsignal; /* MESSAGE_mISDNSIGNAL */
304 struct extension ext; /* tell port about extension information */
305 struct param_crypt crypt; /* MESSAGE_CRYPT */
306 struct param_hello hello; /* MESSAGE_HELLO */
307 struct param_bchannel bchannel; /* MESSAGE_BCHANNEL */
310 enum { /* message flow */
317 /* message structure */
319 struct message *next;
320 int type; /* type of message */
321 int flow; /* from where to where */
322 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 */
325 union parameter param;
328 enum { /* messages between entities */
329 MESSAGE_NONE, /* no message */
330 MESSAGE_TONE, /* set information tone (to isdn port) */
331 MESSAGE_DTMF, /* dtmf digit (from isdn port) */
332 MESSAGE_mISDNSIGNAL, /* special mixer command (down to isdn port) */
334 MESSAGE_SETUP, /* setup message */
335 MESSAGE_INFORMATION, /* additional digit information */
336 MESSAGE_OVERLAP, /* call accepted, send more information */
337 MESSAGE_PROCEEDING, /* proceeding */
338 MESSAGE_ALERTING, /* ringing */
339 MESSAGE_CONNECT, /* connect */
340 MESSAGE_DISCONNECT, /* disconnect with cause */
341 MESSAGE_RELEASE, /* release with cause */
342 MESSAGE_TIMEOUT, /* protocol state has timed out (port->epoint) */
343 MESSAGE_NOTIFY, /* used to send progress and notify infos */
344 MESSAGE_FACILITY, /* used to facility infos, like aocd */
346 MESSAGE_SUSPEND, /* suspend port */
347 MESSAGE_RESUME, /* resume port */
349 MESSAGE_AUDIOPATH, /* set status of audio path to endpoint (to call, audio is also set) */
350 // MESSAGE_REMOTE_AUDIO, /* tell remote to set audio status */
351 MESSAGE_PATTERN, /* pattern information tones available */
352 MESSAGE_NOPATTERN, /* pattern information tones unavailable */
353 MESSAGE_CRYPT, /* encryption message */
355 MESSAGE_DATA, /* audio/hdlc data */
357 MESSAGE_VBOX_PLAY, /* play recorded file */
358 MESSAGE_VBOX_PLAY_SPEED,/* change speed of file */
359 MESSAGE_VBOX_TONE, /* set answering VBOX tone */
360 MESSAGE_TONE_COUNTER, /* tone counter (for VBOX tone use) */
361 MESSAGE_TONE_EOF, /* tone is end of file */
362 MESSAGE_BCHANNEL, /* request/assign bchannel */
363 MESSAGE_BCHANNEL_FREE, /* requests/assigns bchannel to be free */
364 MESSAGE_HELLO, /* hello message for remote application */
365 MESSAGE_NEWREF, /* special message to create and inform ref */
368 #define MESSAGES static const char *messages_txt[] = { \
372 "MESSAGE_mISDNSIGNAL", \
374 "MESSAGE_INFORMATION", \
376 "MESSAGE_PROCEEDING", \
377 "MESSAGE_ALERTING", \
379 "MESSAGE_DISCONNECT", \
383 "MESSAGE_FACILITY", \
386 "MESSAGE_AUDIOPATH", \
387 /* "MESSAGE_REMOTE_AUDIO",*/ \
389 "MESSAGE_NOPATTERN", \
392 "MESSAGE_VBOX_PLAY", \
393 "MESSAGE_VBOX_PLAY_SPEED", \
394 "MESSAGE_VBOX_TONE", \
395 "MESSAGE_TONE_COUNTER", \
396 "MESSAGE_TONE_EOF", \
397 "MESSAGE_BCHANNEL", \
403 struct message *message_create(int id_from, int id_to, int flow, int type);
404 void message_put(struct message *message);
405 struct message *message_forward(int id_from, int id_to, int flow, union parameter *param);
406 struct message *message_get(void);
407 void message_free(struct message *message);