@ -351,7 +351,11 @@ int add_out_calls(int port);
int add_in_calls ( int port ) ;
int add_in_calls ( int port ) ;
# ifdef MISDN_1_2
static int update_pipeline_config ( struct misdn_bchannel * bc ) ;
# else
static int update_ec_config ( struct misdn_bchannel * bc ) ;
static int update_ec_config ( struct misdn_bchannel * bc ) ;
# endif
@ -1019,7 +1023,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
" --> activated: %d \n "
" --> activated: %d \n "
" --> state: %s \n "
" --> state: %s \n "
" --> capability: %s \n "
" --> capability: %s \n "
# ifdef MISDN_1_2
" --> pipeline: %s \n "
# else
" --> echo_cancel: %d \n "
" --> echo_cancel: %d \n "
# endif
" --> notone : rx %d tx:%d \n "
" --> notone : rx %d tx:%d \n "
" --> bc_hold: %d \n " ,
" --> bc_hold: %d \n " ,
help - > ast - > name ,
help - > ast - > name ,
@ -1032,7 +1040,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
bc - > active ,
bc - > active ,
bc_state2str ( bc - > bc_state ) ,
bc_state2str ( bc - > bc_state ) ,
bearer2str ( bc - > capability ) ,
bearer2str ( bc - > capability ) ,
# ifdef MISDN_1_2
bc - > pipeline ,
# else
bc - > ec_enable ,
bc - > ec_enable ,
# endif
help - > norxtone , help - > notxtone ,
help - > norxtone , help - > notxtone ,
bc - > holded
bc - > holded
@ -1260,7 +1272,11 @@ static int misdn_toggle_echocancel (int fd, int argc, char *argv[])
tmp - > toggle_ec = tmp - > toggle_ec ? 0 : 1 ;
tmp - > toggle_ec = tmp - > toggle_ec ? 0 : 1 ;
if ( tmp - > toggle_ec ) {
if ( tmp - > toggle_ec ) {
# ifdef MISDN_1_2
update_pipeline_config ( tmp - > bc ) ;
# else
update_ec_config ( tmp - > bc ) ;
update_ec_config ( tmp - > bc ) ;
# endif
manager_ec_enable ( tmp - > bc ) ;
manager_ec_enable ( tmp - > bc ) ;
} else {
} else {
manager_ec_disable ( tmp - > bc ) ;
manager_ec_disable ( tmp - > bc ) ;
@ -1598,6 +1614,25 @@ void debug_numplan(int port, int numplan, char *type)
# ifdef MISDN_1_2
static int update_pipeline_config ( struct misdn_bchannel * bc )
{
int ec ;
misdn_cfg_get ( bc - > port , MISDN_CFG_PIPELINE , bc - > pipeline , sizeof ( bc - > pipeline ) ) ;
if ( * bc - > pipeline )
return 0 ;
misdn_cfg_get ( bc - > port , MISDN_CFG_ECHOCANCEL , & ec , sizeof ( int ) ) ;
if ( ec = = 1 )
snprintf ( bc - > pipeline , sizeof ( bc - > pipeline ) - 1 , " mg2ec " ) ;
else if ( ec > 1 )
snprintf ( bc - > pipeline , sizeof ( bc - > pipeline ) - 1 , " mg2ec(deftaps=%d) " , ec ) ;
return 0 ;
}
# else
static int update_ec_config ( struct misdn_bchannel * bc )
static int update_ec_config ( struct misdn_bchannel * bc )
{
{
int ec ;
int ec ;
@ -1611,17 +1646,10 @@ static int update_ec_config(struct misdn_bchannel *bc)
bc - > ec_enable = 1 ;
bc - > ec_enable = 1 ;
bc - > ec_deftaps = ec ;
bc - > ec_deftaps = ec ;
}
}
# ifdef WITH_ECHOTRAINING
int ectr ;
misdn_cfg_get ( port , MISDN_CFG_ECHOTRAINING , & ectr , sizeof ( int ) ) ;
if ( ectr > = 0 ) {
bc - > ec_training = ectr ;
}
# endif
return 0 ;
return 0 ;
}
}
# endif
static int read_config ( struct chan_list * ch , int orig ) {
static int read_config ( struct chan_list * ch , int orig ) {
@ -1696,7 +1724,11 @@ static int read_config(struct chan_list *ch, int orig) {
ast_copy_string ( ast - > context , ch - > context , sizeof ( ast - > context ) ) ;
ast_copy_string ( ast - > context , ch - > context , sizeof ( ast - > context ) ) ;
# ifdef MISDN_1_2
update_pipeline_config ( bc ) ;
# else
update_ec_config ( bc ) ;
update_ec_config ( bc ) ;
# endif
{
{
int eb3 ;
int eb3 ;
@ -1966,9 +1998,15 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
int bridging ;
int bridging ;
misdn_cfg_get ( 0 , MISDN_GEN_BRIDGING , & bridging , sizeof ( int ) ) ;
misdn_cfg_get ( 0 , MISDN_GEN_BRIDGING , & bridging , sizeof ( int ) ) ;
if ( bridging & & ch - > other_ch ) {
if ( bridging & & ch - > other_ch ) {
# ifdef MISDN_1_2
chan_misdn_log ( 0 , port , " Disabling EC (aka Pipeline) on both Sides \n " ) ;
* ch - > bc - > pipeline = 0 ;
* ch - > other_ch - > bc - > pipeline = 0 ;
# else
chan_misdn_log ( 0 , port , " Disabling EC on both Sides \n " ) ;
chan_misdn_log ( 0 , port , " Disabling EC on both Sides \n " ) ;
ch - > bc - > ec_enable = 0 ;
ch - > bc - > ec_enable = 0 ;
ch - > other_ch - > bc - > ec_enable = 0 ;
ch - > other_ch - > bc - > ec_enable = 0 ;
# endif
}
}
r = misdn_lib_send_event ( newbc , EVENT_SETUP ) ;
r = misdn_lib_send_event ( newbc , EVENT_SETUP ) ;
@ -2466,7 +2504,11 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
isdn_lib_update_rxgain ( tmp - > bc ) ;
isdn_lib_update_rxgain ( tmp - > bc ) ;
tmp - > bc - > txgain = 0 ;
tmp - > bc - > txgain = 0 ;
isdn_lib_update_txgain ( tmp - > bc ) ;
isdn_lib_update_txgain ( tmp - > bc ) ;
# ifdef MISDN_1_2
* tmp - > bc - > pipeline = 0 ;
# else
tmp - > bc - > ec_enable = 0 ;
tmp - > bc - > ec_enable = 0 ;
# endif
isdn_lib_update_ec ( tmp - > bc ) ;
isdn_lib_update_ec ( tmp - > bc ) ;
isdn_lib_stop_dtmf ( tmp - > bc ) ;
isdn_lib_stop_dtmf ( tmp - > bc ) ;
switch ( tmp - > faxdetect ) {
switch ( tmp - > faxdetect ) {
@ -4922,16 +4964,22 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
case ' c ' :
case ' c ' :
keyidx = atoi ( + + tok ) ;
keyidx = atoi ( + + tok ) ;
if ( keyidx > misdn_key_vector_size | | keyidx < 0 ) {
char keys [ 4096 ] ;
ast_log ( LOG_WARNING , " You entered the keyidx: %d but we have only %d keys \n " , keyidx , misdn_key_vector_size ) ;
char * key = NULL , * tmp ;
continue ;
int i ;
misdn_cfg_get ( 0 , MISDN_GEN_CRYPT_KEYS , keys , sizeof ( keys ) ) ;
tmp = keys ;
for ( i = 0 ; i < keyidx ; i + + ) {
key = strsep ( & tmp , " , " ) ;
}
}
{
if ( key ) {
ast_copy_string ( ch - > bc - > crypt_key , misdn_key_vector [ keyidx ] , sizeof ( ch - > bc - > crypt_key ) ) ;
ast_copy_string ( ch - > bc - > crypt_key , key , sizeof ( ch - > bc - > crypt_key ) ) ;
}
}
chan_misdn_log ( 0 , ch - > bc - > port , " SETOPT: crypt with key:%s \n " , misdn_key_vector[ keyidx ] ) ;
chan_misdn_log ( 0 , ch - > bc - > port , " SETOPT: crypt with key:%s \n " , ch- > bc - > crypt_key ) ;
break ;
break ;
case ' e ' :
case ' e ' :
@ -4939,14 +4987,22 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
if ( neglect ) {
if ( neglect ) {
chan_misdn_log ( 1 , ch - > bc - > port , " --> disabled \n " ) ;
chan_misdn_log ( 1 , ch - > bc - > port , " --> disabled \n " ) ;
# ifdef MISDN_1_2
* ch - > bc - > pipeline = 0 ;
# else
ch - > bc - > ec_enable = 0 ;
ch - > bc - > ec_enable = 0 ;
# endif
} else {
} else {
# ifdef MISDN_1_2
update_pipeline_config ( ch - > bc ) ;
# else
ch - > bc - > ec_enable = 1 ;
ch - > bc - > ec_enable = 1 ;
ch - > bc - > orig = ch - > orginator ;
ch - > bc - > orig = ch - > orginator ;
tok + + ;
tok + + ;
if ( tok ) {
if ( * tok ) {
ch - > bc - > ec_deftaps = atoi ( tok ) ;
ch - > bc - > ec_deftaps = atoi ( tok ) ;
}
}
# endif
}
}
break ;
break ;