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
18 /** For initialization usage **/
19 /* typedef int ie_nothing_t ;*/
20 /** end of init usage **/
32 void beroec_init(void);
33 void beroec_exit(void);
34 beroec_t *beroec_new(int tail, enum beroec_type type, int anti_howl,
35 int tonedisable, int zerocoeff, int adapt, int nlp);
37 void beroec_destroy(beroec_t *ec);
38 int beroec_cancel_alaw_chunk(beroec_t *ec,
43 int beroec_version(void);
85 enum mISDN_NUMBER_PLAN {
86 NUMPLAN_UNINITIALIZED=-1,
87 NUMPLAN_INTERNATIONAL=0x1,
89 NUMPLAN_SUBSCRIBER=0x4,
94 enum event_response_e {
95 RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE,
96 RESPONSE_IGNORE_SETUP,
106 EVENT_BCHAN_ACTIVATED,
113 EVENT_SETUP_ACKNOWLEDGE,
114 EVENT_CONNECT_ACKNOWLEDGE ,
115 EVENT_USER_INFORMATION,
116 EVENT_SUSPEND_REJECT,
121 EVENT_HOLD_ACKNOWLEDGE,
122 EVENT_SUSPEND_ACKNOWLEDGE,
123 EVENT_RESUME_ACKNOWLEDGE,
126 EVENT_RETRIEVE_ACKNOWLEDGE,
127 EVENT_RETRIEVE_REJECT,
131 EVENT_RELEASE_COMPLETE,
134 EVENT_STATUS_ENQUIRY,
152 enum { /* bearer capability */
153 INFO_CAPABILITY_SPEECH=0,
154 INFO_CAPABILITY_AUDIO_3_1K=0x10 ,
155 INFO_CAPABILITY_AUDIO_7K=0x11 ,
156 INFO_CAPABILITY_VIDEO =0x18,
157 INFO_CAPABILITY_DIGITAL_UNRESTRICTED =0x8,
158 INFO_CAPABILITY_DIGITAL_RESTRICTED =0x09,
159 INFO_CAPABILITY_DIGITAL_UNRESTRICTED_TONES
162 enum { /* progress indicators */
163 INFO_PI_CALL_NOT_E2E_ISDN =0x01,
164 INFO_PI_CALLED_NOT_ISDN =0x02,
165 INFO_PI_CALLER_NOT_ISDN =0x03,
166 INFO_PI_CALLER_RETURNED_TO_ISDN =0x04,
167 INFO_PI_INBAND_AVAILABLE =0x08,
168 INFO_PI_DELAY_AT_INTERF =0x0a,
169 INFO_PI_INTERWORKING_WITH_PUBLIC =0x10,
170 INFO_PI_INTERWORKING_NO_RELEASE =0x11,
171 INFO_PI_INTERWORKING_NO_RELEASE_PRE_ANSWER =0x12,
172 INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13
190 /** FACILITY STUFF **/
194 FACILITY_CALLDEFLECT=0x91,
195 FACILITY_CENTREX=0x88
199 char calldeflect_nr[15];
206 struct misdn_bchannel {
222 int need_release_complete;
231 int channel_preselected;
236 unsigned char * bframe;
245 int te_choose_channel;
255 /* may there be more infos ?*/
256 int sending_complete;
259 /* wether we should use jollys dsp or not */
262 /* wether we should use our jitter buf system or not */
265 enum mISDN_NUMBER_PLAN dnumplan;
266 enum mISDN_NUMBER_PLAN rnumplan;
267 enum mISDN_NUMBER_PLAN onumplan;
268 enum mISDN_NUMBER_PLAN cpnnumplan;
271 int progress_location;
272 int progress_indicator;
274 enum facility_type fac_type;
277 enum facility_type out_fac_type;
278 union facility out_fac;
282 /*** CRYPTING STUFF ***/
291 /*char ast_dtmf_buf[255];
292 char misdn_dtmf_buf[255]; */
294 /*** CRYPTING STUFF END***/
302 enum bchannel_state bc_state;
303 enum bchannel_state next_bc_state;
310 struct misdn_bchannel *holded_bc;
326 unsigned char display[84];
327 unsigned char msn[32];
328 unsigned char oad[32];
329 unsigned char rad[32];
330 unsigned char dad[32];
331 unsigned char cad[32];
332 unsigned char orig_dad[32];
333 unsigned char keypad[32];
335 unsigned char info_dad[64];
336 unsigned char infos_pending[64];
338 /* unsigned char info_keypad[32]; */
339 /* unsigned char clisub[24]; */
340 /* unsigned char cldsub[24]; */
341 /* unsigned char uu[256]; */
346 /* struct misdn_bchannel hold_bc; */
370 struct misdn_bchannel *next;
374 enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
375 void (*cb_log) (int level, int port, char *tmpl, ...);
376 int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
378 struct misdn_lib_iface {
379 enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
380 void (*cb_log)(int level, int port, char *tmpl, ...);
381 int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
384 /***** USER IFACE **********/
386 void misdn_lib_nt_debug_init( int flags, char *file );
388 int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data);
389 int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event );
390 void misdn_lib_destroy(void);
392 void misdn_lib_isdn_l1watcher(int port);
394 void misdn_lib_log_ies(struct misdn_bchannel *bc);
396 char *manager_isdn_get_info(enum event_e event);
398 void misdn_lib_transfer(struct misdn_bchannel* holded_bc);
400 struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel);
402 void manager_bchannel_activate(struct misdn_bchannel *bc);
403 void manager_bchannel_deactivate(struct misdn_bchannel * bc);
405 int misdn_lib_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len);
407 void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2);
410 int misdn_lib_port_restart(int port);
411 int misdn_lib_get_port_info(int port);
413 int misdn_lib_port_block(int port);
414 int misdn_lib_port_unblock(int port);
416 int misdn_lib_port_up(int port, int notcheck);
418 int misdn_lib_get_port_down(int port);
420 int misdn_lib_get_port_up (int port) ;
422 int misdn_lib_maxports_get(void) ;
424 void misdn_lib_release(struct misdn_bchannel *bc);
426 int misdn_cap_is_speech(int cap);
427 int misdn_inband_avail(struct misdn_bchannel *bc);
429 int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, void *data);
432 void manager_ec_enable(struct misdn_bchannel *bc);
433 void manager_ec_disable(struct misdn_bchannel *bc);
435 void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone);
437 void get_show_stack_details(int port, char *buf);
440 void misdn_lib_tone_generator_start(struct misdn_bchannel *bc);
441 void misdn_lib_tone_generator_stop(struct misdn_bchannel *bc);
444 void misdn_lib_setup_bc(struct misdn_bchannel *bc);
446 void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
447 void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
449 void misdn_lib_echo(struct misdn_bchannel *bc, int onoff);
451 int misdn_lib_is_ptp(int port);
452 int misdn_lib_get_maxchans(int port);
454 void misdn_lib_reinit_nt_stack(int port);
456 #define PRI_TRANS_CAP_SPEECH 0x0
457 #define PRI_TRANS_CAP_DIGITAL 0x08
458 #define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
459 #define PRI_TRANS_CAP_3_1K_AUDIO 0x10
460 #define PRI_TRANS_CAP_7K_AUDIO 0x11
464 char *bc_state2str(enum bchannel_state state);
465 void bc_state_change(struct misdn_bchannel *bc, enum bchannel_state state);