Digium Cards and Echo

We just installed a FreePBX distro with a Digium 410P card (without the digium echo cancellation module). The users are experiencing echo on phone system end of things where they can here their own voice. The card seems to indicate the software echo cancellation is “INACTIVE” according to below.

I thought the software echo cancellation built into the digium dahdi drivers with FreePBX would do the trick, but seems like they don’t?

Would someone be able to recommend what we should do? Buy an echo canceller module from Digium, or maybe there is a configuration issue?

Here is how the card is currently setup:

/etc/dahdi/system.conf

# Autogenerated by /usr/sbin/dahdi_genconf on Fri Apr 13 14:59:21 2012
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: WCTDM/0 "Wildcard TDM410P" (MASTER)
fxsks=1
echocanceller=mg2,1
fxsks=2
echocanceller=mg2,2
fxsks=3
echocanceller=mg2,3
fxsks=4
echocanceller=mg2,4

# Global data

loadzone        = us
defaultzone     = us

/etc/asterisk/chan_dahdi.conf

;
; Zapata telephony interface
;
; Configuration file

[trunkgroups]

[channels]

language=en
context=from-zaptel
signalling=fxs_ks
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes
busydetect=yes
busycount=10
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no


#include dahdi-channels.conf

group=1

;Include AMP configs
#include chan_dahdi_additional.conf

/etc/asterisk/dahdi-channels.conf

; Autogenerated by /usr/sbin/dahdi_genconf on Fri Apr 13 14:59:21 2012
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCTDM/0 "Wildcard TDM410P" (MASTER)
;;; line="1 WCTDM/0/0 FXSKS  (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

;;; line="2 WCTDM/0/1 FXSKS  (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default

;;; line="3 WCTDM/0/2 FXSKS  (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

;;; line="4 WCTDM/0/3 FXSKS  (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 4
callerid=
group=
context=default

I ended up ordering the echo cancellation module for the card. We were still having echo issues after enabling the MG2 on the channels.

QBitsJim, Would you be able to share your full /etc/dahdi/system.conf, /etc/asterisk/chan_dahdi.conf and /etc/asterisk/dahdi-channels.conf files?

What version of dadhi are you using ?
Use dahdi_cfg -vv

We need to know if dahdi was compiled with oslec support:

In the file /etc/asterisk/chan_dahdi.conf
comment the line echotraining=800

In the file /etc/dahdi/system.conf
change mg2 by oslec then reboot.
After reboot run dahdi_cfg -vv
you must see that the echo cancellation is oslec. Please print that output and show it to us.

Is the OSLEC better than the MG2? Would you say it works as well as the hardware echo cancellation module from Digium?

DAHDI Tools Version - 2.6.0

I get the following error now when running dahdi_cfg -vv

DAHDI Tools Version - 2.6.0

DAHDI Version: 2.6.0
Echo Canceller(s): HWEC
Configuration
======================


Channel map:

Channel 01: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 01)
Channel 02: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 02)
Channel 03: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 03)
Channel 04: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 04)

4 channels to configure.

Setting echocan for channel 1 to oslec
DAHDI_ATTACH_ECHOCAN failed on channel 1: Invalid argument (22)

I have switched back to mg2. I think part of our problem was that we missed running the command “dahdi_cfg” which seems to enable the software echo cancellation module?

As the output of dahdi-channels.conf is now:

; Autogenerated by /usr/sbin/dahdi_genconf on Fri Apr 13 21:34:07 2012
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCTDM/0 "Wildcard TDM410P" (MASTER)
;;; line="1 WCTDM/0/0 FXSKS  (In use)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

;;; line="2 WCTDM/0/1 FXSKS  (In use)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default

;;; line="3 WCTDM/0/2 FXSKS  (In use)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

;;; line="4 WCTDM/0/3 FXSKS  (In use)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 4
callerid=
group=
context=default

The command “dahdi_cfg” does not enable the software echo cancellation module.

Let me see your /etc/dahdi/system.conf

It is already posted in my first post…

Is the problem solved ?

Happened after I upgraded to the latest version using the scripts from http://www.freepbx.org/forum/freepbx-distro/distro-discussion-help/stable-release-versions

In /etc/dahdi/system.conf I had to rename all ‘mg2’ entries to ‘MG2’ (case-sensitive).
Restarted dahdi and asterisk.
Everything started working.
Hope this helps!

