Ok, so one of the most common requests I get is people complaining about echo. This problem has plagued Asterisk since the beginning, and is one of those annoying types of problems that is intermittant and not the easiest thing to track down.
First things first, if you want to try to completely eliminate echo cancellation from the git-go, do yourself a favor and spend a few extra bucks on a hardware card with a built-in echo cancellation chip. Digium and Sangoma both have models available with a chip from Octasic onboard. Rhino has an echo cancellation daughterboard that can be placed on their T1 cards.
If you already have a hardware card, there are also echo cancellation software modules availabe from Octasic (and others as far as I know…I haven’t heard of any though). These run about $10 bucks USD per channel, and are pretty easy to install (see my other blog post on this topic).
Ok, so what if you already have a card and don’t want to spend any money on software modules, but still want to try to reduce echo? Here’s a few troubleshooting tips.
The first thing I usually do when faced with this problem is try to gauge the extent of the echo problems. I usually try to have the client give me an estimate of how many calls have bad echo in terms of the percentage of total calls. The echo troubleshooting at 10% is much different than it is at 90% echo. At above 50% echo, you most likely have a hardware issue…the primary culprit would be the computer Asterisk/Trixbox is running on. Not enough RAM? CPU too slow for the volume of calls? It’s probably something like that. That’s not the type of echo problem I’m talking about.
I’m talking about the 10-20% type of intermittant echo problem in this blog…this can usually be fine tuned to less than 5% with some adjustment to the Zaptel settings.
The first (and easiest) thing to run is fxotune. This utility analyzes the TDM characteristics of your device and fine tunes them. This is also known as ‘balancing the hybrid.’ I don’t know why.
To run fxotune, do the folloing in the Linux CLI (with Asterisk/Trixbox STOPPED):
fxotune -i 4
This takes 4-5 minutes per Zaptel channel, so be prepared for a little bit of downtime.
The next thing you want to do is run the ztmonitor tool. This can be done at the Linux CLI by running ‘ztmonitor [channel number] -v’. So if you wanted to run it on channel 1 of a T1 card, the command would be ‘ztmonitor 1 -v’. You will see a graph on the screen which shows the Tx and Rx (transmit and receive) volume of a call.
It should look something like this:
Visual Audio Levels.
——————–
Use zapata.conf file to adjust the gains if needed.
( # = Audio Level * = Max Audio Hit )
<----------------(RX)----------------> <----------------(TX)---------------->
* ########### *
The level of the audio (while a call is in progress…if the line is on the hook, you’re not gonna get any levels…drrrr) is marked by the pound signs (###). The peak level is marked by an asterisk (*). There can be two problems here that lead to echo. The gain (volume) is too high, or too low. If you are watching a call in progress, and the peak is all the way to the right, you need to reduce your gain. If the levels are barely registering, you need to boost your volume. In general, you want the level to be right in the middle (on average)…I use the (RX) and (TX) labels on the graph as my desired average point.
The Zaptel echo and gain settings are in /etc/asterisk/zapata.conf. By default, they look like this:
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
First, let’s deal with the gain. If you’re too low on Rx or Tx, try to boost it by 2.0db like this:
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=2.0
txgain=2.0
The rxgain and txgain settings go from -100.0 to 100.0…but you never want to adjust them more than 10.0db either direction (usually no more than 5.0db). So make a call, run ztmonitor, and then watch the levels again. They should be a little bit higher. You can keep adjusting the Rx and Tx levels until they are at the midpoint average of the graph. Keep in mind that not ALL calls are gonna be perfect, but this should give you a good general idea. Also, keep in mind that the Rx and Tx levels can be adjusted individually. Let’s say that you feel your Rx (receive) volume is too low, but your Tx (transmit) volume is too high…your settings may look like this:
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=3.0
txgain=-2.0
(Note that the Tx gain is set to -2.0. Sometimes the minus sign is hard to see).
Having the appropriate gain levels will usually do the trick when it comes to echo cancellation, but you may want to adjust the echo settings as well…here is what they do:
echocancel=(yes/no) – This turns on/off the Zaptel echo cancellation.
echocancelwhenbridged=(yes/no) – This turns on/off the echo cancellation when on a bridged call. It is best to keep this off.
echotraining – this is the amount of time Asterisk uses to try to ‘learn’ echo on a line. I usually set this to 128 instead of the default 800.
If you still have echo…buy a legacy PBX.
-Schw00d