Strange fxotune issue - echo becomes worse

I’ve search around quite a bit, and have yet to find anyone who mentioned getting results like this from fxotune. I’m running Trixbox 1.1.1 with Asterisk and Zaptel with 2 x TDM04B quad-FXO analog Digium cards, txgain is set to 0.0, and rxgain is set to 8.0 (can’t hear people on the other end if it’s below this, and it’s a little quiet even at 8.0).

Prior to any tuning, if I run “fxotune -d -b x” for all 8 channels, it reports an echo ratio ranging from 0.0039 to 0.0443. From what I’ve read, those values are low enough that the software echo cancellers in Zaptel should be able to take care of the rest. I’ve only made a couple of test calls so far, but there doesn’t appear to be any echo.

Now, if I tune my channels using “fxotune -i 1 -m 3”, load the settings with “fxotune -s”, and then check the echo ratios again with “fxotune -d -b x”, my ratios now range from 0.1033 to 0.1125 across the 8 channels.

Previously (yesterday) I had another box connected to the same 8 POTS lines, using the same exact wires. That box was Trixbox 1.1.1 with Asterisk 1.2.11 and Zaptel 1.2.8, and also had 2 TDM04B cards (but not the same exact cards). Prior to tuning, on that box my echo ratio ranged from 0.163 to 0.2071, and after tuning ranged from 0.0414 to 0.0534 across the 8 channels. Even after the tuning, I was still getting some pretty bad echo on some calls, while other calls were OK.

I suppose it’s possible that Zaptel has some vast improvements in echo cancellation, but I don’t see how the echo can be made worse after using fxotune. Hopefully someone can shed some light on this, or at least reproduce the scenario to confirm my findings.


Apparently there are some issues with fxotune. I can’t tell if this patch ( is already included in Zaptel or not but it may help.

This page ( describes some of the issues:

[color=blue]There are two types of tuning that can be performed on the TDM - adjusting line impedence, and adjusting echo coefficients in the digital filter that is part of the hybrid iteself. The current implementation of fxotune only balances the line impedence (which does not necessarily result in the best results).

Important Note: The current fxotune application in SVN has a bug that causes it to not properly clear the dialtone of the line during part of it’s test. As a result, it measures the dialtone as part of the echo response, which can cause it to ‘optimize’ to the wrong line impedence.

There is a patch against fxotune that fixes the above bug, and revamps the calibration algorithm to optimize the echo coefficients in addition to the line impedence. It also adds tools for getting a numerical measure of the amount of echo on the line. We have seen echo levels of 60% after tuning only the line impedence, and 3% after doing the full opimization. In addition, due to some frequency domain trickery, the full optimization test actually runs faster than the old one.[/color]

In my experiments I found that “fxotune -i 5” worked better than “fxotune -i 5 -m 7”. The one thing I can’t seem to solve is that fxotune wont tune my second and third FXO channel (it only tunes the first channel) even though the second and third channels have an echo ratio of 0.65.

Mark MacVicar


I also had a few problems Digium suport told me to do this;

Download the zaptel source for 1.4, cd to the /usr/src/zaptel-1.4 directory then to build fxotune run

make fxotune

then follow the instructions found here:

On the echo install HPEC you will be amazed at the results.

Thanks bwilks,

I’m already using Zaptel 1.4 so I had tried your first suggestion already, although I hadn’t seen that second link before. HPEC sounds nifty but our asterisk server probably can’t handle it, based on their cpu recommendations.

fxotune still wont tune our second and third FXO channels.

Mark MacVicar