Configuring TDM410P with Asterisk

In the test, I connected a Chinese TDM410P board with four FXO ports (red) to the PCI slot of the turned off Ubuntu server.
For convenience, immediately switch to the root user:

sudo -i

Turned on the server, executed a command that displays PCI devices and buses:

lspci -v

I saw the installed board in the list:

05:00.0 Ethernet controller: Digium, Inc. Wildcard TDM410 4-port analog card (rev 11)
Subsystem: Digium, Inc. Wildcard TDM410 4-port analog card
Physical Slot: 1
Flags: bus master, fast Back2Back, medium devsel, latency 64, IRQ 16
I/O ports at 1000 [size=256]
Memory at b1900000 (32-bit, non-prefetchable) [size=1K]
Expansion ROM at b1920000 [disabled] [size=128K]
Capabilities:
Kernel driver in use: wctdm24xxp
Kernel modules: wctdm24xxp

We register the board (the parameters will automatically be written in the configuration /etc/dahdi/ and /etc/asterisk/dahdi-channels.conf):

dahdi_span_assignments -v auto
dahdi_genconf -v

Now the board can be seen with the command:

dahdi_scan
dahdi_cfg -vvvv
lsdahdi

If there are errors with the dahdi_cfg command, then dahdi may not be installed, we will compile it, for example, as I wrote in the article mentioned in the link below, especially if the Chinese board does not have hardware noise reduction, then you will have to collect dahdi for any with Oslec.
Installation of the echo canceller Oslec and DAHDI

In the /etc/dahdi/modules file, I have the modules listed (the last wctdm24xxp is just for TDM410P):

dahdi
dahdi_dummy
dahdi_transcode
wctdm24xxp

You can load it with the command:

modprobe wctdm24xxp

In the /etc/dahdi/system.conf file, change the zone to ours (it may be reset after the dahdi_genconf command is executed):

loadzone=ru
defaultzone=ru

In the file /etc/asterisk/modules.conf, in the [modules] block there should be a line for autoload of the chan_dahdi module:

load => chan_dahdi.so

It can also be downloaded from the asterisk console, but it will be active until asterisk restarts (the first command opens the asterisk console, the last leaves it):

asterisk -rvv
module load chan_dahdi
quit

You can restart dahdi from the asterisk console with the command:

dahdi restart

You can check the status with the command (the list should contain Wildcard TDM410P):

dahdi show status

I connected a wire with the telephone number of the city analog line to port 1 of the board (port numbering is from top to bottom, the port is closer to the fourth PCI slot).
Now we will write it at the end of the users.conf file for the first port (channel):

[trunk_1]
group = 1
context = DID_trunk_1
busydetect = yes
busycount = 3
busypattern = 500,500
ringtimeout = 8000
progzone = ru
usecallerid = yes
cidstart = ring
cidsignalling = bell
flash = 750
rxflash = 1250
callerid = asreceived
dahdichan = 1
trunkstyle = analog
allow = all
group = 1
pulsedial=yes
dialtone_detect=yes
signalling = fxs_ks
channel = 1

I note that without the parameters pulsedial=yes, dialtone_detect=yes, outgoing calls did not work for me, but an uninterrupted dial tone was heard (Ukrtelecom telephone lines).

Add /etc/asterisk/chan_dahdi.conf at the end of the file:

context=DID_trunk_1
signalling=fxs_ks
group=1
channel => 1

Restart Asterisk to apply the changes:

service asterisk restart

Connect to his console and see if the added channel is active:

asterisk -vvr
dahdi show channels
dahdi show channel 1

You can view the volume level and traffic on the channel with the command:

dahdi_monitor 1 -v

In the extensions.conf file, specify where to send incoming calls (in my case, to the IP phone number 6001):

[DID_trunk_1]
exten => s,1,DIAL(SIP/6001,20)
exten => s,2,Hangup()

We also add to the dialplan in which IP phones are configured, lines with templates of phone numbers where you can call (for example, the number 21545 is specifically indicated in the first line, and in the second template under which all five-digit numbers starting with seven fall, the letter W means a pause before dialing):

exten => _21545,1,Dial(DAHDI/1/W${EXTEN})
exten => _7XXXX,1,Dial(DAHDI/1/W${EXTEN})

If you need to wait a pause after dialing 0 before dialing the rest of the number:

exten => _022XXXXXX,1,Dial(DAHDI/1/W0W${EXTEN:1},60)

You can restart Asterisk with the command:

service asterisk restart

From the asterisk console, you can individually load configuration files, for example, sip and extensions:

asterisk -rvv
sip reload
dialplan reload
quit

Leave a comment

Leave a Reply