Asterisk PBX with Reliance PRI Line using Digium TE131F

So I got an opportunity to set up Asterisk PBX with a Reliance Communications E1 line. I have worked with Asterisk PBX, but without PSTN interfacing. This post is about what all stuff I have done to get a Reliance E1 line with Digium TE131F card.

Having explored a lot of other distributions like Fedora, Arch, Gentoo, Sabayon, etc. since I ventured into Linux world and learning the internals of Linux and how different components are stitched together I settled on Ubuntu. It’s my favorite these days because  everything seems to work out of the box… except when it doesn’t, then you have PPAs. 😛 For this project I have installed Ubuntu 16.04 server edition.

The default Asterisk 13.13 build which is available in the Ubuntu Xenial repository is broken. If you enable the PJSIP channel (res_pjsip.so), Asterisk will crash immediately after starting up. There is even a launchpad bug for the same => Asterisk crashes with default install because of pjsip. Thankfully arpagon (Sebastian) has fixed it in his PPA which is given in the last comment of the bug. The PPA is this one => Asterisk PPA : “Sapian” team.

So add the PPA (but do not install asterisk yet):

DAHDI Driver Installation

First of all, we need to install the DAHDI drivers. The Digium TE131F driver is absent with the default install (launchpad bug) and needs to extra steps so that the module gets installed, as given below.

Install dahdi-dkms  package and then remove all the drivers that got installed into current kernel when the package was installed:

Then go to /usr/src/dahdi-2.10.2~dfsg-1ubuntu1  and edit the dkms.conf  file to add these lines at the end of the file, just before AUTOINSTALL=yes  line. This should be the last few lines of the file:

Now we can proceed to installing the dkms drivers to our current kernel and asterisk as well:

DAHDI Configuration

Edit /etc/dahdi/modules  and delete the line that says dahdi_dummy . In the same file add a line wcte13xp. So this should be the content of /etc/dahdi/modules :

Create a modprobe configuration file named /etc/modprobe.d/pri.conf  with the content as below:

Actually the modprobe configuration file can be avoided if you want to manually configure the DAHDI cards, and it is useful to do so only if you have more than one card in the system. For my case, it is just one so I went this way.

Then load the modules for the card:

Run dmesg  to see if there were any errors, when I had done this I got some firmware error that card firmware is running some older version than the one required by the driver. To fix that I downloaded the required TE133 firmware file (the same version as demanded by the driver, given in the dmesg ) from Digium and placed it into /lib/firmware , then unloaded wcte13xp module and reloaded it. After doing that you will see the driver will start flashing the new firmware, once the process is complete the card will be ready for use.

Now we are ready to configure DAHDI for use by Asterisk, first we generate configuration which is used by the DAHDI Linux Tools:

Edit /etc/dahdi/system.conf  and change the variables loadzone , defaultzone  to your country. In my case it is India, so:

Before jumping on to Asterisk configuration let’s first check if DAHDI configuration works correctly. Read the output of the command below carefully and ensure there is no error present. When I was doing I got some Echo Cancellation related error and that was apparently due to a kernel upgrade that was done by aptitude. I had to redo the driver installation step after rebooting to fix that.

Asterisk Configuration

There are a lot of parameters in the DAHDI channel configuration, and we do not really care about what they are at this moment, we just want to get the thing working so just edit  , go to the end of file, add following line:

Let’s build a sample extensions.conf that plays Hello World when called. I prefer to configure Asterisk using LUA because I’m a programmer and it’s easier for me to do that then learn a new way to configure something. So this configuration is limited to just playing Hello World for testing purpose:

Finally to ensure that DAHDI is configured properly before Asterisk starts we need to add a override to the Asterisk SystemD Unit file, so run systemctl edit asterisk and add the lines below:

Additionally, we also need to load the DAHDI and our card modules at boot, so:

The above two steps are required because the dahdi-linux package does not provide the DAHDI init script which does these things. I have filed a bug for the same, at launchpad.

Restart Asterisk and call your allocated DID and you should hear Hello World from Asterisk!

Advertisements

Discuss this