2 * Chan_Misdn -- Channel Driver for Asterisk
6 * Copyright (C) 2004, Christian Richter
8 * Christian Richter <crich@beronet.com>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
17 /** For initialization usage **/
18 /* typedef int ie_nothing_t ;*/
19 /** end of init usage **/
29 STATE_HOLD_ACKNOWLEDGE
47 enum mISDN_NUMBER_PLAN {
48 NUMPLAN_UNINITIALIZED=-1,
49 NUMPLAN_INTERNATIONAL=0x1,
51 NUMPLAN_SUBSCRIBER=0x4,
56 enum event_response_e {
57 RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE,
58 RESPONSE_IGNORE_SETUP,
74 EVENT_SETUP_ACKNOWLEDGE,
75 EVENT_CONNECT_ACKNOWLEDGE ,
76 EVENT_USER_INFORMATION,
82 EVENT_HOLD_ACKNOWLEDGE,
83 EVENT_SUSPEND_ACKNOWLEDGE,
84 EVENT_RESUME_ACKNOWLEDGE,
87 EVENT_RETRIEVE_ACKNOWLEDGE,
88 EVENT_RETRIEVE_REJECT,
92 EVENT_RELEASE_COMPLETE,
111 enum { /* bearer capability */
112 INFO_CAPABILITY_SPEECH=0,
113 INFO_CAPABILITY_AUDIO_3_1K=0x10 ,
114 INFO_CAPABILITY_AUDIO_7K=0x11 ,
115 INFO_CAPABILITY_VIDEO =0x18,
116 INFO_CAPABILITY_DIGITAL_UNRESTRICTED =0x8,
117 INFO_CAPABILITY_DIGITAL_RESTRICTED =0x09,
118 INFO_CAPABILITY_DIGITAL_UNRESTRICTED_TONES
121 enum { /* progress indicators */
122 INFO_PI_CALL_NOT_E2E_ISDN =0x01,
123 INFO_PI_CALLED_NOT_ISDN =0x02,
124 INFO_PI_CALLER_NOT_ISDN =0x03,
125 INFO_PI_CALLER_RETURNED_TO_ISDN =0x04,
126 INFO_PI_INBAND_AVAILABLE =0x08,
127 INFO_PI_DELAY_AT_INTERF =0x0a,
128 INFO_PI_INTERWORKING_WITH_PUBLIC =0x10,
129 INFO_PI_INTERWORKING_NO_RELEASE =0x11,
130 INFO_PI_INTERWORKING_NO_RELEASE_PRE_ANSWER =0x12,
131 INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13
155 struct misdn_bchannel {
172 int channel_preselected;
177 unsigned char * bframe;
186 int te_choose_channel;
192 /* wether we should use jollys dsp or not */
195 /* wether we should use our jitter buf system or not */
198 enum mISDN_NUMBER_PLAN dnumplan;
199 enum mISDN_NUMBER_PLAN rnumplan;
200 enum mISDN_NUMBER_PLAN onumplan;
203 int progress_location;
204 int progress_indicator;
206 enum facility_type facility;
207 char facility_calldeflect_nr[15];
211 /*** CRYPTING STUFF ***/
220 /*char ast_dtmf_buf[255];
221 char misdn_dtmf_buf[255]; */
223 /*** CRYPTING STUFF END***/
232 enum bc_state_e state;
251 unsigned char display[84];
252 unsigned char msn[32];
253 unsigned char oad[32];
254 unsigned char rad[32];
255 unsigned char dad[32];
256 unsigned char orig_dad[32];
257 unsigned char keypad[32];
259 unsigned char info_dad[64];
260 unsigned char infos_pending[64];
261 unsigned char info_keypad[32];
262 unsigned char clisub[24];
263 unsigned char cldsub[24];
264 unsigned char fac[132];
265 unsigned char uu[256];
270 /* struct misdn_bchannel hold_bc; */
284 struct misdn_bchannel *next;
288 enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
289 void (*cb_log) (int level, int port, char *tmpl, ...);
290 int (*cb_clearl3_true)(void);
292 struct misdn_lib_iface {
294 enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
295 void (*cb_log)(int level, int port, char *tmpl, ...);
296 int (*cb_clearl3_true)(void);
299 /***** USER IFACE **********/
301 int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data);
302 int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event );
303 void misdn_lib_destroy(void);
305 void misdn_lib_log_ies(struct misdn_bchannel *bc);
307 char *manager_isdn_get_info(enum event_e event);
309 void misdn_lib_transfer(struct misdn_bchannel* holded_bc);
311 struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel);
313 void manager_bchannel_activate(struct misdn_bchannel *bc);
314 void manager_bchannel_deactivate(struct misdn_bchannel * bc);
315 int manager_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len);
316 void manager_send_tone (struct misdn_bchannel *bc, enum tone_e tone);
318 void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2);
321 int misdn_lib_port_restart(int port);
322 int misdn_lib_get_port_info(int port);
324 int misdn_lib_port_up(int port);
326 int misdn_lib_get_port_up (int port) ;
328 int misdn_lib_maxports_get(void) ;
330 void misdn_lib_release(struct misdn_bchannel *bc);
332 int misdn_cap_is_speech(int cap);
333 int misdn_inband_avail(struct misdn_bchannel *bc);
335 int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, void *data);
338 void manager_ec_enable(struct misdn_bchannel *bc);
339 void manager_ec_disable(struct misdn_bchannel *bc);
341 void get_show_stack_details(int port, char *buf);
344 /** Ibuf interface **/
345 int misdn_ibuf_usedcount(void *buf);
346 int misdn_ibuf_freecount(void *buf);
347 void misdn_ibuf_memcpy_r(char *to, void *from, int len);
348 void misdn_ibuf_memcpy_w(void *buf, char *from, int len);
350 /** Ibuf interface End **/
352 void misdn_lib_setup_bc(struct misdn_bchannel *bc);
354 void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
355 void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
358 int misdn_lib_is_ptp(int port);
360 #define PRI_TRANS_CAP_SPEECH 0x0
361 #define PRI_TRANS_CAP_DIGITAL 0x08
362 #define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
363 #define PRI_TRANS_CAP_3_1K_AUDIO 0x10
364 #define PRI_TRANS_CAP_7K_AUDIO 0x11