diff options
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r-- | xpp/xpp_zap.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c index 0512dcc..533a93f 100644 --- a/xpp/xpp_zap.c +++ b/xpp/xpp_zap.c @@ -66,6 +66,11 @@ static unsigned int xpp_last_jiffies = 0; DEF_PARM(int, print_dbg, 0, "Print DBG statements"); DEF_PARM(bool, zap_autoreg, 1, "Register spans automatically (1) or not (0)"); DEF_PARM(bool, prefmaster, 1, "Do we want to be zaptel preferred sync master"); +#ifdef XPP_EC_CHUNK +DEF_PARM_RO(bool, xpp_ec, 1, "Do we use our own (1) or Zaptel's (0) echo canceller"); +#else +static int xpp_ec = 0; +#endif // DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit"); #include "zap_debug.h" @@ -1042,11 +1047,13 @@ static void xpp_receiveprep(xpd_t *xpd) for (i = 0;i < xpd->span.channels; i++) { if(IS_SET(xpd->digital_signalling, i)) /* Don't echo cancel PRI/BRI D-chans */ continue; -#ifdef XPP_EC_CHUNK - xpp_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); -#else - zt_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); +#ifdef XPP_EC_CHUNK + /* even if defined, parameterr xpp_ec can override at run-time */ + if (xpp_ec) + xpp_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); + else #endif + zt_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); memcpy(xpd->ec_chunk2[i], xpd->ec_chunk1[i], ZT_CHUNKSIZE); memcpy(xpd->ec_chunk1[i], chans[i].writechunk, ZT_CHUNKSIZE); } @@ -1270,9 +1277,9 @@ int (*hooksig)(struct zt_chan *chan, zt_txsig_t hookstate); int (*sethook)(struct zt_chan *chan, int hookstate); #endif -#ifdef XPP_EC_CHUNK static int xpp_echocan(struct zt_chan *chan, int len) { +#ifdef XPP_EC_CHUNK if(len == 0) { /* shut down */ /* zaptel calls this also during channel initialization */ if(chan->ec) { @@ -1289,9 +1296,9 @@ static int xpp_echocan(struct zt_chan *chan, int len) ERR("%s: Failed creating xpp EC (len=%d)\n", __FUNCTION__, len); return -EINVAL; } +#endif return 0; } -#endif #ifdef CONFIG_ZAPTEL_WATCHDOG /* @@ -1389,9 +1396,8 @@ static int zaptel_register_xpd(xpd_t *xpd) span->hooksig = xpp_hooksig; /* Only with RBS bits */ span->ioctl = xpp_ioctl; span->maint = xpp_maint; -#ifdef XPP_EC_CHUNK - span->echocan = xpp_echocan; -#endif + if (xpp_ec) + span->echocan = xpp_echocan; #ifdef CONFIG_ZAPTEL_WATCHDOG span->watchdog = xpp_watchdog; #endif @@ -1449,11 +1455,10 @@ int __init xpp_zap_init(void) #else INFO("FEATURE: %s (without ECHO_SUPPRESSION)\n", THIS_MODULE->name); #endif -#ifdef XPP_EC_CHUNK - INFO("FEATURE: %s (with XPP_EC_CHUNK)\n", THIS_MODULE->name); -#else - INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name); -#endif + if (xpp_ec) + INFO("FEATURE: %s (with XPP_EC_CHUNK)\n", THIS_MODULE->name); + else + INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name); #ifdef CONFIG_ZAPATA_BRI_DCHANS INFO("FEATURE: %s (with BRISTUFF support)\n", THIS_MODULE->name); #else |