FreePBX/DAHDI

From SME Server
Jump to navigationJump to search

Author

Daniel B. from Firewall Services

FreePBX require that you configure your hardware card by hands before it can use it. This example is with a TDM400P card from Digium. It should be about the same for other models.

Goal

The goal of this how-to is to explain how-to configure an hardware card supported by DAHDI drivers so it can be used with FreePBX.


Important.png Note:
This example is with a TDM400P card from Digium. It should be about the same for other models.


Insert the card

The first step is of course to connect physicaly the card on your server

Check the server detects it

Now check your server can see the card with lspci

[root@sme ~]# lscpi

With the TDM400P, you should see something like:

00:0d.0 Communication controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface

Remove useless drivers

Edit the file /etc/dahdi/modules and comment all the driver you don't need (the file is well commented). For example, with the TDM400P card, the only driver needed is the wctdm

Restart DAHDI

run the following command to unload all the drivers, and load only the one(s) you need

/etc/init.d/dahdi restart

Generate a basic configuration file

dahdi-tools include dahdi_genconf, a utility which can autodetect the available channels of your card, and create a basic configuration file

dahdi_genconf

Now, you need to adapt it so it can be used with FreePBX:

sed -i -e "s/from-pstn/from-zaptel/g" /etc/asterisk/dahdi-channels.conf

And edit /etc/dahdi/system.conf to adapt to your zone, for example:

# Global data

loadzone        = fr
defaultzone     = fr

Adapt the main dahdi configuration

Now edit to your need the file /etc/asterisk/chan_dahdi.conf, you should include the file /etc/asterisk/dahdi-channels.conf. For example, here's my configuration:

;
; Zapata telephony interface
;
; Configuration file 

[trunkgroups]

[channels]

language=fr
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=6
hanguponpolarityswitch=yes
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=6.0
txgain=6.0
group=0
callgroup=1
pickupgroup=1
immediate=no 

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

;Include genzaptelconf configs
#include dahdi-channels.conf

group=1

;Include AMP configs
#include chan_dahdi_additional.conf

Create your trunk and extensions in FreePBX

Now you can go on the admin interface of FreePBX and create your extension and trunks. To know which channel number is an FXO or an FXS, edit the file /etc/asterisk/dahdi-channels.conf. The section with context=from-internal are for extensions, the ones with context=from-zaptel are for trunks.