[asterisk-users] Re: [asterisk-dev] Tuning Software Echo Cancellers

Rich Adamson radamson at routers.com
Mon Aug 7 07:42:37 MST 2006


Moved to -users list....

>> Inline... general comments
>>
>>> 	I am working on trying to track down and eliminate echo on a PRI. 
>>> I'm using Gen 2 TE-405P cards, w/ the MG2 echo canceller. I cannot enabnle 
>>> AGGRESSIVE_SUPPRESSION because that causes dropouts in the speech that are 
>>> unacceptable to my customers needs. I am awaiting the RMA of a pair of 
>>> TE-405s for upgrade to Gen 3 so that I can put the VPM-450 hardware echo 
>>> can card on them, but in the meantime, I am trying to tune the software 
>>> echo cancelling routines to lessen the impact of the echo to specific 
>>> local central offices where the Telcos just do not have any edge 
>>> supression going on.
>>>
>>> I am using MG2 w/ the following settings in zapata.conf
>>>
>>> echocancel=256
>>> echotraining=800
>>> rxgain=+0.21
>>> txgain=-0.0
>> The echotraining parameter was originally created for analog pstn lines, 
>> adding a delay (in the above example, 800 milliseconds) to allow analog 
>> central office equipment to settle down before the s/w echo can routines 
>> pulsed the line. The reflective energy from the pulse was then used to 
>> preload the echo can routines.  Doubtful this parameter should be 
>> anything other then =yes on a PRI.
> 
> Alright.
>  
>> The rxgain and txgain values need only be expressed in units; the 
>> numbers after the decimal point have no practical value.
> 
> Interesting. They appear to show differences when monitoring the Milliwatt 
> number using ztmonitor application.

The digits to the right of the decimal point are used by asterisk, 
however you're looking for a major impact and not microscopic changes. 
Therefore stick to units digits for rxgain and txgain until you are very 
very close to perfect.

>>> The rxgain was set using a local milliwatt number (line side). 
>> Exactly how did you measure that? (What type of transmission test set 
>> and what did you attach the test set to?)
> 
> I used the following procedure:
> 
> http://lists.digium.com/pipermail/asterisk-users/2004-November/064312.html
> 
> No test sets.
> 
>>> I'm still 
>>> having trouble getting a long enough tone from the local C/O to do the 
>>> txgain, hence the 0.0 setting. Apparently, X/O has their DMS 100 set to 
>>> only provide 6 seconds of Millwat before it ends. No one seems to be able 
>>> to figure out how to extend it on the local switch.
>> The above statements don't make any sense. When you dial into a CO 
>> milliwatt generator, it generates a 1k tone allowing you to measure the 
>> level of that tone at your site.
> 
> Yes.
> 
>> You then adjust rxgain. Since this happens to be a PRI, there is no pstn 
>> loss and therefore no reason to try and compensate for a pstn loss. How 
>> did you jump to a conclusion that you could use a CO milliwatt generator 
>> to set txgain?
> 
> Again, the following article:
> 
> http://lists.digium.com/pipermail/asterisk-users/2004-November/064312.html

That article does not use the CO milliwatt generator to set txgain. It 
clearly states that you must dial one of your telephone numbers that 
loops "through" the central office and is answered by your asterisk box.

As in:  Call -> asterisk -> CO -> asterisk -> you answer (2nd number)

>>> Using a value of 256 should give me a 64ms echo tail (from what I have 
>>> read), but it does not seem to be enough to qwell the echo coming back 
>>> from the particular trouble CO, which appears to have a 189 ms echo.
>> Highly unlikely that "the particular trouble CO" involves 189 ms echo, 
>> unless that CO is half way around the world or is accessed via satellite 
>> facilities.
> 
> Don't know what to tell you, but with all software echo canceling off, a 
> mixmonitor recording of the channels shows a difference of 189 milliseconds 
> from the time the original sound is played and when it is played back on 
> the receiving channel. I've loaded this into an audio editing program 
> (wavepad pro) to measure the echo tail as well as the amplitude of the 
> echo.

The above approach includes other delays within asterisk (not just what 
zaptel sees), so its use is of little value.

>> I'd suggest going back to 128 and compare echo with 256 to 
>> the exact same distant tel number. Suspicion is you can't tell the 
>> difference and 128 is just fine.
> 
> There is no difference between the two.
> 
>> The sangoma folks created a utility that could be used to measure the 
>> echo and plot it in an excel graph. I've not used it since roughly 12 
>> months ago and don't actually remember the utility's name. (Hopefully 
>> someone else on the list will remember and post it.)
>>
>> Think I'd start with parameters like these:
>>   echocancel=yes
>>   echotraining=yes
>>   rxgain=0
>>   txgain=-3
>> and adjust txgain downward (more negative) by two or three units (eg, 
>> -3, -6, -9) to see if that impacts echo. If one of those values is 
>> better then another, then adjust by units around that point (forget the 
>> decimal point). Be sure to call the same pstn tel number for each test 
>> (and not a cell phone), and restart asterisk after each parameter change 
>> (don't use reload).
> 
> The only way to completely eliminate the echo is to reduce the txgain to 
> -20. At that point, the volume of the outbound call is barely audible.

The problem with eliminating echo is that there are multiple parameters 
that basically interact with each other (eg, gains, taps, delays), and 
changing values randomly seldom finds the appropriate results. Its 
probably the most complicated technical thing to understand and adjust 
primarily because there are few reasonable tools to help adjust them. In 
addition, the operating range of asterisk's s/w echo canceler is rather 
limited compared to most h/w cancelers, and in many cases, its almost 
impossible to determine whether you fall outside the s/w operating limits.

What further complicates the process is that not all digital-to-analog 
conversion points are created equal. Most are good; some are very bad, 
and it sounds like you're trying to adjust asterisk's parameters for one 
or two bad ones.

Several users have attempted to document the adjustment process, however 
the process is truly 100% dependent on your system's interaction with 
the pstn, etc. So, what works at one location does not necessarily work 
at another asterisk location.

The s/w echo can seems to work pretty good on short pstn loops but has 
difficulty with longer loops and with some loops where the telco uses 
remote line concentrators.

As a very experienced ex-telco transmission engineer, I've not found an 
accurate and repeatable way to adjust asterisk's s/w parameters that 
would fit in all cases. The tools aren't there to do it. After many many 
attempts to do that, I gave up and upgraded to hardware cancellation, 
and have not looked back. Works great.




More information about the asterisk-users mailing list