From 3c6b98aa3dc1e2c146c030c4deefa9fac3ad1ceb Mon Sep 17 00:00:00 2001 From: nadi Date: Mon, 26 Mar 2007 15:25:53 +0000 Subject: * mISDN >= 1.2 provides a dsp pipeline for i.e. echo cancellation modules, make chan_misdn use it. * add a check for linux/mISDNdsp.h to configure.ac and update the autogenerated files: 'configure', 'autoconfig.h.in' (the 'configure' script was not in sync with the latest configure.ac, so the diff is a bit bigger than expected). git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@59202 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/misdn/Makefile | 4 ++++ channels/misdn/chan_misdn_config.h | 5 ++--- channels/misdn/isdn_lib.c | 38 ++++++++++++++++++++++++-------------- channels/misdn/isdn_lib.h | 6 ++++-- 4 files changed, 34 insertions(+), 19 deletions(-) (limited to 'channels/misdn') diff --git a/channels/misdn/Makefile b/channels/misdn/Makefile index 895dc9dee..85478225b 100644 --- a/channels/misdn/Makefile +++ b/channels/misdn/Makefile @@ -1,6 +1,10 @@ # # Makefile for chan_misdn support # +ifneq ($(wildcard /usr/include/linux/mISDNdsp.h),) +CFLAGS+=-DMISDN_1_2 +endif + all: %.o: %.c diff --git a/channels/misdn/chan_misdn_config.h b/channels/misdn/chan_misdn_config.h index 3012e8622..fc714853a 100644 --- a/channels/misdn/chan_misdn_config.h +++ b/channels/misdn/chan_misdn_config.h @@ -52,9 +52,8 @@ enum misdn_cfg_elements { MISDN_CFG_EARLY_BCONNECT, /* int (bool) */ MISDN_CFG_INCOMING_EARLY_AUDIO, /* int (bool) */ MISDN_CFG_ECHOCANCEL, /* int */ - MISDN_CFG_ECHOCANCELWHENBRIDGED, /* int (bool) */ -#ifdef WITH_ECHOTRAINGING - MISDN_CFG_ECHOTRAINING, /* int (bool) */ +#ifdef MISDN_1_2 + MISDN_CFG_PIPELINE, /* char[] */ #endif #ifdef WITH_BEROEC diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c index 3f33176a3..607492bb1 100644 --- a/channels/misdn/isdn_lib.c +++ b/channels/misdn/isdn_lib.c @@ -590,14 +590,13 @@ static void empty_bc(struct misdn_bchannel *bc) bc->early_bconnect = 1; +#ifdef MISDN_1_2 + *bc->pipeline = 0; +#else bc->ec_enable = 0; bc->ec_deftaps = 128; - bc->ec_whenbridged = 0; - -#ifdef EC_TRAIN - bc->ec_training = 1; #endif - + bc->orig=0; bc->cause=16; @@ -4101,7 +4100,11 @@ void isdn_lib_update_txgain (struct misdn_bchannel *bc) void isdn_lib_update_ec (struct misdn_bchannel *bc) { +#ifdef MISDN_1_2 + if (*bc->pipeline) +#else if (bc->ec_enable) +#endif manager_ec_enable(bc); else manager_ec_disable(bc); @@ -4280,19 +4283,24 @@ void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone) void manager_ec_enable(struct misdn_bchannel *bc) { - int ec_arr[2]; - struct misdn_stack *stack=get_stack_by_bc(bc); cb_log(4, stack?stack->port:0,"ec_enable\n"); if (!misdn_cap_is_speech(bc->capability)) { cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n"); - return; - } + } else { + +#ifdef MISDN_1_2 + if (*bc->pipeline) { + cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline); + manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1); + } +#else + int ec_arr[2]; if (bc->ec_enable) { - cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training); + cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps); switch (bc->ec_deftaps) { case 4: @@ -4312,14 +4320,12 @@ void manager_ec_enable(struct misdn_bchannel *bc) } ec_arr[0]=bc->ec_deftaps; -#ifdef EC_TRAIN - ec_arr[1]=bc->ec_training; -#else ec_arr[1]=0; -#endif manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr)); } +#endif + } } @@ -4335,10 +4341,14 @@ void manager_ec_disable(struct misdn_bchannel *bc) return; } +#ifdef MISDN_1_2 + manager_ph_control_block(bc, PIPELINE_CFG, "", 0); +#else if ( ! bc->ec_enable) { cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n"); manager_ph_control(bc, ECHOCAN_OFF, 0); } +#endif } struct misdn_stack* get_misdn_stack() { diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h index 5100ff38c..16f24b5f9 100644 --- a/channels/misdn/isdn_lib.h +++ b/channels/misdn/isdn_lib.h @@ -346,10 +346,12 @@ struct misdn_bchannel { /** list stuf **/ +#ifdef MISDN_1_2 + char pipeline[128]; +#else int ec_enable; int ec_deftaps; - int ec_whenbridged; - int ec_training; +#endif #ifdef WITH_BEROEC beroec_t *ec; -- cgit v1.2.3