General

Brief notes on Asterisk and Cisco SPA5xx phones

Sipura, then Linksys, then Cisco, makes beautiful SIP phones. Under the new “Cisco Small Business Pro” line, Cisco sells the SPA5xx phones, which have great interaction with an Asterisk IPBX.

There’s an official, supported method for zero-touch configuration of SPA5xx phones with Asterisk. You need, of course, access to the DHCP server, the TFTP server and the IPBX. In my case, there’s no such thing as zero-touch since my client works on a separate VLAN, which I need to manually input on the phone. Of course, I could also send the phones a bogus configuration file stating the new VLAN, they’ll reboot and voila.

Anyway, as with any Cisco phone, this configuration file is an ugly XML one, but it’s a flat-profile on SPA5xx phones, so you can use awk, grep, sed and whatever without XML parsing if you need to build yours.

Better yet, you can get a “sample” XML configuration file by calling a GET method on the embedded web server of the SPA5xx phones, say:

curl http://10.1.1.254/admin/spacfg.xml

Once you have this file, it’s just a matter of substituting the needed variables. Here’s a brief provision script which finds for #TAGS# inside a demo XML file:

EXTENSION=$1STATIONNAME=$2MAC=$3SHORTNAME=$STATIONNAMEDISPLAYNAME=$STATIONNAMEsed "s/#EXTENSION#/$EXTENSION/" spacfg.xml > spa$MAC.xmlsed -i "s/#STATIONNAME#/$STATIONNAME/" spa$MAC.xmlsed -i "s/#SHORTNAME#/$SHORTNAME/" spa$MAC.xmlsed -i "s/#DISPLAYNAME#/$DISPLAYNAME/" spa$MAC.xml

using, say:

<Station_Name group="Phone/General">#STATIONNAME#</Station_Name><Short_Name_1_ group="Phone/Line_Key_1">#SHORTNAME#</Short_Name_1_><Display_Name_1_ group="Ext_1/Subscriber_Information">#DISPLAYNAME#</Display_Name_1_><User_ID_1_ group="Ext_1/Subscriber_Information">#EXTENSION#</User_ID_1_>

Of course, files need to be named spa$MAC.xml, be located on /var/lib/tftpboot/xml, or wherever your TFTP server desires to serve the files under an xml/ directory, or where the spa502G.cfg file says. I could remotely configure a dynamic LDAP directory, feature codes, dial plans, remote syslog and codec information using these XML files. But you can also write an static Directory using GET and POST (it’s called “Personal Directory”) automatically if you use FreePBX, see this code.

Ah, just call /admin/restart on each phone to reboot the phones. If you are now bitten by the beauty of standards-compliant, well documented SPA5xx phones, the resources under MyCiscoCommunity will be of great help. Look for the Asterisk Zero Touch Configuration Guide, the Provisioning Guide and the Admin Guide.

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s