Echo cancellation for SIP channels?

This is my setup:

Linksys PAP2 Phone <-> Asterisk <-> VoIP Provider <-> PSTN Line

Which means i’m using voip to make calls to regular phones.

My problem is echo. I can hear myself talking. The pap2 has echo cancellation but it’s obviously lacking. I think I know how to enable echo cancellation in zapata.conf for fxo lines, but what about a plain SIP channel? Is there a way to force it? According to what I read on voip-info, the external PSTN lines that i’m calling are causing the echo, but I can’t cancel it there because I have no control over it.

Any solutions/sugestions?

Regards,

TJ

Post your SIP.CONF file if you can please.

Cheers,

David.

[general]
register => username:password@voipprovider.com
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=201.202.203.204
svrlookup=yes
tos_sip=cs3
tos_audio=ef
maxexpiry=3600
minexpiry=60
defaultexpiry=120
t1min=100
dtmfmode=rfc2833
rtptimeout=60
rtpholdtimeout=300
t38pt_udptl=yes
registertimeouts=30
registerattemps=0
externip = 201.202.203.204
canreinvite=no

I use a realtime mysql database to store sip users.

Your configs look right, i don’t know if there is Echo canceling with SIP, but you can try to put these in;

echocancel=yes
echocancelwhenbridged=yes

Normaly you use them with Zap config file, however you can give it a try with SIP.

Cheers,

David.

Somewhat off-topic.

If we look at the technology chain, this should be entirely the provider’s responsibility. This poses an interesting question. Whereas technically Asterisk can do something about this type of situation, it’s really not Asterisk’s responsibility. And even technically, Asterisk is not at the best location to do deal with echo in this situation. But people are going to have this issue as more and more bad VoIP providers enter market space. So should Asterisk try to cope?

BTW, have you tried other end points (e.g., soft phone)? Have you asked other users of this provider about their experience? If this indeed is a PSTN interface problem, everybody should experience this. Then you would have a good chance to force the provider to fix it.

Helly valley, if I configure my PAP2 to use the provider directly, it works ok. Going thorugh Asterisk, i get echo.

Btw, my asterisk box is on a remote server, that’s about 250ms away from me. The provider is 70ms away from the asterisk box, so that should be about 320ms of latency.

Anyway, I am in a different country than the remote server and provider, so my latency to the provider is about 300ms anyway, so I don’t think that’s the culprit (would get echo when using the ATA directly configured for the provider if that was the case)

Anything I can do to force echo cancellation on SIP channels?

voip-info.org/wiki/view/Causes+of+Echo

well you 270 ms over the time when you will not have echo…
50 ms round trip wll be heard as a single event anything over the 50 ms is TWO or more events to your ear.

add in some codec transcoding and it is almost unusable…

trun down the gain use good handsets (low sidetone) no headsets (unless the mic is WAY DOWN…)

If direct PAP2 connection does not produce significant echo, line latency itself is not the primary contributor; even acoustic leak and side tone are equal, so we can eliminate these as primary suspects. Then there must be some Asterisk element that causes this.

Because Asterisk and your provider have no analogue interface, I can only think of additional latency Asterisk itself introduced. PAP2 is an ATA, right? It probably has a bad/mismatched hybrid whose effect gets “amplified” in Asterisk. Try some different hand sets to see if things change.

(I experienced echo on SIP to SIP Asterisk calls, but that was on a console. So I suspected my echo source was due to sound card configuration and acoustic leaking. After some tweaking, echo is no longer bad.)

Changing handsets procuces practically no effect. However, using a cheap DSL filter (which filters anything above 3.5 khz or so) reduces echo. Is this unheard of? What the heck is going on here? What can I do about it? Is there really no way to use echo cancellation on channels that aren’t Zaptel-based?

I think part of the issue is you have so much latency that it exceeds the providers echo canceller tail duration. If they are working with a 250ms or 320ms tail, that will catch one hop but not two in your case, as two hops ends up at like 360ms as i recall…

there isn’t a way to echo cancel voip lines that I know of, sorry :frowning:

Maybe people just assume that digital is echo free. I think this would be a good feature request, as more people could experience this, with Asterisk itself adding significant processing latency.

Technically, Asterisk has the source of the voice, it also has the resultant voice, so there is something it can do with them.

Another possible place to look is PAP2’s config. Is there any “gain” control?

Yes, I was able to significantly reduce echo by tweaking the gain settings. I agree that this matter should be looked into. Basically since I’m located in Brazil, any foreign trunk will give me a latency of over 200ms. That’s just the way the Internet works, and I can’t do much about it.

Aaaaand the plot thickens.

Tech guy at the provider says I have 3 Asterisk registrations active and that’s probably what’s causing the echo.

I’m still looking into this… I don’t know what might have caused multiple registrations. Maybe something to do with me using RealTime?

Maybe people just assume that digital is echo free. I think this would be a good feature request, as more people could experience this, with Asterisk itself adding significant processing latency.

Technically, Asterisk has the source of the voice, it also has the resultant voice, so there is something it can do with them. <<<

I totally agree. Actually I have the problem with strong echo on a local
mobile phone ↔ GSM<-> GSM-SIP gateway ↔ asterisk -<->SIP ↔ Xlite
connection.
All devices are in the same room, just a test installation, so the only real transmission delay is from my mobile phone to mobile SP and back to my GSM-gateway. But very loud echo. So echo cancellation on the SIP-channel within asterisk should be a big advantage.
And with the availability of new OpenSource echo cancellation code, this might be worthwile the implementation.

Especially, to be honest, asterisk is implemented mainly in low-cost environments. So it makes more sense, to do echo cancellation centrally, even with the drawback to buy a faster CPU, instead of recommending “buy better headsets” etc.
To buy many good headsets probably is much more expensive compared to buying a faster CPU for asterisk, assuming, that the phone lines are not active alltogether simultaneously.

Hi, this is a old topic, but i am also experiencing the same issue. where should i control the gain if i am totally running on VoIP SIP trunk?

PSTN<–>CISCO Voice Gateway<->LAN<->Asterisk<->WAN(250ms)<->Asterisk<->Cisco IP Phone

Please suggest.

thanks
ldp

[quote=“ldp”] where should i control the gain if i am totally running on VoIP SIP trunk?

PSTN<–>CISCO Voice Gateway<->LAN<->Asterisk<->WAN(250ms)<->Asterisk<->Cisco IP Phone

Please suggest.

thanks
ldp[/quote]

I had some success reducing the gain within my GSM-Gateway. So yo might try it both on your IP-Phone OR Voice Gateway.
It took quite some time of experimenting for me :smile:

Try the PBXMate from SoliCall. It is designed to handle echo with long tail.