Hi all, I'm having a terrible time with a voicetronix Openswitch/8 board. I don't mind having to patch up the driver a bit, but I don't understand why there is such a *drastic* echo. For example, if I call my cell phone from a Cisco SIP phone, I heard my self on the cell phone and on the Cisco almost at the same time! What is supposed to handle the echo cancellation, the hardware or the software on the Openswitch? ...Jeff BTW, here is a diff against 0.7.2 that makes chan_vpb work. I took the values from Voicetronix's own OSS softswitch program. --- chan_vpb_cvs.c 2004-03-09 14:15:11.000000000 -0800 +++ chan_vpb.c 2004-03-06 01:09:17.000000000 -0800 @@ -96,10 +96,14 @@ #define MODE_IMMEDIATE 2 #define MODE_FXO 3 - -static VPB_TONE Dialtone = {440, 440, 440, 0, 0, 0, 5000, 0 }; -static VPB_TONE Busytone = {440, 0, 0, 0, -100, -100, 500, 500}; -static VPB_TONE Ringbacktone = {440, 0, 0, 0, -100, -100, 100, 100}; +/* +static VPB_TONE Dialtone = {440, 440, 440, -5, -5, -5, 5000, 0 }; +static VPB_TONE Busytone = {440, 0, 0, -5, -100, -100, 500, 500}; +static VPB_TONE Ringbacktone = {440, 0, 0, -5, -100, -100, 100, 100}; +*/ +static VPB_TONE Dialtone = {425, 0, 0, -16, -100, -100, 10000, 0}; +static VPB_TONE Busytone = {425, 0, 0, -10, -100, -100, 500, 500}; +static VPB_TONE Ringbacktone = {400, 425, 450, -20, -20, -20, 1000, 1000}; #define VPB_MAX_BRIDGES 128 @@ -280,17 +284,21 @@ break; case VPB_CALLEND: - if (e->data == VPB_CALL_CONNECTED) + if (e->data == VPB_CALL_CONNECTED || + e->data == VPB_CALL_NO_RING_BACK) f.subclass = AST_CONTROL_ANSWER; - else if (e->data == VPB_CALL_NO_DIAL_TONE || - e->data == VPB_CALL_NO_RING_BACK) + else if (e->data == VPB_CALL_NO_DIAL_TONE) f.subclass = AST_CONTROL_CONGESTION; else if (e->data == VPB_CALL_NO_ANSWER || e->data == VPB_CALL_BUSY) f.subclass = AST_CONTROL_BUSY; else if (e->data == VPB_CALL_DISCONNECTED) f.subclass = AST_CONTROL_HANGUP; - break; + + if (f.subclass != AST_CONTROL_ANSWER) + vpb_sethook_sync(p->handle, VPB_ONHOOK); + + break; case VPB_STATION_OFFHOOK: f.subclass = AST_CONTROL_ANSWER; @@ -459,8 +467,12 @@ ast_mutex_lock(&monlock), ast_mutex_lock(&iflock); { struct vpb_pvt *p = iflist; /* Find the pvt structure */ + int len; vpb_translate_event(&e, str); + len = strlen(str); + if (len > 0 && str[len-1] == '\n') + str[len-1] = '\0'; if (e.type == VPB_NULL_EVENT) goto done; /* Nothing to do, just a wakeup call.*/ @@ -546,7 +558,8 @@ { struct vpb_pvt *tmp; - + VPB_DETECT tone; + tmp = (struct vpb_pvt *)calloc(1, sizeof *tmp); if (!tmp) @@ -560,6 +573,13 @@ free(tmp); return NULL; } + + vpb_gettonedet(tmp->handle, VPB_DIAL, &tone); + tone.freq1 = 400; + tone.bandwidth1 = 140; + tone.glitch = 100; + tone.stran[1].tfire = 250; + vpb_settonedet(tmp->handle, &tone); if (echocancel) { if (option_verbose > 4) @@ -711,12 +731,16 @@ dest, ast->name); vpb_sethook_sync(p->handle,VPB_OFFHOOK); - - res = vpb_dial_async(p->handle, s); + + res = vpb_call_async(p->handle, s); if (res != VPB_OK) { ast_log(LOG_DEBUG, "Call on %s to %s failed: %s\n", - ast->name, dest, vpb_strerror(res)); + ast->name, dest, vpb_strerror(res)); + + vpb_sethook_sync(p->handle, VPB_ONHOOK); + ast_setstate(ast, AST_STATE_DOWN); + res = -1; } else res = 0; @@ -733,8 +757,6 @@ vpb_timer_start(p->timer); } p->calling = 1; - ast_setstate(ast, AST_STATE_RINGING); - ast_queue_control(ast,AST_CONTROL_RINGING, 0); } return res;