I was recently charged with picking out a new telephone system for a new office the company I work for was moving into. We were previously using a 3Com NBX 100. Inbound and outbound call volume for this company is relatively low. The needs of the company included: 1) easy + extensible conference calls 2) ability to use softphones (software) 3) good voicemail system 4) reliability. The company was not looking for a unified messaging system, video conferencing, color LCD phones with automatic VPN connections, etc. A basic PBX to support the phone needs of a small company was all that was needed.
Proposals from a couple providers yielded total costs of a 10 hard phone + 10 soft phone system to be around $8,000 – $12,000 with an ongoing contract. This seemed a bit high considering the simplicity of the needs of the company. After some research and a lot of trial and error I was able to get the entire phone system deployed for less than $2,100 ($350 POE switch, 10 phones * $85, ~$900 analog card, used an old Windows box lying around). It took me about a week of full-time work to figure out how all the peices fit together and deploy the system. Although VOIP may seem a bit intimidating with all the lingo and plethora of options, it isn’t as hard or mysterious as it may seem at first.
Hopefully this compilation of notes will help someone in a similar situation develop and deploy a VOIP Asterisk based solution. Enjoy.
- POTS = Plain Old Telephone Service = Analog Lines = Copper Lines
- SIP = Session Initiation Protocol. This is the traffic that will travel over your LAN and communicate with your office phones (in my case, Polycom 321s and Telephone.app)
- SIP Trunk = A digital alternative to POTS. I did not utilize a SIP Trunk in my setup, but from what I understand you basically grab a special card that then connects through your WAN to a remote SIP Trunk provider. Essentially your phone lines are routed through your internet (similar to Skype).
- PBX = Private Branch Exchange. This is box that sits between your telephone endpoints (SIP trunk or POTS) and your phones connected to your lan
- POE = Power Over Ethernet. Many modern phones can be powered through the ethernet cable that they use to communicate with the LAN, this eliminates the need for power adaptors for each individual phone. Some ‘pre-built’ / commercial PBXs have POE built in. In my setup I purchased a NetGear FS728TP-100NAS
- TFTP = Trivial File Transfer Protocol. The Polycoms (and many other phones) use TFTP to pull their application binary, configuration settings, and other information.
- ARP = Address Resolution Protocol. I don’t really understand this piece too much, but
- FreePBX / Elastix = GUI for the Asterisk configuration files
- DAHDI = software that integrates with Digium (and other) analog and digital PCI hardware devices. This used to be called Zaptel. This software runs on the driver level of operating system (it isn’t a service like Asterisk). Essentially is bridges asterisk with POTS or SIP trunks.
Basic System Overview
- Separate cat6 voice + data lines to each work station
- Data lines connected to gigabit switch
- Voice lines connected to POE 10/100 switch referenced above
- POE switch tied to the gigabit switch via 2 gigabit ethernet ports
- Asterisk running on couple-year-old Dell dual-core 2.8ghz, 3GB of ram, gigabit ethernet
- Asterisk box (PBX) connected to gigabit switch
- 6 POTS lines through Verizon
- 10 Polycom SoundPoint 321
- 10+ Softphones
- Remote users accessing PBX via VPN
- ack instead of grep on the command line
- Asterisk 126.96.36.199, FreePBX 188.8.131.52, DAHDI 184.108.40.206, CentOS 2.6.18-274.17.1.el5 (`uname -r`)
Setting Up an Asterisk-Based VOIP System with Polycom Phones
Basic AsteriskNOW Installation Procedure
Duplicate IP Message on Polycom 321 Phones
This message was caused because of an old Microsoft 2003 Business server that was still connected to the network. DHCP used to be handled by the server, but we switched DHCP to the SonicWall. Although DHCP was disabled on the MS server, it seemed to be sending out some sort of broadcast that caused the phones (and only the phones!) to report a duplicate IP. Eliminating the MS server was the only solution that worked (all services relating to DHCP had been turned off on the server.
Updating Polycom 321 Firmware via TFTP
The Polycom devices support both FTP + TFTP configuration + boot loading. However, I was trying to simply the setup as much as possible and trivial FTP sounded a bit more simple. However, a TFTP server is not configured by default on an AsteriskNOW installation. To enable TFTP, first run `nano /etc/xinetd.d/tftp` from the command line and then change `disable = yes` to `disable = no`; save the file. Finally, run `service xinetd restart` from the command line. The TFTP server should be up and running.
The TFTP server does not have `ls` and other FTP-like commands. The easiest way to test if it is working is to grab a file from it from another machine:
tftp> get LoudRing.wav
Received 128810 bytes in 0.1 seconds
Sending Phone Boot Server via DHCP
Apparently there are many parameters you can send to clients via DHCP. DHCP was running on a SonicWall 210 in this specific configuration. I had a bit of trouble getting this working, but the following settings worked on the SonicWall for me:
- option 66: tftp://pbx.localhost
- option 160: tftp://pbx.localhost
- option 150: tftp://pbx.localhost
Upgrading the Polycom BootRom & Sip.ld (Application)
This was a bit tricky, and I did not document exactly how I got to it work, but here are some pointers. You’ll need to download “UC_Software_3_3_3_release_sig_split” the not the latest ”UC_Software_4_0_1B_release_sig_combined.zip” from Polycom support. Looking at the end point manager’s package.json it seems as though the latest supported version is 3.3.3. I tried downloading the split version but it didn’t seem to work as well for me. You’ll also need to download the latest BootRom ”spip_ssip_BootROM_4_3_1_release_sig.zip”. After downloading these pieces you’ll have to send them to your /tftpboot folder (I used `scp sip.ld email@example.com:/tftpboot` to move the files over). After putting the pieces in place, `ls -l /tftpboot` should look something like this:
-rw-rw-rw- 1 asterisk asterisk 2079 Feb 18 15:39 0004f2a8077e.cfg
-rw-rw-rw- 1 asterisk asterisk 7470 Feb 18 12:53 0004f2a8077e_reg.cfg
# ... (more configuration)
-rwxr-xr-x 1 asterisk asterisk 639624 Jan 27 14:27 2345-12360-001.bootrom.ld
-rwxr-xr-x 1 asterisk asterisk 3322061 Jan 27 14:41 2345-12360-001.sip.ld
-rwxr-xr-x 1 asterisk asterisk 7591196 Jan 27 13:45 bootrom.ld
drwxr-xr-x 2 asterisk asterisk 4096 Feb 18 14:34 contacts
drwxr-xr-x 2 asterisk asterisk 4096 Jan 26 14:59 licenses
drwxr-xr-x 2 asterisk asterisk 4096 Feb 18 12:53 logs
-rw-rw-rw- 1 asterisk asterisk 127966 Feb 20 14:30 LoudRing.wav
drwxr-xr-x 2 asterisk asterisk 4096 Feb 13 16:12 overrides
-rw-rw-rw- 1 asterisk asterisk 8537 Feb 20 14:30 sip.cfg
-rwxr-xr-x 1 asterisk asterisk 14 Jan 27 14:41 sip.ver
drwxr-xr-x 2 asterisk asterisk 4096 Jan 26 14:59 SoundPointIPLocalization
-rw-rw-rw- 1 asterisk asterisk 95926 Feb 20 14:30 SoundPointIPWelcome.wav
I’m not sure if you needed an updated bootrom.ld and the specific 2345-12360-001.bootrom.ld; but it worked.
Using End Point Manager to Generate Configuration XML for Polycom
In order to install End Point Manager I had to upload the module via the FreePBX Module Admin. For my installation (details given above) I used version 220.127.116.11 (list of .tar.gz versions can be found here, GitHub repo here. After installing, go to advanced options and set “Time Server” to “pool.ntp.org” and nmap to “/usr/bin/nmap” (you may have to install nmap via yum, I can’t remember if it was installed by default or not). If you are using TFTP, make sure that configuration option is set as well. I could not get the automatic phone vendor packages to work. I had to download the “provisioner_net.tgz” and manually upload the package via the “Manual Endpoint Modules Upload/Export” under “End Point Advanced Settings.”
At this point, with the DHCP options correctly set, for new phones you should be able to plug them into the network, run a scan using nmap, and add the phones via the end point manager GUI. Unplug & replug the Polycom phone in and it should pull the configuration from the TFTP server (the PBX box) set in the DHCP options and startup just fine.
Default “Phone Book” / Directory on Polycom
Although the phones claim to support loading the `000000000000-directory.xml` file into all phones; I could not get this to work even after factory resetting the phones. I grabbed the XML for the polycom directory by using this modified version of the printextensions module, copying the XML into the `000000000000-directory.xml` file, and then running this BASH script to copy the default to each of the phones custom directory.xml files. Do not use this with a production system as it will overwrite any users customizations.
Installing Git on CentOS (Default AsteriskNOW OS)
Yum is the default package manager on CentOS, but the default repos don’t contain git. I wanted to pull in my dotfiles to the Asterisk box as well as manage the custom print extensions repo that I was working on. Here are the two BASH lines you need:
yum install --enablerepo=webtatic git-all
Software vs Hardware High Performance Echo Cancellation (HPEC)
This is specific to Digium based cards. I didn’t know this until after purchasing the TDM800 with hardware echo cancellation, but after talking with an Digium customer support representative I learned that the algorithm used for echo cancelation is the same for the software based and hardware based echo cancellation. The CPU load on my installation hovers around 1%, I’m guessing for a < 20 person office environment the software based echo cancelation would of worked just fine (although I don’t have experiential evidence to support this).
Initially call logging did not work in my installation. You can check if call logging is configured correctly by running `asterisk -r` and then running `cdr show status` from the Asterisk prompt. You should see something like:
Log unanswered calls: No
* Registered Backends
If your installation is working correctly. Mine wasn’t, working off this guide, the following BASH commands worked for me:
yum list installed|ack mysql
# if they aren't, install the mysql addons
yum install asterisk18-addons-mysql
Digium Has Incredible Customer Support
I was throughly impressed by the quality of Digium’s customer support. They answered non-hardware related questions, ssh’d into my machine to debug some issues, and there was a less than one minute wait time.
Outbound Call Configuration
This was something that ended up being a bit more tricky that I thought. I ended up configuring the dial patterns to force long distance formatting (01+xxx+xxx+xxxx) on all numbers. I wanted to ability for people to dial with and without the 1, this seems to be working fine so far:
POTS Call Tuning
Different POTS lines have different levels and other ‘analog stuff’. To clear out noise and optimize your configuration you need to run the following script (retrieved from a Digium rep):
# tunes impendence on the analog lines
fxotune -x -i
# restart dahdi and start asterisk
service dahdi stop && service dahdi start
service asterisk start
Setting up IVR Auto Answer
Configure your IVR, then go to Setup –> Inbound Routes. Choose “any DID / any CID”. At the bottom of the page switch “Destination” to IVR + desired auto attendant.
I usually login to the Asterisk box as root. I configured the backups with my root SSH key, but the Asterisk backup process runs on the Asterisk user. Make sure that the SSH keys you hand off to FreePBX are readable by the asterisk process.
Inbound + Outbound Call Volume Tuning
Word of warning: I haven’t actually done this yet. These are the notes I’ve compiled, but I wasn’t able to get all this information together before the phone system was deployed.
Most of the guides I was able to find were a bit out of date. When reading through those resources recall that Dahdi is the new Zaptel. There are two gain adjustments: inbound (rxgain) and outbound (txgain). In order to test the levels run the following command: dahdi_monitor 1 -vv. These levels can be calibrated against a 102 milliwat test number, I found one here: 670-234-0102.
For the TDM800, here are the instructions from Digium on how to edit the two gain levels:
The gains are typically edited in /etc/modprobe.d/dahdi.conf. The parameters are set like:
options wctdm24xxp fxotxgain=<value>db fxorxgain=<value>db fxstxgain=<value>db fxsrxgain=<value>db
The default value is -4.5db (decibels)
They can also be edited in /etc/asterisk/chan_dahdi.conf
In this case the ‘db’ is assumed by asterisk. In chan_dahdi.conf the default value is 0.0.
We encourage you to make small changes to any of these values as it can dramatically effect your audio.
- If calls are dropping after a couple seconds, check your external IP in Tools –> Asterisk IAX Settings
- Uninstalling Asterisk modules:
/var/lib/asterisk/bin/module_admin uninstall endpointman
- The Music on Hold directory is
- Grabbing the DAHDI version from the command line:
- To add a invalid extension or timeout fallback to your IVR / autoattendant add two options in the IVR GUI: i & t (you specify i or t instead of a number) and then specify a action just like you would a normal IVR option.
- Restart DAHDI & Asterisk in one line:
service asterisk stop && service asterisk start && service dahdi stop && service dahdi start
- Copy default directory.xml to specific directory.xml’s for all Polycom devices linked to the EndPoint Manager
- Location of HPEC license(s):
- Convert standard wav files into Asterisk / POTS compatible wav:
sox autoattendant.wav -r 8000 -c 1 -s -w auto-new.wav resample -ql
- Caller ID is not consistent across carriers. Some carriers can disregard caller ID information altogether.
- I had trouble with the built-in Polycom phone restart script contained in the endpoint manager. I wrote a quick script to work with someone’s Polycom restart script as a workaround.
- I originally tested the system on an XP100 clone card, and I’m pretty sure that was the source of this issue, but this information was helpful in temporarily resolving that issue before I purchased the TDM800.
- FXO hardware’s context must be set to “from-pstn” for the IVR to be routed correctly
- If all your inbound calls are coming in as “Unknown” you might want to check with your service provider. According to my Verizon account rep, inbound calls can sometimes come in as Unknown on new lines if your account is configured incorrectly
- Dashes and parentheses outbound numbers inputted into softphones seems to cause issues with dialplans
- You can export Asterisk compatible .wav files directly from Audacity without using any command line tools to post-process the audio.
- To reset a Polycom 321 phone, reboot the phone and hold 1 + 3 + 5 + 7. The default admin password on these devices is 456.
- In order to enable the “Line 2″ button on the polycom phones you’ll need to edit the master configuration file and change the “reg.1.lineKeys” preference to “2″
Here is a list of links I found helpful while researching this stuff.
- 10/2011 – Provisioning Polycom SoundPoint IP 321 Phones – Elastix / Trixbox
- 09/2010 – Auto Re-Provisioning Polycom Phones
- 06/2008 – Upgrading Firmware on Polycom Phones
- (old) How to Update Polycom IP Phone Firmware via FTP
- 01/2009 – DHCP Option 66 & Asterisk
- 08/08 – TFTP Server Issues
- Example /tftpboot Directory
- 09/09 – Using PolyCom Phones with Asterisk
- 09/2011 Fighting echo on POTS
- Asterisk Guru (great guide on misc Asterisk setup)
- Music on Hold Setup Slides
- Asterisk Blog (some tips & tricks)
- DAHDI Manual
- Asterisk Setup Guide (great resource) and Asterisk Notes
- General Asterisk Blog (some interesting tips & tricks)
- Documentation for TDM800 and Digium Knowledge Base
- Reza Samimi’s Blog (incredible resource, probably the most helpful thing I was able to find)
- Team Forrest Blog
- Online Asterisk Book
- Creating an IVR (auto-attendant)
- How To Configure Asterisk
- General Information on Asterisk Backups
- Print Well Formatted Extension + Feature Code Lists
- Polycom directory.xml Script
- Blink - Mac VOIP client. Paid.
- X-Lite – Mac + PC VOIP client. Free with ads or Paid.
- Telephone.app – Mac VOIP client. Really simple, integrates with address book + growl. However, it seemed to ‘drop’ its connection to the Asterisk server (people would call the extension and it would respond as busy despite the fact that the Telephone.app was on)