[svn-commits] crichter: branch crichter/0.3.0 r39293 - in
/team/crichter/0.3.0: ./ channels...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Aug 8 01:24:10 MST 2006
Author: crichter
Date: Tue Aug 8 03:24:09 2006
New Revision: 39293
URL: http://svn.digium.com/view/asterisk?rev=39293&view=rev
Log:
* added possibility to change echocancel settings during calls
* removed the holded element from the chan_list struct, we know this from the
state already
* added a few tweaks to make HOLD/RETRIEVE work again (TRANSFER does not work
yet)
* added possibility to debug mISDN frames via syslog
* added misdn_lib_port_is_blocked function to check if a port is blocked
* removed ec_training=1 from empty_bc, we don't use ec_training anymore
* removed unused misdn_lib_get_l2_status function
* added the nt bit to dummy misdn_bchannel objects
* setting bc->out_fac_type to FACILITY_NONE defaultly
* removed HANDLER_DEBUG stuff for better readability
Modified:
team/crichter/0.3.0/Makefile
team/crichter/0.3.0/channels/chan_misdn.c
team/crichter/0.3.0/channels/misdn/fac.c
team/crichter/0.3.0/channels/misdn/isdn_lib.c
team/crichter/0.3.0/channels/misdn/isdn_lib.h
team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c
Modified: team/crichter/0.3.0/Makefile
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/Makefile?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/Makefile (original)
+++ team/crichter/0.3.0/Makefile Tue Aug 8 03:24:09 2006
@@ -924,7 +924,7 @@
make -C channels/misdn clean
cm-cleaner: cm-clean
- rm -f channels/chan_misdn_config.o
+ rm -f channels/misdn_config.o
rm -f channels/chan_misdn.o
rm -f channels/chan_misdn.so
Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Tue Aug 8 03:24:09 2006
@@ -140,11 +140,12 @@
int need_hangup;
int need_busy;
- int holded;
int orginator;
int norxtone;
int notxtone;
+
+ int toggle_ec;
int incoming_early_audio;
@@ -313,6 +314,8 @@
static int misdn_facility_exec(struct ast_channel *chan, void *data);
int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
+
+static int update_ec_config(struct misdn_bchannel *bc);
/*************** Helpers *****************/
@@ -742,6 +745,13 @@
" --> state: %s\n"
" --> capability: %s\n"
" --> echo_cancel: %d\n"
+#ifdef WITH_BEROEC
+ " --> bnec_tail: %d\n"
+ " --> bnec_nlp: %d\n"
+ " --> bnec_ah: %d\n"
+ " --> bnec_td: %d\n"
+ " --> bnec_zerocoeff: %d\n"
+#endif
" --> notone : rx %d tx:%d\n"
" --> bc_hold: %d holded_bc :%d\n",
help->ast->name,
@@ -755,6 +765,14 @@
bc_state2str(bc->bc_state),
bearer2str(bc->capability),
bc->ec_enable,
+
+#ifdef WITH_BEROEC
+ bc->bnec_tail,
+ bc->bnec_nlp,
+ bc->bnec_ah,
+ bc->bnec_td,
+ bc->bnec_zero,
+#endif
help->norxtone,help->notxtone,
bc->holded, help->holded_bc?1:0
);
@@ -944,9 +962,11 @@
ast_cli(fd, "Toggling EchoCancel %s failed Channel does not exist\n", channame);
return 0;
} else {
- tmp->bc->ec_enable=tmp->bc->ec_enable?0:1;
-
- if (tmp->bc->ec_enable) {
+
+ tmp->toggle_ec=tmp->toggle_ec?0:1;
+
+ if (tmp->toggle_ec) {
+ update_ec_config(tmp->bc);
manager_ec_enable(tmp->bc);
} else {
manager_ec_disable(tmp->bc);
@@ -1334,6 +1354,44 @@
+static int update_ec_config(struct misdn_bchannel *bc)
+{
+ int ec;
+ int port=bc->port;
+
+ misdn_cfg_get( port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
+
+ if (ec == 1 ) {
+ bc->ec_enable=1;
+ } else if ( ec > 1 ) {
+ bc->ec_enable=1;
+ 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
+
+#ifdef WITH_BEROEC
+ misdn_cfg_get(port, MISDN_CFG_BNECHOCANCEL,&bc->bnec_tail, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_BNEC_ANTIHOWL, &bc->bnec_ah, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_BNEC_NLP, &bc->bnec_nlp, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_BNEC_TD, &bc->bnec_td, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_BNEC_ADAPT, &bc->bnec_adapt, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_BNEC_ZEROCOEFF, &bc->bnec_zero, sizeof(int));
+
+ if (bc->bnec_tail && bc->ec_enable) {
+ ast_log(LOG_WARNING,"Are you sure you wan't to mix BNEC with Zapec ? This might cause bad audio quality!\n");
+ bc->ec_enable=0;
+ }
+#endif
+ return 0;
+}
+
static int read_config(struct chan_list *ch, int orig) {
@@ -1401,41 +1459,9 @@
misdn_cfg_get( bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
ast_copy_string (ast->context,ch->context,sizeof(ast->context));
- {
- int ec;
-
- misdn_cfg_get( port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
-
- if (ec == 1 ) {
- bc->ec_enable=1;
- } else if ( ec > 1 ) {
- bc->ec_enable=1;
- 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
-
-#ifdef WITH_BEROEC
- misdn_cfg_get(port, MISDN_CFG_BNECHOCANCEL,&bc->bnec_tail, sizeof(int));
- misdn_cfg_get(port, MISDN_CFG_BNEC_ANTIHOWL, &bc->bnec_ah, sizeof(int));
- misdn_cfg_get(port, MISDN_CFG_BNEC_NLP, &bc->bnec_nlp, sizeof(int));
- misdn_cfg_get(port, MISDN_CFG_BNEC_TD, &bc->bnec_td, sizeof(int));
- misdn_cfg_get(port, MISDN_CFG_BNEC_ADAPT, &bc->bnec_adapt, sizeof(int));
- misdn_cfg_get(port, MISDN_CFG_BNEC_ZEROCOEFF, &bc->bnec_zero, sizeof(int));
-
- if (bc->bnec_tail && bc->ec_enable) {
- ast_log(LOG_WARNING,"Are you sure you wan't to mix BNEC with Zapec ? This might cause bad audio quality!\n");
- bc->ec_enable=0;
- }
-#endif
- }
-
+
+ update_ec_config(bc);
+
{
int eb3;
@@ -1812,7 +1838,7 @@
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) )) return -1;
- chan_misdn_log(1, p->bc?p->bc->port:0, "* IND: Got Fixup State:%s Holded:%d L3id:%x\n", misdn_get_ch_state(p), p->holded, p->l3id);
+ chan_misdn_log(1, p->bc?p->bc->port:0, "* IND: Got Fixup State:%s L3id:%x\n", misdn_get_ch_state(p), p->l3id);
p->ast = ast ;
p->state=MISDN_CONNECTED;
@@ -2163,8 +2189,8 @@
return -1;
}
- if (ch->holded ) {
- chan_misdn_log(5, ch->bc->port, "misdn_write: Returning because holded\n");
+ if (ch->state == MISDN_HOLDED) {
+ chan_misdn_log(8, ch->bc->port, "misdn_write: Returning because holded\n");
return 0;
}
@@ -2994,7 +3020,6 @@
ast_moh_stop(AST_BRIDGED_P(holded_chan->ast));
holded_chan->state=MISDN_CONNECTED;
- holded_chan->holded=0;
misdn_lib_transfer(holded_chan->bc?holded_chan->bc:holded_chan->holded_bc);
ast_channel_masquerade(holded_chan->ast, AST_BRIDGED_P(tmp_ch->ast));
}
@@ -3170,6 +3195,8 @@
case EVENT_SETUP:
case EVENT_DISCONNECT:
case EVENT_PORT_ALARM:
+ case EVENT_RETRIEVE:
+ case EVENT_NEW_BC:
break;
case EVENT_RELEASE_COMPLETE:
chan_misdn_log(1, bc->port, " --> no Ch, so we've already released.\n");
@@ -3229,6 +3256,15 @@
break;
case EVENT_NEW_BC:
+ if (!ch) {
+ ch=find_holded(cl_te,bc);
+ }
+
+ if (!ch) {
+ ast_log(LOG_WARNING,"NEW_BC without chan_list?\n");
+ break;
+ }
+
if (bc)
ch->bc=(struct misdn_bchannel*)user_data;
break;
@@ -3720,7 +3756,8 @@
if (ch->state == MISDN_CONNECTED ) {
misdn_transfer_bc(ch, holded_ch) ;
}
- misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+ hangup_chan(ch);
+ release_chan(bc);
break;
}
@@ -3906,6 +3943,12 @@
/***************************/
case EVENT_RETRIEVE:
{
+ ch=find_holded(cl_te, bc);
+ if (!ch) {
+ ast_log(LOG_WARNING, "Found no Holded channel, cannot Retrieve\n");
+ misdn_lib_send_event(bc, EVENT_RETRIEVE_REJECT);
+ break;
+ }
struct ast_channel *hold_ast=AST_BRIDGED_P(ch->ast);
ch->state = MISDN_CONNECTED;
Modified: team/crichter/0.3.0/channels/misdn/fac.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/fac.c?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/fac.c (original)
+++ team/crichter/0.3.0/channels/misdn/fac.c Tue Aug 8 03:24:09 2006
@@ -264,8 +264,8 @@
{
int i, fac_len=0;
unsigned char facility[256];
-
- if (! (bc->nt) )
+
+ if (!bc->nt)
{
p = NULL;
if (qi->QI_ELEMENT(facility))
@@ -274,9 +274,9 @@
if (!p)
return;
- fac_len = p[0];
+ fac_len = p[0] & 0xff;
+
memcpy(facility, p+1, fac_len);
-
switch(facility[0]) {
case FACILITY_CENTREX:
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Tue Aug 8 03:24:09 2006
@@ -11,6 +11,8 @@
* the GNU General Public License
*/
+
+#include <syslog.h>
#include "isdn_lib_intern.h"
#include <mISDNuser/isdn_debug.h>
@@ -52,6 +54,17 @@
}
return -1;
+}
+
+int misdn_lib_is_port_blocked(int port)
+{
+ struct misdn_stack *stack=get_misdn_stack();
+ for ( ; stack; stack=stack->next) {
+ if (stack->port == port) {
+ return stack->blocked;
+ }
+ }
+ return -1;
}
int misdn_lib_is_ptp(int port)
@@ -355,14 +368,12 @@
}
frm->addr = (stack->upper_id | FLG_MSG_DOWN);
-
-
frm->dinfo = bc->l3_id;
-
frm->len = (dmsg->len) - mISDN_HEADER_LEN;
-
+
+ cb_log(4,stack->port,"Sending msg, prim:%x addr:%x dinfo:%x\n",frm->prim,frm->addr,frm->dinfo);
+
mISDN_write(midev, dmsg->data, dmsg->len, TIMEOUT_1SEC);
-
free_msg(dmsg);
return 0;
@@ -514,8 +525,10 @@
{
bc->bframe_len=0;
+
+ bc->in_use= 0;
+
bc->channel = 0;
- bc->in_use = 0;
bc->sending_complete = 0;
@@ -555,8 +568,10 @@
bc->ec_enable = 0;
bc->ec_deftaps = 128;
bc->ec_whenbridged = 0;
+
+#ifdef EC_TRAIN
bc->ec_training = 1;
-
+#endif
bc->orig=0;
@@ -591,6 +606,7 @@
bc->orig_dad[0] = 0;
bc->fac_type=FACILITY_NONE;
+ bc->out_fac_type=FACILITY_NONE;
bc->te_choose_channel = 0;
@@ -624,22 +640,15 @@
manager_bchannel_deactivate(bc);
-#ifdef WITH_BEROEC
- if (bc->ec)
- beroec_destroy(bc->ec);
- bc->ec=NULL;
-#endif
-
- if ( misdn_cap_is_speech(bc->capability) && bc->ec_enable) {
- manager_ec_disable(bc);
- }
+
+ manager_ec_disable(bc);
+
mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
/*mISDN_clear_stack(stack->midev, bc->b_stid);*/
-
bc->b_stid = 0;
bc_state_change(bc, BCHAN_CLEANED);
@@ -786,18 +795,6 @@
return 0;
}
-int misdn_lib_get_l2_status(struct misdn_stack *stack)
-{
- iframe_t act;
-
- act.prim = DL_ESTABLISH | REQUEST;
-
- act.addr = (stack->upper_id | FLG_MSG_DOWN) ;
-
- act.dinfo = 0;
- act.len = 0;
- return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
-}
int misdn_lib_get_short_status(struct misdn_stack *stack)
{
@@ -1029,7 +1026,6 @@
bc_state_change(bc,BCHAN_ERROR);
return(-EINVAL);
}
-
ret = mISDN_get_setstack_ind(midev, bc->layer_id);
@@ -1287,17 +1283,17 @@
Isdnl3Init(&stack->nst);
}
-
-
- if ( stack->nt && stack->ptp) {
- }
-
+ stack->l1link=0;
+ stack->l2link=0;
+#if 0
if (!stack->nt) {
- /*assume L1 is up, we'll get DEACTIVATES soon, for non
- * up L1s*/
- stack->l1link=0;
- }
-
+ misdn_lib_get_short_status(stack);
+ } else {
+ misdn_lib_get_l1_up(stack);
+ if (!stack->ptp) misdn_lib_get_l1_up(stack);
+ misdn_lib_get_l2_up(stack);
+ }
+#endif
misdn_lib_get_short_status(stack);
misdn_lib_get_l1_up(stack);
misdn_lib_get_l2_up(stack);
@@ -1558,6 +1554,7 @@
memset (&dummybc,0,sizeof(dummybc));
dummybc.port=stack->port;
dummybc.l3_id=frm->dinfo;
+ dummybc.nt=stack->nt;
bc=&dummybc;
}
@@ -1756,9 +1753,13 @@
struct misdn_bchannel *hold_bc=stack_holder_find(stack,bc->l3_id);
if (hold_bc) {
- cb_event(EVENT_NEW_BC, hold_bc, bc);
+
cb_log(4, stack->port, "REMOVEING Holder\n");
stack_holder_remove(stack, hold_bc);
+
+ memcpy(bc,hold_bc,sizeof(struct misdn_bchannel));
+ cb_event(EVENT_NEW_BC, hold_bc, bc);
+
free(hold_bc);
}
@@ -1911,6 +1912,7 @@
memset (&dummybc,0,sizeof(dummybc));
dummybc.port=stack->port;
dummybc.l3_id=hh->dinfo;
+ dummybc.nt=stack->nt;
bc=&dummybc;
}
@@ -2013,6 +2015,7 @@
memset (&dummybc,0,sizeof(dummybc));
dummybc.port=stack->port;
dummybc.l3_id=hh->dinfo;
+ dummybc.nt=stack->nt;
bc=&dummybc;
}
if (bc ) {
@@ -2541,13 +2544,11 @@
struct misdn_stack *stack=find_stack_by_addr(frm->addr);
-
- cb_log(4,stack?stack->port:0,"handle_frm: frm->addr:%x frm->prim:%x\n",frm->addr,frm->prim);
-
-
if (!stack || stack->nt) {
return 0;
}
+
+ cb_log(4,stack?stack->port:0,"handle_frm: frm->addr:%x frm->prim:%x\n",frm->addr,frm->prim);
{
struct misdn_bchannel *bc;
@@ -2635,7 +2636,7 @@
int i ;
if (!stack) return 0 ;
-
+
switch (frm->prim) {
case PH_ACTIVATE | CONFIRM:
case PH_ACTIVATE | INDICATION:
@@ -2776,8 +2777,6 @@
case SSTATUS_L1_ACTIVATED:
cb_log(3, stack->port, "MGMT: SSTATUS: L1_ACTIVATED \n");
stack->l1link=1;
- if (stack->nt && stack->ptp)
- misdn_lib_get_l2_up(stack);
break;
case SSTATUS_L1_DEACTIVATED:
@@ -3114,7 +3113,7 @@
cb_log(4, stack->port, " --> screen:%d --> pres:%d\n",
bc->screen, bc->pres);
- cb_log(4, stack->port, " --> addr:%x l3id:%x b_stid:%x layer_id:%x\n", bc->pid, bc->addr, bc->l3_id, bc->b_stid, bc->layer_id);
+ cb_log(4, stack->port, " --> addr:%x l3id:%x b_stid:%x layer_id:%x\n", bc->addr, bc->l3_id, bc->b_stid, bc->layer_id);
cb_log(4, stack->port, " --> facility:%s out_facility:%s\n",fac2str(bc->fac_type),fac2str(bc->out_fac_type));
@@ -3178,6 +3177,9 @@
case EVENT_CONNECT:
case EVENT_RETRIEVE_ACKNOWLEDGE:
+
+ bc->holded=0;
+
if (stack->nt) {
if (bc->channel <=0 ) { /* else we have the channel already */
bc->channel = find_free_chan_in_stack(stack, 0);
@@ -3190,48 +3192,36 @@
}
/* Its that i generate channels */
}
-
+
ret=setup_bc(bc);
if (ret == -EINVAL) {
cb_log(0,bc->port,"send_event: setup_bc failed\n");
}
-
- if ( (event == EVENT_CONNECT ) && misdn_cap_is_speech(bc->capability) ) {
- if ( *bc->crypt_key ) {
- cb_log(4, stack->port, " --> ENABLING BLOWFISH channel:%d oad%d:%s dad%d:%s \n", bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
+
+ cb_log(0,bc->port,"After SETUP BC\n");
+
+
+ if (misdn_cap_is_speech(bc->capability)) {
+ if ((event==EVENT_CONNECT)||(event==EVENT_RETRIEVE_ACKNOWLEDGE)) {
+ if ( *bc->crypt_key ) {
+ cb_log(4, stack->port, " --> ENABLING BLOWFISH channel:%d oad%d:%s dad%d:%s \n", bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
+
+ manager_ph_control_block(bc, BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) );
+ }
- manager_ph_control_block(bc, BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) );
- }
-
- if (!bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0);
-
- if (bc->ec_enable) manager_ec_enable(bc);
-
-#ifdef WITH_BEROEC
- if (!bec_initialized) bc->bnec_tail=0;
-
- if (bc->bnec_tail) {
- bc->ec=beroec_new(bc->bnec_tail, BEROEC_SUBBAND, bc->bnec_ah,
- bc->bnec_td, bc->bnec_zero, bc->bnec_adapt, bc->bnec_nlp);
- }
-#endif
-
-
-
- if (bc->txgain != 0) {
- cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain);
- manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain);
- }
-
- if ( bc->rxgain != 0 ) {
- cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain);
- manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain);
- }
-
- }
-
- if (event == EVENT_RETRIEVE_ACKNOWLEDGE) {
- cb_log(0,bc->port,"DO WE NEED TO DO SOMETHING HERE WITH THE BC ?\n");
+ if (!bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0);
+ manager_ec_enable(bc);
+
+ if (bc->txgain != 0) {
+ cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain);
+ manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain);
+ }
+
+ if ( bc->rxgain != 0 ) {
+ cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain);
+ manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain);
+ }
+ }
}
break;
@@ -3303,16 +3293,7 @@
if (misdn_cap_is_speech(bc->capability)) {
if ( !bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0);
- if (bc->ec_enable) manager_ec_enable(bc);
-#ifdef WITH_BEROEC
- if (!bec_initialized) bc->bnec_tail=0;
-
- if (bc->bnec_tail) {
- bc->ec=beroec_new(bc->bnec_tail, BEROEC_SUBBAND, bc->bnec_ah,
- bc->bnec_td, bc->bnec_zero, bc->bnec_adapt, bc->bnec_nlp);
- }
-#endif
-
+ manager_ec_enable(bc);
if ( bc->txgain != 0 ) {
cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain);
@@ -3448,22 +3429,18 @@
}
if ( ((frm->addr | ISDN_PID_BCHANNEL_BIT )>> 28 ) == 0x5) {
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_bchan START\n");
+ if (handle_bchan(msg)) {
+ return 0 ;
+ }
+ }
+
+#ifdef RECV_FRM_SYSLOG_DEBUG
+ syslog(LOG_NOTICE,"mISDN recv: P(%02d): ADDR:%x PRIM:%x DINFO:%x\n",stack->port, frm->addr, frm->prim, frm->dinfo);
#endif
- if (handle_bchan(msg)) {
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_bchan STOP\n");
-#endif
- return 0 ;
- }
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_bchan NOTSTOP\n");
-#endif
- }
-
+
if (handle_timers(msg))
return 0 ;
+
if (handle_mgmt(msg))
return 0 ;
@@ -3475,45 +3452,18 @@
if (handle_l1(msg))
return 0 ;
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_frm_nt START\n");
-#endif
if (handle_frm_nt(msg)) {
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_frm_nt STOP\n");
-#endif
return 0;
}
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_frm_nt NOTSTOP\n");
-
- cb_log(0,0,"handle_frm START\n");
-#endif
-
+
if (handle_frm(msg)) {
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_frm STOP\n");
-#endif
-
return 0;
}
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_frm NOTSTOP\n");
-
- cb_log(0,0,"handle_err START\n");
-#endif
-
+
if (handle_err(msg)) {
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_err STOP\n");
-#endif
return 0 ;
}
-#ifdef MISDN_HANDLER_DEBUG
- cb_log(0,0,"handle_err NOTSTOP\n");
-#endif
-
-
+
cb_log(0, 0, "Unhandled Message: prim %x len %d from addr %x, dinfo %x on this port.\n",frm->prim, frm->len, frm->addr, frm->dinfo);
free_msg(msg);
@@ -3697,7 +3647,6 @@
} else {
iframe_t *frm = (iframe_t *)msg->data;
struct misdn_bchannel *bc = find_bc_by_l3id(stack, frm->dinfo);
- cb_log(4,stack->port,"Sending msg, prim:%x addr:%x dinfo:%x\n",frm->prim,frm->addr,frm->dinfo);
if (bc) send_msg(glob_mgr->midev, bc, msg);
}
}
@@ -4119,6 +4068,8 @@
if (!holder->stack_holder) return;
+ holder->stack_holder=0;
+
cb_log(4,stack->port, "*HOLDER: remove %x\n",holder->l3_id);
if (!stack || ! stack->holding) return;
@@ -4201,29 +4152,58 @@
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
-
- switch (bc->ec_deftaps) {
- case 4:
- case 8:
- case 16:
- case 32:
- case 64:
- case 128:
- case 256:
- case 512:
- case 1024:
- cb_log(4, stack->port, "Taps is %d\n",bc->ec_deftaps);
- break;
- default:
- cb_log(0, stack->port, "Taps should be power of 2\n");
- bc->ec_deftaps=128;
- }
-
- ec_arr[0]=bc->ec_deftaps;
- ec_arr[1]=bc->ec_training;
-
- manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr));
+ cb_log(1, 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;
+ }
+
+#ifdef WITH_BEROEC
+ if (bc->ec) {
+ cb_log(1, stack?stack->port:0, " --> EC already loaded\n");
+ return;
+ }
+
+ if (!bec_initialized) bc->bnec_tail=0;
+
+ if (bc->bnec_tail) {
+ bc->ec=beroec_new(bc->bnec_tail, BEROEC_SUBBAND,
+ bc->bnec_ah,
+ bc->bnec_td, bc->bnec_zero, bc->bnec_adapt, bc->bnec_nlp);
+ }
+ return ;
+#endif
+
+ if (bc->ec_enable) {
+ cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
+
+ switch (bc->ec_deftaps) {
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+ case 128:
+ case 256:
+ case 512:
+ case 1024:
+ cb_log(4, stack->port, "Taps is %d\n",bc->ec_deftaps);
+ break;
+ default:
+ cb_log(0, stack->port, "Taps should be power of 2\n");
+ bc->ec_deftaps=128;
+ }
+
+ 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));
+ }
}
@@ -4232,8 +4212,24 @@
{
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
- manager_ph_control(bc, ECHOCAN_OFF, 0);
+ cb_log(1, stack?stack->port:0,"ec_disable\n");
+
+ if (!misdn_cap_is_speech(bc->capability)) {
+ cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n");
+ return;
+ }
+
+#ifdef WITH_BEROEC
+ if (bc->ec)
+ beroec_destroy(bc->ec);
+ bc->ec=NULL;
+ return;
+#endif
+
+ if ( bc->ec_enable) {
+ cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
+ manager_ph_control(bc, ECHOCAN_OFF, 0);
+ }
}
struct misdn_stack* get_misdn_stack() {
@@ -4358,7 +4354,11 @@
Isdnl2Init(&stack->nst);
Isdnl3Init(&stack->nst);
- }
-}
-
-
+
+ if (!stack->ptp)
+ misdn_lib_get_l1_up(stack);
+ misdn_lib_get_l2_up(stack);
+ }
+}
+
+
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Tue Aug 8 03:24:09 2006
@@ -408,6 +408,7 @@
int misdn_lib_port_restart(int port);
int misdn_lib_get_port_info(int port);
+int misdn_lib_is_port_blocked(int port);
int misdn_lib_port_block(int port);
int misdn_lib_port_unblock(int port);
Modified: team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c?rev=39293&r1=39292&r2=39293&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c Tue Aug 8 03:24:09 2006
@@ -876,7 +876,7 @@
void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
{
-
+//#define FACILITY_DECODE
#ifdef FACILITY_DECODE
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
FACILITY_t *facility=(FACILITY_t*)((unsigned long)(msg->data+HEADER_LEN));
More information about the svn-commits
mailing list