Installation of the echo canceller Oslec and DAHDI

Once I installed a Chinese TDM410P card for connecting analog telephone lines and a bundle of Asterisk + Dahdi.
Since the board has no hardware noise cancellation, Oslec had to be installed.
When making calls, there was no echo from the side of the analog telephone, but whoever spoke into the IP phone heard himself.

I configured it on Ubuntu Server, so let’s switch to root right away:

sudo -i

The following commands will see if oslec and other information about dahdi and the board is installed:

lsmod |grep oslec
lsmod |grep dahdi
updatedb
locate oslec | more
dahdi_cfg -vvvv

In my case, the first command did not show anything, and the last one gave an error at the end.
This means that Oslec is not installed, so we will collect Dahdi along with Oslec.
Download the archive with the kernel sources and unpack them (with the ls command, look at the name of the linux-source- * archive, in my case there was a link to the linux-source-3.13.0.tar.bz2 archive):

cd /usr/src
aptitude install linux-source
tar xjf linux-source-3.13.0.tar.bz2

Download the Dahdi sources and unpack them into the /usr/src/dahdi/ directory (with the ls command, look at the name of the directory with the unpacked files and with the last command, rename it):

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
tar xvfz dahdi-linux-complete-current.tar.gz
rm -f dahdi-linux-complete-current.tar.gz
mv dahdi-linux-complete-2.11.1+2.11.1 dahdi

Create a directory for Oslec and copy the necessary files from the archive with the kernel sources into the directory with the Dahdi sources:

mkdir /usr/src/dahdi/linux/drivers/staging
cp -fR /usr/src/linux-source-3.13.0/drivers/staging/echo /usr/src/dahdi/linux/drivers/staging

We’ll point out in Kbuild what Dahdi needs to do with Oslec:

sed -i "s|#obj-m += dahdi_echocan_oslec.o|obj-m += dahdi_echocan_oslec.o|" /usr/src/dahdi/linux/drivers/dahdi/Kbuild
sed -i "s|#obj-m += ../staging/echo/|obj-m += ../staging/echo/|" /usr/src/dahdi/linux/drivers/dahdi/Kbuild
echo 'obj-m += echo.o' > /usr/src/dahdi/linux/drivers/staging/echo/Kbuild

Let’s start compilation and installation:

cd /usr/src/dahdi/linux
make
make install

On this, Dahdi with Oslec echo canceller is installed and ready to go. I note that if you upgrade your system with apt-get update/upgrade and update the kernel, you will need to compile dahdi again.

To enable Oslec, we specify it in the /etc/dahdi/system.conf file:

fxsks=1
echocanceller=oslec,1
fxoks=2
echocanceller=oslec,2
fxoks=3
echocanceller=oslec,3
fxoks=4
echocanceller=oslec,4

And also activate in /etc/asterisk/chan_dahdi.conf:

echocancel=yes
echocancelwhenbriged=no
echotraining=no

Restart Dadhi and Asterisk to apply the changes in the configuration files:

service asterisk restart
asterisk -rvv
dahdi restart
quit

modprobe dahdi
modprobe dahdi_dummy
modprobe dahdi_transcode
modprobe wctdm24xxp

In the case of dahdi startup errors, you can restart the server.

Done, on the test, when you call over an analog line, sometimes at the first second from the IP phone you can hear yourself, but then the echo is perfectly cancelled.

Leave a comment

Leave a Reply