/etc/dahdi/system.conf:

fxsks=1
echocanceller=MG2,1
fxsks=2
echocanceller=MG2,2
fxsks=3
echocanceller=MG2,3
fxsks=4
echocanceller=MG2,4

Global data

loadzone = us
defaultzone = us

/etc/asterisk/chan_dahdi.conf

[trunkgroups]

[channels]

language=en
context=from-zaptel
signalling=fxs_ks
rxwink=300

busydetect=yes
busycount=10
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no

;faxdetect=both
faxdetect=incoming

group=1

/etc/asterisk/dahdi-channels.conf

;;; line="1 WCTDM/4/0 FXSKS (In use) (EC: HWEC - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

;;; line="2 WCTDM/4/1 FXSKS (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default

;;; line="3 WCTDM/4/2 FXSKS (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

;;; line="4 WCTDM/4/3 FXSKS (In use) (EC: MG2 - INACTIVE)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 4
callerid=
group=
context=default

Hmm… All the statuses show that echo cancellation is off but it is definitely working. Trying to restart the dahdi services now shows “ERROR: Module dahdi_echocan_mg2 is in use” which it has never done before. Also dmesg shows: dahdi_echocan_mg2: Registered echo canceler ‘MG2’

It doesn’t look like your MG2 is actually working…

I think you need to run this command from the linux console:

dahdi_cfg -vv 

[root@asterisk ~]# dahdi_cfg -vv
DAHDI Tools Version - 2.6.0

DAHDI Version: 2.6.0
Echo Canceller(s): HWEC, MG2
Configuration

Channel map:

Channel 01: FXS Kewlstart (Default) (Echo Canceler: MG2) (Slaves: 01)
Channel 02: FXS Kewlstart (Default) (Echo Canceler: MG2) (Slaves: 02)
Channel 03: FXS Kewlstart (Default) (Echo Canceler: MG2) (Slaves: 03)
Channel 04: FXS Kewlstart (Default) (Echo Canceler: MG2) (Slaves: 04)

4 channels to configure.

Setting echocan for channel 1 to MG2
Setting echocan for channel 2 to MG2
Setting echocan for channel 3 to MG2
Setting echocan for channel 4 to MG2

Make sure you gun the fxotune utility to balance the levels. If you don’t the echo cancellors have to work much harder.

Hello:

I have installed FreePBX and a Digium TDM410P with 4 FXO modules. No hardware echocan. 4 analog lines.

After inserting echocanceller = oslec,1-4 in System Settings in DAHDI Configuration Module (/etc/dahdi/system.conf) and reboot, I stopped hearing echos in calls.

The quality of the calls are actually pretty good.

DAHDI Version: 2.6.1 Echo Canceller(s): HWEC, OSLEC Configuration ======================

Channel map:

Channel 01: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 01)
Channel 02: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 02)
Channel 03: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 03)
Channel 04: FXS Kewlstart (Default) (Echo Canceler: oslec) (Slaves: 04)

4 channels to configure.

Setting echocan for channel 1 to oslec
Setting echocan for channel 2 to oslec
Setting echocan for channel 3 to oslec
Setting echocan for channel 4 to oslec

Cheers.

Ok, this worked, the trick is now in the DAHDI module, under system settings.

Set the “Other Dahdi System Settings” as… the [] represent the input boxes
[ echocanceller ] = [ oslec,1-4 ]

Then save, and restart dahdi, you can confirm via console as above with -vv

This is also a good place to look, it covers the 410 but it applies to the 400 as well!

http://docs.digium.com/TDM410/analog410series_manual.pdf

Interesting that you got it to work. We ended up buying the hardware echo cancellation modules with all phone systems. Haven’t had any echo problems since. (Except for lines going over internet).

like Skyking said if you use software cancelation you must run fxotune utility, if you don’t its highly unlikely you will be echo free.

When I try to run fxotune I get errors.

DADHI_SPECIFY ioctl failed: Device or resource busy

I have tried to turn the hahdi service off and then ran fxotune again, but then it gets a different error.

Can anyone tell me the exact process to run the utility? I am having problems with the echo and this is driving me a bit crazy.

Thanks!

-Mark

If you read the documentation you will see that fxotune needs to run while ASTERISK is stopped, did you so stop asterisk?