One common issue that persists through all telecoms related business is echo.
In the early days of the telephone, telecoms companies spent a lot of money going to great lengths trying to find a solution to the problem which occurred frequently when the traditional telephone network was first deployed.
We have to deal with this issue fairly frequently during consultancy on customer sites with their Asterisk PBX’s.
The issue almost always occurs with calls over PSTN/ISDN hardware and rarely appears to affect VoIP (probably due to upstream trunking providers use of echo cancellation software).
There are several approaches we can take:
- We can enable DAHDI’s echo cancellation (“mg2″) and tweak various settings to try and make it work.
- We can pay serious money to Digium et al. for a hardware module that will cancel the echo on the card itself.
- We can compile DAHDI with OSLEC.
OSLEC – Open Source Line Echo Canceller – is pretty much what it says on the tin. It’s an echo canceller, written by the legendary David Rowe which is far superior to other open source line echo cancellors. Unfortunately, as one of Digium’s revenue streams is the sale of hardware echo cancellation modules, getting it working feels like a bit of a hack and isn’t fantastically documented.
I thought we’d share how we did it…
First we switch to our source directory:
dmc-pbx:~# cd /usr/src/
Let’s now download BSM Development’s lovely dahdi-oslec tar.gz with the modification you need to make to the plain DADHI source:
dmc-pbx:/usr/src# wget -c http://www.bsmdev.com/Downloads/dahdi-linux-oslec-126.96.36.199+2.3.0.tar.gz
Let’s now download the complete dahdi-linux tar.gz from Digium
dmc-pbx:/usr/src# wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-188.8.131.52+2.3.0.tar.gz
dmc-pbx:/usr/src# tar xvf dahdi-linux-complete-184.108.40.206+2.3.0.tar.gz
dmc-pbx:/usr/src# tar xvf dahdi-linux-oslec-220.127.116.11+2.3.0.tar.gz
Now lets just copy the OSLEC source into the correct part of the DAHDI source
dmc-pbx:/usr/src# cp dahdi-linux-oslec-18.104.22.168+2.3.0/* dahdi-linux-complete-22.214.171.124+2.3.0/linux/drivers/dahdi
From here you need to edit one line in this file:
dmc-pbx:/usr/src# sensible-editor /usr/src/dahdi-linux-complete-126.96.36.199+2.3.0/linux/drivers/dahdi/Kbuild
Search for OSLEC. Uncomment, the first line that mentions it, save and exit.
Now just change the root of the source package…
dmc-pbx:/usr/src# cd dahdi-linux-complete-188.8.131.52+2.3.0
…and compile, install and install startup scripts:
dmc-pbx:/usr/src/dahdi-linux-complete-184.108.40.206+2.3.0# make all;make
When it’s back up, run
dmc-pbx:~# dahdi_cfg -v
to configure the dahdi interface
dmc-pbx:~# sensible-editor /etc/dahdi/system.conf
and replace any mentions of “mg2″ with “oslec”.
After that you just need to restart dahdi
dmc-pbx:~# /etc/init.d/dahdi restart
and there you have it; a working OSLEC installation!
Fire up Asterisk and you are away and can start enjoying great quality echo cancellation without expensive hardware!
Do feel free to let us know how you get on in the comments!