One of my projects at home has involved trying to get a variety of telephony systems to work together so that I can make voice over IP (VoIP) or plain old telephone service (POTS) as necessary to get the best call rates. In truth, it’s probably not about getting the best rates as our phone bill is already pretty small – maybe it’s just because the geek inside me wants to get an IP phone working on my desk… anyway, I still have a few pieces of the puzzle to fit in place but last week I had a major breakthrough in getting a Cisco IP phone to provide a voice over IP (VoIP) service using SIP. It was a long haul, but worth it in the end – and this is how it’s done…
First of all I needed an IP Phone. I managed to pick up a brand new 7940G for £50 on eBay (a bargain) and this was perfect for me. Why a Cisco phone? Partly because we use them at work (so I know they are good phones – and I like the form factor – although I wish it had a backlit screen) but mostly because there are so many of them about – that means that plenty of people have tried to do this and there is information available on the web. Using a Cisco phone does cause a couple of problems though:
- The standard protocol used for VoIP is session initiation protocol (SIP) and Cisco IP phones don’t use SIP natively. Cisco has it’s own IP Telephony system (Call Manager) which uses SCCP; however they do provide SIP firmware for their 79xx IP phones.
- Some of the Cisco documentation and software is only available with a service contract and generating configuration details can be a challenge if you don’t have access to a Cisco Call Manager solution – thankfully everything I used for this is available on the ‘net through a variety of websites that are aimed at getting people up and running with VoIP solutions.
It’s also worth knowing that there are two types of configuration file for Cisco IP Phones:
- The 79x0 models use a fairly simple configuration file.
- The 79x1 models use an XML configuration, which is all very well if you have access to a Cisco Call Manager solution but not so well documented if you don’t.
I found that the 7940 is a good model to go for as it has been around for a while, there is plenty of information available, and it can be picked up for a reasonably low price (and it helped to know that one of my colleagues already had this solution working well for him!). The 7960 is similar but with support for more lines and there are other models available (e.g. cordless phones, or phones with colour screens). In addition, Linksys (owned by Cisco) sells some similar phones that do run SIP natively but I don’t know if they use the same firmware.
After choosing the phone there were a couple of other considerations:
- Cisco IP Phones are designed to draw power from the network infrastructure using power over Ethernet (PoE). I bought the appropriate power adapter from broadbandbuyer.co.uk as I use a low-cost NetGear switch which does not provide PoE.
- Configuration files are provided to the phone by TFTP. I used Philippe Jounin’s excellent TFTP32 and set my DHCP server to provide a TFTP server address to client devices (DHCP option 66).
With the phone powered on and able to download a configuration, I uploaded the necessary configuration files to the TFTP server. Cisco Document ID: 5455 – Converting a Cisco 7940/7960 CallManager Phone to a SIP Phone and the Reverse Process gives details of the required files but the main ones to know are:
- OS79XX.TXT – tells the phone which firmware to use.
- SIPDefault.cnf – configuration information relevant to all phones.
- SIPmacaddress.cnf – configuration information relevant to a specific phones.
Other files that I have include:
- RINGLIST.DAT – Lists audio files that provide the custom ring types.
- CTU.raw – an audio file referenced by RINGLIST.DAT.
- dialplan.xml – a dialplan.
- Various firmware images named as follows:
- P003x-xx-x-00.bin – universal application loader for upgrades from images earlier than 5.x.
- P003x-xx-x-00.sbn – secure universal application loader for upgrades from images 5.x or later.
- P0y3x-xx-x-00.loads – universal application loader and application image, where y represents the protocol of the application image (.loads) file: 0 for SCCP, and S for SIP.
- P0y3x-xx-x-00.sb2 – application firmware image, where y represents the protocol used by the image: 0 for SCCP, and S for SIP.
With all the necessary files available on the TFTP server, I set about upgrading the firmware to the latest SIP release by editing the OS79XX.TXT file to read
P0S3-08-2-00 and resetting the phone. The TFTP server log told me that the phone picked up the appropriate firmware release, but that it couldn’t find one of binary images (P0S3-08-2-00.bin)
After some research, it seems that POS3-08-x-00.bin does not seem to exist for any 8.x firmware:
Versions [6.x] and [7.x] seem to have P0S3-0x–xx-00.BIN files which make it easy when upgrading from SCCP to SIP as all you have to do is rename the file it loads in OS79XX.TXT to one of these *.BIN files and its all done straight to SIP.
With version 8 series it doesn’t have these and that forces you to upgrade it in a 3 part reboot and load phase with[:]
That loads the *.loads file then it loads *.sbn and reboots
After warm reboot it loads *.sb2 which must be the sip software.
Then reboots again starting in sip and then provisions with[:]
Armed with this new information, I put the 7.4 SIP firmware into my TFTP root folder, edited OS79xx.TXT to read
P0S3-07-4-00 and created an xmlDefault.CNF.XML file.
After booting the phone I was pleased to see a message that said Upgrading software but that pleasure soon ended as the upgrade never completed. Thankfully I hadn’t “bricked” the phone and, after another reboot, the phone showed a message which said Load ID Incorrect. The TFTP logs indicated that the phone was trying to load a file called SEPmacaddress.cnf.xml.
Googling turned up some more information and it turned out I was trying to go too far in one jump – my phone had been supplied with v3.x SCCP firmware and I was trying to go straight to v7.x firmware:
You have to upgrade to a new version of SCCP or older version of SIP before the bootloader on the phone will be able to handle the newer firmware […] you can either use an older version of SIP first, or a newer version of SCCP. Older SIP is probably easier – 6.3 is the newest you can use to then jump to 7.x and/or 8.x.
I put the v6.3 firmware on my TFTP server, edited OS79XX.TXT to read
P0S3-06-3-00 and rebooted the phone. This time I saw the Upgrading Software message and watched the transfer take place.
After rebooting itself the phone came back up on the v6.3 firmware and was showing itself as Phone Unprovisioned.
I set about the second stage upgrade to v8.2 by editing OS79XX.TXT to
P0S3-08-2-00 and rebooting the phone again. That didn’t help, but a further OS79XX.TXT edit from
P003-08-2-00 did the trick as the Universal Application Loader booted.
Despite attempting to read non-existent files called CTLSEPmacaddress.tlv and SEPmacaddress.cnf.xml (the Cisco 7940 and 7960 IP Phones Firmware Upgrade Matrix explains the hunt algorithm employed by the Universal Application Loader) the phone downloaded the appropriate files and restarted to return as an unprovisioned device, finally running the v8.2 SIP firmware.
By this point, the TFTP logs were not much help as they didn’t indicate any errors but the status message on the phone gave me more clues:
W350 unprovisioned proxy_backup
W351 unprovisioned proxy_emergency
W362 No Valid Line Names Provisioned
The unprovisioned backup and emergency proxies didn’t bother me but I couldn’t understand why I had no valid lines provisioned. I had been trying to get the phone to use my Linksys SPA3102 as a SIP proxy but something was not quite right. In the end, I gave up and registered with SIPgate. After updating my configuration files to reflect the SIPgate account details, my phone picked up a valid line but couldn’t make or receive calls. Following advice on the SIPgate website, I made sure that the following ports were all open:
- Port 5060 (UDP) – for connecting to the SIP proxy server.
- Port 5004 (UDP) – SIP signalling.
- Ports 8000-8019 (UDP) – for voice communication.
- Port 10000 (UDP) – for communication with the simple traversal of UDP over network address translators (STUN) server.
- Port 3478 (TCP and UDP) – also for STUN.
I’m not sure if all of these are strictly necessary but they seem to have got things working. The final contents of my configuration files are detailed below, after the TFTP log from a successful boot:
Connection received from ipaddress on port 50967 [25/07 00:41:32.672]
Read request for file <CTLSEPmacaddress.tlv>. Mode octet [25/07 00:41:32.672]
File <CTLSEPmacaddress.tlv> : error 2 in system call CreateFile The system cannot find the file specified. [25/07 00:41:32.672]
Connection received from ipaddress on port 50968 [25/07 00:41:32.703]
Read request for file <SEPmacaddress.cnf.xml>. Mode octet [25/07 00:41:32.703]
File <SEPmacaddress.cnf.xml> : error 2 in system call CreateFile The system cannot find the file specified. [25/07 00:41:32.703]
Connection received from ipaddress on port 50969 [25/07 00:41:32.719]
Read request for file <SIPmacaddress.cnf>. Mode octet [25/07 00:41:32.719]
Using local port 1203 [25/07 00:41:32.719]
<SIPmacaddress.cnf>: sent 2 blks, 632 bytes in 0 s. 0 blk resent [25/07 00:41:32.735]
Connection received from ipaddress on port 50970 [25/07 00:41:32.766]
Read request for file <P0S3-08-2-00.loads>. Mode octet [25/07 00:41:32.781]
Using local port 1204 [25/07 00:41:32.781]
<P0S3-08-2-00.loads>: sent 1 blk, 461 bytes in 0 s. 0 blk resent [25/07 00:41:32.781]
Connection received from ipaddress on port 50962 [25/07 00:41:54.672]
Read request for file <SIPDefault.cnf>. Mode octet [25/07 00:41:54.672]
Using local port 1205 [25/07 00:41:54.672]
<SIPDefault.cnf>: sent 2 blks, 925 bytes in 0 s. 0 blk resent [25/07 00:41:54.688]
Connection received from ipaddress on port 50963 [25/07 00:41:54.813]
Read request for file <SIPmacaddress.cnf>. Mode octet [25/07 00:41:54.828]
Using local port 1206 [25/07 00:41:54.828]
<SIPmacaddress.cnf>: sent 2 blks, 632 bytes in 0 s. 0 blk resent [25/07 00:41:54.828]
Connection received from ipaddress on port 50967 [25/07 00:41:56.891]
Read request for file <RINGLIST.DAT>. Mode octet [25/07 00:41:56.891]
Using local port 1207 [25/07 00:41:56.891]
Connection received from ipaddress on port 50974 [25/07 00:41:56.907]
<RINGLIST.DAT>: sent 1 blk, 15 bytes in 0 s. 0 blk resent [25/07 00:41:56.907]
Read request for file <dialplan.xml>. Mode octet [25/07 00:41:56.907]
Using local port 1208 [25/07 00:41:56.907]
<dialplan.xml>: sent 1 blk, 104 bytes in 0 s. 0 blk resent [25/07 00:41:56.907]
date_format : D/M/Y
# NAT/Firewall Traversal
nat_enable: 1 ; 0-Disabled (default), 1-Enabled
nat_address: “” ; WAN IP address of NAT box (dotted IP or DNS A record only)
voip_control_port: 5060 ; UDP port used for SIP messages (default – 5060)
start_media_port: 8000 ; Start RTP range for media (default – 16384)
end_media_port: 8012 ; End RTP range for media (default – 32766)
nat_received_processing: 0 ; 0-Disabled (default), 1-Enabled
phone_label : “markwilson.it ” ; Has no effect on SIP Messaging
line1_name : “sipgateid” ; SIPgate device ID#
line1_authname : “sipgateid” ; SIPgate device ID#
line1_password : “sipgatepassword” ; SIPgate device password
line1_shortname : “phonenumber”
line1_displayname : “phonenumber”
proxy1_address : “sipgate.co.uk”
proxy1_port : 5060
proxy2_address : “”
proxy2_port : 5060
Here are some of the sites that I found particularly useful as I went through this process:
- Reset a Cisco 7940 IP Phone to factory defaults.
- Cisco Document ID: 5455 – Converting a Cisco 7940/7960 CallManager Phone to a SIP Phone and the Reverse Process.
- Cisco Document ID: 16049 – Technical Support IP Phone FAQ.
- Cisco IP Phone 7960/7940 User Guide for SIP.
- Cisco SIP IP Administrator Guide, Version 8.0.
- Cisco 7940 and 7960 IP Phones Firmware Upgrade Matrix.
- SIPfoundry: HowTo configure Cisco SIP phone with sipX (most of the information applies to any SIP configuration).
- VoIP Info: Configuring Cisco 79xx phones with Asterisk (most of the information applies to any SIP configuration).
- VoIP Info: Firmware issues on 7940-7960.
[update 10 September 2009: Here’s another useful resource on how to set up a cisco 7940 and 7941 IP phone to do SIP.]
[update 27 March 2010: Tyler Winfield’s article on configuring Cisco IP phones with Asterisk is very thorough and easy to read – even if you’re not using Asterisk.]