mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Use echo training of FXS (fxo signalled) interfaces... rest to follow
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -172,6 +172,8 @@ static float txgain = 0.0;
|
|||||||
|
|
||||||
static int echocancel;
|
static int echocancel;
|
||||||
|
|
||||||
|
static int echotraining;
|
||||||
|
|
||||||
static int echocanbridged = 0;
|
static int echocanbridged = 0;
|
||||||
|
|
||||||
static int busydetect = 0;
|
static int busydetect = 0;
|
||||||
@@ -403,6 +405,7 @@ static struct zt_pvt {
|
|||||||
int callwaitcas;
|
int callwaitcas;
|
||||||
int callwaitrings;
|
int callwaitrings;
|
||||||
int echocancel;
|
int echocancel;
|
||||||
|
int echotraining;
|
||||||
int echocanbridged;
|
int echocanbridged;
|
||||||
int echocanon;
|
int echocanon;
|
||||||
int permcallwaiting;
|
int permcallwaiting;
|
||||||
@@ -1064,6 +1067,22 @@ static void zt_enable_ec(struct zt_pvt *p)
|
|||||||
ast_log(LOG_DEBUG, "No echocancellation requested\n");
|
ast_log(LOG_DEBUG, "No echocancellation requested\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void zt_train_ec(struct zt_pvt *p)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int res;
|
||||||
|
if (p && p->echocancel && p->echotraining) {
|
||||||
|
x = 400;
|
||||||
|
res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
|
||||||
|
if (res)
|
||||||
|
ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
|
||||||
|
else {
|
||||||
|
ast_log(LOG_DEBUG, "Engaged echo training on channel %d\n", p->channel);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
ast_log(LOG_DEBUG, "No echo training requested\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void zt_disable_ec(struct zt_pvt *p)
|
static void zt_disable_ec(struct zt_pvt *p)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
@@ -2814,6 +2833,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
|||||||
switch(ast->_state) {
|
switch(ast->_state) {
|
||||||
case AST_STATE_RINGING:
|
case AST_STATE_RINGING:
|
||||||
zt_enable_ec(p);
|
zt_enable_ec(p);
|
||||||
|
zt_train_ec(p);
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
||||||
/* Make sure it stops ringing */
|
/* Make sure it stops ringing */
|
||||||
@@ -5149,6 +5169,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio)
|
|||||||
tmp->permhidecallerid = hidecallerid;
|
tmp->permhidecallerid = hidecallerid;
|
||||||
tmp->callreturn = callreturn;
|
tmp->callreturn = callreturn;
|
||||||
tmp->echocancel = echocancel;
|
tmp->echocancel = echocancel;
|
||||||
|
tmp->echotraining = echotraining;
|
||||||
tmp->echocanbridged = echocanbridged;
|
tmp->echocanbridged = echocanbridged;
|
||||||
tmp->busydetect = busydetect;
|
tmp->busydetect = busydetect;
|
||||||
tmp->busycount = busycount;
|
tmp->busycount = busycount;
|
||||||
@@ -6773,6 +6794,8 @@ int load_module()
|
|||||||
if (echocancel)
|
if (echocancel)
|
||||||
echocancel=128;
|
echocancel=128;
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(v->name, "echotraining")) {
|
||||||
|
echotraining = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "hidecallerid")) {
|
} else if (!strcasecmp(v->name, "hidecallerid")) {
|
||||||
hidecallerid = ast_true(v->value);
|
hidecallerid = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "callreturn")) {
|
} else if (!strcasecmp(v->name, "callreturn")) {
|
||||||
|
@@ -145,6 +145,14 @@ echocancel=yes
|
|||||||
;
|
;
|
||||||
echocancelwhenbridged=yes
|
echocancelwhenbridged=yes
|
||||||
;
|
;
|
||||||
|
; In some cases, the echo canceller doesn't train quickly enough and there
|
||||||
|
; is echo at the beginning of the call. Enabling echo training will cause
|
||||||
|
; asterisk to briefly mute the channel, send an impulse, and use the impulse
|
||||||
|
; response to pre-train the echo canceller so it can start out with a much
|
||||||
|
; closer idea of the actual echo.
|
||||||
|
;
|
||||||
|
;echotraining=yes
|
||||||
|
;
|
||||||
; If you are having trouble with DTMF detection, you can relax the
|
; If you are having trouble with DTMF detection, you can relax the
|
||||||
; DTMF detection parameters. Relaxing them may make the DTMF detector
|
; DTMF detection parameters. Relaxing them may make the DTMF detector
|
||||||
; more likely to have "talkoff" where DTMF is detected when it
|
; more likely to have "talkoff" where DTMF is detected when it
|
||||||
|
Reference in New Issue
Block a user