FreePBX, Asterisk and Linux Advanced Topics

Here are a few advanced topics covering some things that can be done to any FreePBX or strictly Asterisk distribution.  These would be things one might be interested in doing beyond the standard Linux-Asterisk-Freepbx installation.


Automatically configuring zaptel cards


First of all a few words about zaptel cards.  These are any and all hardware cards used to connect your Asterisk system to the public switched telephone network whether it is analog line(s) or digital (T1 PRI, E1, ISDN).  I won't go into much detail about how to configure them.  I just want to point out some automated tools for setting them up. 

For standard zaptel cards the command is called genzaptelconf.  For Sangoma cards the command is called wancfg_zaptel.  Simply run this command and it will create an /etc/zaptel.conf and /etc/asterisk/zapata.conf file based on the detected hardware.  If it worked correctly that is all that should be required to configure your zaptel hardware. 
NOTE: For trademark reasons Digium is changing the word zaptel to DAHDI


Caching nameserver


DNS translates human readable names into IP addresses.  It's usually a good idea to set up Linux on your PBX so that it has a way of translating DNS otherwise you may get some unpredictable things happening in Asterisk.  The method recommended in the Open Telephony Training Seminar is to set up a caching-nameserver on the PBX.  Basically all it does is cache DNS names from some other DNS server for use locally so that it doesn't have to generate extra traffic calling the name server everytime a phone or other VoIP device requests a previously used name translation.  A caching-nameserver is a subset of BIND (named).

Setting up a caching-nameserver:
yum install caching-nameserver
This will install BIND and all the configurations required.
nano /etc/named.conf
Edit the IP address in this file to point to your upstream DNS server or forwarder.  This is often done by the router in small offices.  Some people use external DNS servers of their ISP or some other service.

Lastly, set it up so that it checks the PBX cache for matches before going upstream
chkconfig --level 345 named on
nano /etc/resolv.conf

#Add this to the first line
nameserver 127.0.0.1

DHCP option 66
Option 66 is a parameter of a DHCP server that points to the TFTP server.  In Asterisk PBX's this is commonly used to store and serve the SIP phone configuration files and firmware upgrades.  When the phones connect to the IP network they are typically set to obtain an IP address automatically from the local network DHCP server.  If the server is capable of providing the Option 66, the TFTP IP address will be configured into the phone at which point it can locate the TFTP server, upgrade its firmware and download it's configuration files and configure itself.  This is a good option to have in larger installations where there are many phones that need to be connected.  It is also of some benefit at remote locations where you may not be readily available to go onsite to install phones.  With DHCP Option 66 you could theoretically send the phone and have anyone simply connect it to the network and configure itself.  Not all DHCP servers are capable of providing Option 66 such as many inexpensive routers.  In that case mDNS, as explained in this link may be worth considering.

 
Getting notified of problems

Obviously if the PBX has some problem it would be useful if it were to email you. 
Some of the problems you can configure Linux-Asterisk to notify you of are:
Asterisk crashes
RAID problems
Hard drive errors (S.M.A.R.T)

This assumes you have sendmail or postfix installed.
nano /usr/sbin/safe_asterisk
remove any '#' before the NOTIFY line
change the email address to your email address

NOTE: make sure to set hostnames on each client PBX to be unique so you can identify which PBX the notification is coming from.

for RAID notification:
nano /etc/mdadm.conf
Change the MAILADDR variable to your email address

For S.M.A.R.T notification:
nano /etc/smartd.conf

#Add the following lines (assuming your using SATA)
/dev/sda -d ata -S on -o on -a -I 194 -m youremail@yourdomain.com
/dev /sdc -d ata -S on -o on -a -I 194 -m youremail@yourdomain.com

(Ctrl-X>y>ENTER)

service smartd start
chkconfig --level 345 smartd on


These were some of the topics presented in more detail at the Open Telephony Training Seminar -  Advanced Topics by Ethan Schroeder