Add echocancelpath configuration option

This commit is contained in:
MelwareDE 2009-04-15 13:39:57 +00:00
parent 79ce55caf4
commit 39f0b5ea1c
4 changed files with 36 additions and 1 deletions

View File

@ -14,6 +14,7 @@ HEAD
- add extension for FAX paper formats and resolutions
- adjust NULL PLCI LI path
- add resource PLCI
- add echocancelpath configuration option
chan_capi-1.1.2

View File

@ -56,6 +56,8 @@ context=isdn-in ;context for incoming calls
;or your files may get choppy. (you can use capicommand(echosquelch|no) for this)
;echocancel=yes ;Dialogic(R) Diva(R) (CAPI) echo cancellation (yes=g165)
;(possible values: 'no', 'yes', 'force', 'g164', 'g165')
;echocancelpath=1;Dialogic(R) Diva(R) (CAPI) echo cancellation path
;(possible values: default '1' - E.1/T.1/S0, '2' - IP, '3' - both)
echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for older eicon drivers)
;echotail=64 ;echo cancel tail setting (default=0 for maximum)
;echocancelnlp=1 ;activate non-linear-processing; this improves echo cancel ratio, but might

View File

@ -556,6 +556,18 @@ static void capi_echo_canceller(struct capi_pvt *i, int function)
ecAvail = 1;
}
if ((i->channeltype == CAPI_CHANNELTYPE_NULL) &&
(i->line_plci == 0)) {
return;
}
if ((i->channeltype == CAPI_CHANNELTYPE_NULL) && (capi_controllers[i->controller]->ecPath & EC_ECHOCANCEL_PATH_IP) == 0) {
return;
}
if ((i->channeltype != CAPI_CHANNELTYPE_NULL) && (capi_controllers[i->controller]->ecPath & EC_ECHOCANCEL_PATH_IFC) == 0) {
return;
}
/* If echo cancellation is not requested or supported, don't attempt to enable it */
if (!ecAvail || !i->doEC) {
return;
@ -779,7 +791,7 @@ static int local_queue_frame(struct capi_pvt *i, struct ast_frame *f)
}
if (i->writerfd == -1) {
if (i->resource_plci_type == 0 || i->line_plci == 0 || i->data_plci == 0) {
if (i->resource_plci_type == 0 || (i->line_plci == 0 && i->data_plci == 0)) {
cc_log(LOG_ERROR, "No writerfd in local_queue_frame for %s\n",
i->vname);
return -1;
@ -6435,6 +6447,7 @@ int mkif(struct cc_capi_conf *conf)
}
capi_controllers[unit]->used = 1;
capi_controllers[unit]->ecPath = conf->echocancelpath;
tmp->controller = unit;
tmp->doEC = conf->echocancel;
@ -7115,6 +7128,8 @@ static int cc_init_capi(void)
cp->broadband = 1;
}
cp->ecPath = EC_ECHOCANCEL_PATH_IFC;
#if (CAPI_OS_HINT == 1)
if (profile.dwGlobalOptions & CAPI_PROFILE_ECHO_CANCELLATION) {
#else
@ -7361,6 +7376,13 @@ static int conf_interface(struct cc_capi_conf *conf, struct ast_variable *v)
continue;
} else
CONF_TRUE(conf->ecnlp, "echocancelnlp", 1)
if (!strcasecmp(v->name, "echocancelpath")) {
conf->echocancelpath = atoi(v->value);
conf->echocancelpath &= EC_ECHOCANCEL_PATH_BITS;
if (conf->echocancelpath == 0)
conf->echocancelpath = EC_ECHOCANCEL_PATH_BITS;
}
if (!strcasecmp(v->name, "echotail")) {
conf->ectail = atoi(v->value);
if (conf->ectail > 255) {
@ -7465,6 +7487,7 @@ static int capi_eval_config(struct ast_config *cfg)
conf.ecoption = EC_OPTION_DISABLE_G165;
conf.ectail = EC_DEFAULT_TAIL;
conf.ecSelector = FACILITYSELECTOR_ECHO_CANCEL;
conf.echocancelpath = EC_ECHOCANCEL_PATH_IFC;
cc_copy_string(conf.name, cat, sizeof(conf.name));
cc_copy_string(conf.language, default_language, sizeof(conf.language));
#ifdef CC_AST_HAS_VERSION_1_4

View File

@ -193,6 +193,13 @@ typedef struct fax3proto3 B3_PROTO_FAXG3;
#define EC_OPTION_DISABLE_G164_OR_G165 (1<<1 | 1<<2)
#define EC_DEFAULT_TAIL 0 /* maximum */
/*
EC path mask
*/
#define EC_ECHOCANCEL_PATH_IFC 1 /* Default, activate EC for E.1/T.1/S0 only */
#define EC_ECHOCANCEL_PATH_IP 2 /* Activate EC for IP */
#define EC_ECHOCANCEL_PATH_BITS (EC_ECHOCANCEL_PATH_IFC | EC_ECHOCANCEL_PATH_IP)
#define CC_HOLDTYPE_LOCAL 0
#define CC_HOLDTYPE_HOLD 1
#define CC_HOLDTYPE_NOTIFY 2
@ -557,6 +564,7 @@ struct cc_capi_conf {
struct ast_jb_conf jbconf;
char mohinterpret[MAX_MUSICCLASS];
#endif
int echocancelpath;
};
struct cc_capi_controller {
@ -590,6 +598,7 @@ struct cc_capi_controller {
int rtpcodec;
int divaExtendedFeaturesAvailable;
int ecPath;
};