Train echo canceller on FXO before last digit

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2003-11-05 22:32:20 +00:00
parent 98166ff081
commit b5ec8ef1d9
1 changed files with 28 additions and 11 deletions

View File

@ -408,6 +408,8 @@ static struct zt_pvt {
int echotraining;
int echocanbridged;
int echocanon;
int echobreak;
char echorest[10];
int permcallwaiting;
int callwaitingcallerid;
int threewaycalling;
@ -1497,7 +1499,14 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
if (p->sig == SIG_FEATB) {
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%s#", c + p->stripmsd);
} else
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T%s", c + p->stripmsd);
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T%sw", c + p->stripmsd);
if (strlen(p->dop.dialstr) > 4) {
strcpy(p->echorest, "w");
strcpy(p->echorest + 1, p->dop.dialstr + strlen(p->dop.dialstr) - 2);
p->echobreak = 1;
p->dop.dialstr[strlen(p->dop.dialstr)-2] = '\0';
} else
p->echobreak = 0;
if (!res) {
if (ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop)) {
x = ZT_ONHOOK;
@ -2713,6 +2722,13 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
if (!x) { /* if not still dialing in driver */
zt_enable_ec(p);
zt_train_ec(p);
if (p->echobreak) {
strcpy(p->dop.dialstr, p->echorest);
p->dop.op = ZT_DIAL_OP_REPLACE;
res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
p->echobreak = 0;
} else {
p->dialing = 0;
if (ast->_state == AST_STATE_DIALING) {
if (p->callprogress && CANPROGRESSDETECT(p) && p->dsp && p->outgoing) {
@ -2726,6 +2742,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
}
}
}
break;
case ZT_EVENT_ALARM:
#ifdef ZAPATA_PRI