Help with configuring DAHDI echo canceller


I’m trying to set up a system based on Asterisk and DAHDI 2.2.0. Try as I might, I just can’t seem to find the right combination of echo canceller settings. I am using a TDM410 with a single FXO port.

I have a second Asterisk machine here which uses a TDM400 card and the old Zaptel drivers. Simply setting ‘echocancel=yes’ and ‘echotraining=yes’ in zapata.conf was sufficient to get no discernable echo on my BT line (in the UK).

Using exactly the same line and wiring, I should reasonably expect to be able to get the performance of my newer DAHDI based system to match, am I right? Problem is - it doesn’t. There is considerably more echo on the DAHDI system than on the Zaptel one.

I have run fxotune and it’s spat out “4=5,0,0,0,0,0,0,0,0”.

I have tried the MG2, KB1 and SEC2 echo cancellers. At the moment I’ve got the best results I can with the KB1 canceller and the following settings in chan_dahdi.conf:

echocancel=128 echocancelwhenbridged=yes echotraining=800 txgain=-3 rxgain=8

Does anyone know what the equivalent settings are in the various DAHDI options to cause the echo canceller to behave as the default on in the Zaptel drivers?

And has anyone had any eureka moments and can post a ‘magic’ set of settings that actually cancels the echo?

Would a hardware echo canceller be that much better? Seeing as I don’t have one on my Zaptel system I don’t really see why I should need to pay for one on the DAHDI system.

Any help appreciated. Giles.

Hi gilester,

I have configured the software echo cancellation on a TDM card connected to a UK BT line as follows;



loadzone = uk
defaultzone = uk




These settings have solved echo problems in three sites for me.



Thanks for the suggestions. I’ve set my system to the same settings as you and still have a fairly large echo.

I am at a loss to know what the difference might be, is it possible I have a faulty FXO module somehow?


I’ve got basically the same setup as you. Never could get good results with any of the available echo cancelers in DAHDI. The Oslec echo canceler was added to the Linux kernel’s driver staging area in 2.6.29 so I made the switch to that. Much happier now.

My gain settings are different to yours too;


Did you stop and restart asterisk and dahdi after making the changes?

I’ve tried a variety of gain settings, and just given your suggestion a try.

And yes, been restarting Asterisk between chan_dahdi.conf changes and the whole machine between dahdi system.conf changes.

No luck yet - still a large echo.

Here’s a sample of what my calls currently sound like (OGG format).


A further thought I’ve had, could this be a CPU issue? How much CPU time do the DAHDI echo canceller modules use?

I’m using a Soekris Net5501 which has a 433MHz CPU and 256MB RAM. Asterisk seems to run OK, but is there enough juice for the DAHDI driver?


Well, I think I’ve answered my own question there. Even during a call my CPU isn’t more than about 4% utilised, so it looks like there’s plenty of cycles left.

I’ve measured the echo time I am experiencing and it is 157ms. Seeing as this is longer than even the hardware echo canceller deals with (128ms), is this actually a different problem? Perhaps that’s why I’m not having much luck with the echo cancellers.

Has anyone seen this sort of level of echo before?

I have compiled the OSLEC echo canceller and the performance is certainly better than the standard cancellers. Still not entirely echo free however!

Is it possible to adjust any OSLEC parameters or does it ‘just work’? So far I’ve not been able to find much documentation on it.


Glad it’s working better for you. I don’t know about tweaking it, it just worked for me. There’s an OSLEC mailing list that might give you some info on how to make adjustments to it. You can view the archives here: … etel-oslec

Thanks for the link, I’ve been having a read around the subject and it seems it’s unlikely that OSLEC is really helping me that much, as I can’t see any mention of it working past 40ms.

Having tried to use my system to make a call just now, the level of echo is still not acceptable, actually it’s very hard to talk.

Seeing as OSLEC has been widely reported to work well, I really do wonder if I have a faulty FXO module that’s generating much more echo than it should.

I have a ticket open with Digium (who’ve yet to reply…) so we will see what happens. I may end up returning the TDM410 for a replacement.


You mentioned that you have a TDM400 card that is working well. Can you take the FXO module from the TDM400 and install it on the TDM410 to see if that’s really your problem? Are they compatible? The TDM410 is the only Digium card I’ve ever had but I was under the impression the FXO and FXS modules were the same. You might want to check on that.

I think the modules are the same, at least nothing I’ve found on Digium’s website suggests they differ between the TDM400 and TDM410 cards.

I’m a bit loathe to touch my working TDM400 system, but it would be the sensible thing to try… I’ll report back once I’ve done so.


I know, I hate touching a working system. Last week I built a mini-ITX system with a dual-core Intel Atom processor just to run my Asterisk stuff at home. Everything went well but when I got everything back up, caller ID was failing and I was getting odd messages about “polarity reversal” on the console. Turned out to be a problem with my phone jack but my first thought was “here we go again.”

I ended up sending a support request to Digium. They took a couple of days to reply but were quite thorough. They have given me a HPEC license to use.

Before I had a chance to configure HPEC, I had a mini epiphany… using OSLEC, I was getting awful results with echocancel=yes (i.e. 128, 16ms). The echo sounded like it wasn’t being cancelled at all. I had then tried echocancel=256 (32ms), which made the echo sound like it was all underwater. I had abandoned further attempts. UNTIL… It occurred to me that perhaps the watery sound was OSLEC half-cancelling the echo. None of the documentation I’ve found says you can set echocancel=512 (64ms) with OSLEC, but I did and presto, the echo is virtually gone! I occasionally hear a noise or two when OSLEC is training, but it quickly disappears.

So, finally, I’m happy with the result. If only I’d thought to try a longer tap length earlier in my investigations… but then that’s what investigations are for.


That’s good stuff to know. Glad its working for you. I also went through the process of getting an HPEC license but decided not to use it because of all the hassle involved in installing it. I’ll be sticking with OSLEC.