Cisco 7960G IP Phone on Asterisk
Flickr Error ( ): PhotoID 3354896600
This is a quick overview of the steps you will need to follow in order to get a Cisco 7960G working with an Asterisk server. The phone must use the SIP firmware for this to work and the instructions below will hopefully get you up and running in no time. This assumes you have already got a working a fairly well configured Asterisk server and a reasonably good understanding of VOIP and SIP.
- Asterisk - You will need to download and compile Asterisk and get it up and running before anything else. This is outside of the scope of this document but I followed this excellent tutorial and had everything configured in no time. I skipped the ODBC, PhpMyAdmin, Webmin and also omitted most of the MySQL config.
- Cisco 7960G - You can pick up a new Cisco 7960G for around £200 at the time of writing, however eBay is a good source too and I picked mine up there for £57.50 including delivery, power cube, brand new, still in the box, fresh as a daisy. Try this eBay search which will also bring up the near-identical 7940 which is similar to the 7960 but has less lines. This tutorial should work with both types of phone with minimal tweaking, but it has been written for the 7960. Also note that these phones don't usually come with a power adapter as they're intended to be used with PoE.
- DHCP - By far the easiest way to configure the phones IP address is via DHCP, make sure you have a fully working DHCP server before continuing.
- TFTP Server - The phone picks its firmware and configuration up from a tftp server and you'll therefore need to have one on your LAN for this to work.
- About an hour - Hopefully this page will mean you take a lot less than an hour, but it took me a couple of hours of digging around to get everything configured properly, brew a large pot of coffee.
You will need your DHCP server to be able to tell the phone where the tftp server is that will be holding the config files for the phone, to do this you need to add an entry for DHCP option 150. If, like me, you're using dnsmasq then the following line will need to be added to your /etc/dnsmasq.conf:
That's it, restart dnsmasq with `/etc/init.d/dnsmasq restart` and you're done.
As I'm using CentOS 5.2 I was able to install tftp straight from yum:
yum install tftp-server
You'll then need to `vim /etc/xinetd.d/tftp` and change the disable line from 'yes' to 'no'. Give xinetd a restart for good measure with `/etc/init.d/xinetd restart`. The default configuration is for /tftpboot to be the root directory, this is where we will be putting all our files needed to boot and configure the phone.
The logs for the tftp server will go to /var/log/messages by default, during the following it will be useful to keep an eye on these as it lets you know exactly what files your phone is attempting to download - this could help you diagnose quirks where your phone looks for different files to the ones in this page. I suspect Cisco have helpfully kept us on our toes by changing the file names they look for throughout different versions of the firmwares...
grep tftp /var/log/messages
I spotted on a number of sites that the SIP firmware is/was available from Cisco to download, however with my basic registration on the Cisco site I was unable to download the correct firmware, maybe you'll have more luck...
A Google query just like this helped me find a copy of the latest firmware.
cd /tftpboot wget http://www.someserver.com/P0S3-08-11-00.zip [root@kermit tftpserver]# unzip -j P0S3-08-11-00.zip Archive: P0S3-08-11-00.zip extracting: OS79XX.TXT inflating: P003-08-11-00.bin inflating: P003-08-11-00.sbn inflating: P0S3-08-11-00.loads inflating: P0S3-08-11-00.sb2 [root@kermit tftpserver]# ls -al total 1704 drwxr-xr-x 2 root root 4096 Mar 14 18:33 . drwxr-x--- 17 root root 4096 Mar 14 18:32 .. -rw-r--r-- 1 root root 16 Jan 28 14:58 OS79XX.TXT -rw-r--r-- 1 root root 130548 Jan 28 14:58 P003-08-11-00.bin -rw-r--r-- 1 root root 130952 Jan 28 14:58 P003-08-11-00.sbn -rw-r--r-- 1 root root 463 Jan 28 15:08 P0S3-08-11-00.loads -rw-r--r-- 1 root root 756388 Jan 28 14:52 P0S3-08-11-00.sb2 -rw-r--r-- 1 root root 685408 Mar 14 18:32 P0S3-08-11-00.zip
This should leave you with a directory containing the firmware files for the phone and we're now ready to start creating the config files which the phone will use.
Create The Config Files
First we need to create a couple of xml config files which will help the phone boot and load the SIP firmware from the server. Find the MAC address of your phone either by navigating through the on-screen menus within the phones firmware, by looking at the little sticker underneath the phone or poking through the DHCP servers logs. You'll need to create a corresponding config file with the phones MAC address, ie: SEP0014A8C0FFEE.cnf.xml with the following content:
<device> <loadInformation model="IP Phone 7960">P0S3-08-11-00</loadInformation> </device>
Next we create another XML config file which will allow the phone to boot the latest firmware version, due to some quirks in the Cisco firmware there are a number of different names that the file may need to be called, I got around this by creating a file called xmlDefault.CNF.XML and then hard linking it to XMLDefault.cnf.xml which is another possible name for the file. I'm not clear whether this is a duplicate of the previous config file, but a combination of the two seemed to be required to get the phone booted.
touch xmlDefault.CNF.XML ln xmlDefault.CNF.XML XMLDefault.cnf.xml vim xmlDefault.CNF.XML
And then add the following;
<Default> <callManagerGroup> <members> <member priority="0"> <callManager> <ports> <ethernetPhonePort>2000</ethernetPhonePort> <mgcpPorts> <listen>2427</listen> <keepAlive>2428</keepAlive> </mgcpPorts> </ports> <processNodeName></processNodeName> </callManager> </member> </members> </callManagerGroup> <loadInformation7 model="Cisco 7960">P0S3-08-11-00</loadInformation7> <authenticationURL></authenticationURL> <directoryURL></directoryURL> <idleURL></idleURL> <informationURL></informationURL> <messagesURL></messagesURL> <servicesURL></servicesURL> </Default>
The next file we need is the SIPDefault.cnf, this is the config file which holds the common config options relating to all your SIP phones, in my case, just the one. it's contents look something like this:
image_version: P0S3-08-11-00 proxy1_address: "192.168.254.253" ; Can be dotted IP or FQDN proxy2_address: "" ; Can be dotted IP or FQDN proxy3_address: "" ; Can be dotted IP or FQDN proxy4_address: "" ; Can be dotted IP or FQDN proxy5_address: "" ; Can be dotted IP or FQDN proxy6_address: "" ; Can be dotted IP or FQDN proxy_register: 1 messages_uri: "1" phone_password: "cisco" ; Limited to 31 characters (Default - cisco) sntp_mode: unicast sntp_server: "192.168.254.254" time_zone: "GMT" ; assuming you're in GMT time_format_24hr: 1 ; to show the time in 24hour format date_format: "Y/M/D" ; format you would like the date in dial_template: dialplan
Pay attention to the image_version line which must point to the P0S3 file rather than the P003 file. proxy1_address is the IP address of our Asterisk server.
SNTP server should point to a valid NTP server on your LAN, (ntpd supports the SNTP protocol too, so that will be fine). If you get an "E102 MISC Error: No time server" then the time server config is incorrect, some SIP firmware versions require using the server address in dotted decimal form, rather than via hostname. If the SNTP server is invalid you won't see the time and date in the top left of the phones screen (in my screenshots above, it's broke!).
dial_template should point to a dialplan.xml file, which we'll address later on.
We now need to create a config file which will hold the specific config options relating to a given phone. This is done by giving the config file the name of the MAC address of the phone so it can be searched for when the phone boots. The contents of my file look like this:
image_version: P0S3-08-11-00 line1_name: 1260 line1_authname: "1260" line1_shortname: "Line 1" ; displayed on the phones softkey line1_password: "secret" line1_displayname: "John Baxendale"; the caller id proxy1_port: 5060 proxy1_address: 192.168.254.253 # Line 2 Setup line2_name: 1261 line2_authname: "1261" line2_shortname: "Line 2" line2_password: "secret" line2_displayname: "John Baxendale"; # Phone Label (Text desired to be displayed in upper right corner) phone_label: "Siftah.net " ; add a space at the end, looks neater phone_password: "cisco" ; Limited to 31 characters (Default - cisco) user_info: none telnet_level: 2 logo_url: "http://kermit/asterisk-tux.bmp"
Most of this file is self explanatory, pay attention to the image_version line which must reference the SIP firmware and therefore will begin P0S3 rather than P003, I think I got this wrong at first and spent a while faffing about before I finally got the phone to boot properly. The logo_url: line isn't required but can be used to point the phone to a different logo file hosted on a webserver somewhere. I also got caught out by the "line1_name:" lines, these seem to cause an error if there is a space in the name, whether it's enclosed in quotes or not.
The default behaviour for the phone is to only start dialling a number 5 seconds after you've typed it. This is a bit of a long delay and so you amend this to dial a number straight away when a certain format is used, my config is below but you may wish to tweak this to suit:
<DIALTEMPLATE> <TEMPLATE MATCH="12.." TIMEOUT="0"/> <TEMPLATE MATCH="1" TIMEOUT="0"/> <TEMPLATE MATCH="500" TIMEOUT="0"/> <TEMPLATE MATCH="9..........." TIMEOUT="0"/> </DIALTEMPLATE>
My local extensions are all 12**, ie: 4 digits long and beginning with 12. I have my voicemail set up on 1.
One of the coolest things you can do with your new Cisco phone is to give it the same ring that Jack Bauer has, this is easily accomplished... Create a new subdirectory at the root of your tftpserver and download some ringtones into it.
cd /tftpboot mkdir ringtones
And now you'll need to wget some ringtones into this directory, I'd suggest this Google link will find you what you want! Then create your RINGLIST.DAT file with contents in the following format, pointing to the name of the files you've downloaded, eg:
The audio files can be the following spec 8000 Hz sampling rate, 8 bits per sample, ulaw compression and 240 - 16080 samples long ( 0.03 sec - 2.01 sec ) according to this page
After all that, configuring Asterisk itself is actually one of the simplest bits of the whole ordeal. Just a simple entry into sip.conf and extensions.conf and you're golden.
We just need to add a couple of definitions for a SIP extension in sip.conf, nothing different to any of your other entries is needed for the Cisco phones as they are just another SIP client as far as Asterisk is concerned:
 type=friend host=dynamic dtmfmode=rfc2833 nat=no username=1260 secret=secret context=home canreinvite=no callerid="John Baxendale"  type=friend host=dynamic dtmfmode=rfc2833 nat=no username=1261 secret=secret context=home canreinvite=no callerid="John Baxendale"
Note that my context is `home` for my local network, yours maybe `default` or `internal` depending on which tutorial you followed :)
And finally an entry in extensions.conf which could look something like this:
exten => 1260,1,Dial(SIP/1260) exten => 1261,1,Dial(SIP/1261)
or maybe this:
exten => 1260,1,Macro(voicemail,SIP/1260) exten => 1261,1,Macro(voicemail,SIP/1261)
Again depending on who's tutorial you followed :)
If you have problems...
I struggled to get this working for a while after following a few bits of tutorial from around the net, one of the key things which helped me work it out was when I managed to telnet into the phones IP address and run "debug config" to see what was going wrong.
Another useful command is "show config" which will give a full print out of all the current config options and what they're set too.