Summary:ASTERISK-04975: [patch] [post 1.2] update for the mec3 echo canceller
Reporter:Michael Gernoth (mgernoth)Labels:
Date Opened:2005-09-03 11:02:38Date Closed:2005-10-27 11:48:23
Versions:Frequency of
Environment:Attachments:( 0) mg1ec.diff.txt
Description:After playing around with the mec3 echo canceller I tried to fix a few bugs I found in the current code:
* The simulated echo might get bigger than a signed short, so "underflowing" the signal
* Simulated echo was substracted from a static signal (like when call was on hold on the far end)
* Simulated echo was substracted even when the signal was 0
My patch tries to fix these problems and also stops training of the ecan when one of the above mentioned events occurs. Additionally, the backup facility (if enabled) is used to revert to a previous set of coefficients.


This version of mec3 works better for me than mec2/kb1ec, but it is currently only tested on 1 pri. More testers would be welcome.
I'll fax the disclaimer in a few minutes.
Comments:By: Michael Gernoth (mgernoth) 2005-09-03 11:50:26

mec3-v2.diff has a slight reorder of event detection and removes an unneeded function I used to debug the code.

By: Michael Gernoth (mgernoth) 2005-09-03 12:04:03

mec3-v3.diff now uses the already existing circular buffer for the signal.

By: Michael Jerris (mikej) 2005-09-03 14:34:22

Please post on the bug when you have sent in your disclaimer.  Thanks.

By: Michael Gernoth (mgernoth) 2005-09-03 14:47:33

I've faxed the disclaimer at 18:26 CEST today.

By: Tilghman Lesher (tilghman) 2005-09-03 15:25:48

Instead of altering an existing EC, why not create a whole new one, so we can try each simply by altering the definition in zconfig.h?  I think this is going to be the approach for the k1b EC code.

By: Michael Gernoth (mgernoth) 2005-09-03 16:27:40

Good idea. I've just uploaded a patch which adds a new echo canceller (ECHO_CAN_MG1) that is selectable from zconfig.h. Use patch -p0 to apply.

By: Matthew Fredrickson (mattf) 2005-09-29 15:20:07

Has anybody tried the updated version of this?

By: xrobau (xrobau) 2005-10-26 06:50:07

I've been having no end of echo issues with a TE110, and I've applied this today. For googlejuice, this is an Australian E1 with Echo problems. That should do it. I've been trying KB1 but it seems to fail traumatically when the volume gets too high. I tried messing around with this and seems to be significantly better. I'll keep this bug updated.


By: Michael Gernoth (mgernoth) 2005-10-26 07:55:26

If this patch helps with your echo-problems, please try my patch against KB1 which essentially does the same as this patch. It can be found at:
This worked even better for us than my patch against mec3, but I haven't submitted it to the bugtracker until now. We've since then switched to a hw ecan on our e1 pri, but i'm still using the patched kb1 at home for my bri and it does a good job there.

By: xrobau (xrobau) 2005-10-26 08:43:49

Ooh, even better. I just tried this, and it seems MUCH better. I could get MG1 to echo reasonably easily, and I had quite a significant issue getting KB1+your fix to echo at all. I've put this on the production system, and I'll see how it goes tomorrow.

By: Jared Smith (jsmith) 2005-10-26 10:59:50


Would you please upload your KB1 patch to the bug tracker and make sure it is disclaimed?

By: Michael Gernoth (mgernoth) 2005-10-26 11:24:41

As a new bug or should I add it to this one?

By: Jared Smith (jsmith) 2005-10-26 11:39:34

I'd add it as a new one, and then put the bug number in the comments of this one.  (You may also want to reference this bug number in the new report.)


By: Tilghman Lesher (tilghman) 2005-10-26 11:50:21

Separate bug, which we'll link to this one.  Make it selectable as ECHO_CAN_MG2.

By: Michael Gernoth (mgernoth) 2005-10-26 11:58:50

Ok, I just added submitted the bug as 5520 which currently only contains my patch against kb1. I'll work on making it MG2 now.

By: Matthew Fredrickson (mattf) 2005-10-26 16:08:10

Perhaps we should deprecate this bug in place of 5520?

By: Michael Gernoth (mgernoth) 2005-10-27 03:51:50

I think deprecating this is a good idea, as the fix for kb1 in 5520 seems to produce much better results.

By: Matthew Fredrickson (mattf) 2005-10-27 11:48:06

Deprecated in favor of 5520