Patching Asterisk 11 for Cisco phones
Steps in this document end up modifying the version of Asterisk provided FreePBX. You assume all risks herein and will no longer be able to use upgrade scripts without breaking functionality. You will have to get upgrades manually and apply them manually.
Some people like Cisco handsets, some people don't. If you fall into the first category then you may be pleased to hear that they can work very well with an Asterisk system, no Cisco Unified Call Manager required. They actually work better in some areas when driven by Asterisk. And of course, in other areas... not so well.
There's an amount of work to be done to get here, and hopefully there is enough information here to help you on your way.
To get the most out of these phones, Asterisk needs a patch applied from http://usecallmanager.nz
This is the old version of this document, and is for use with Asterisk 11 only.
Everything in this document has been tested on a clean install of FreePBX and confirmed working with the following specific versions:
Cisco firmware 11-0-1-11 for the 8800 series
Cisco firmware 9.4.2-SR2-2 for the 9900 series
Asterisk 11.21-2
cisco-usecallmanager-patch 11.21-2
FreePBX 13 distribution
- 1 About this document
- 2 Prep-work
- 3 Patching Asterisk
- 4 Getting the firmware
- 5 Configuration files
- 5.1 Device
- 5.2 featurepolicy.xml
- 5.3 softkeys.xml
- 6 Asterisk settings
- 6.1 extensions_custom.conf
- 6.1.1 notes
- 6.1.1.1 Adhoc call recording
- 6.1.1.2 blocking video
- 6.1.1 notes
- 6.2 sip_custom_post.conf
- 6.3 extensions_override_freepbx.conf
- 6.4 sip_notify_custom.conf
- 6.5 very optional extras
- 6.1 extensions_custom.conf
- 7 Unsolved
- 8 Thanks
About this document
All of the notes here are based on my research, drawing on the works of others and many (many) hours of trial and error. Everything here has been tested by building a new FreePBX server and following these instructions to end up with a working solution.
Where files are provided, the first line in each is a commented out line in the relevant language, showing the name apportioned to that file.
This is not intended to be an exhaustive investigation into the workings of these devices, it does not answer every question that could be asked, or deal with every possible configuration of the systems; it provides a working template from which further work can be done by the user if desired. When I started working with these devices I was unable to find a source of information that provided that, so I made one.
Prep-work
To start, you will need a FreePBX installation, working and updated. Deploy the current version and select Asterisk 11 at installation. Once it's running, register and update all the modules (if necessary).
Important: The Cisco phones use TCP only, so add tcpenable=yes to the SIP Settings of FreePBX. When you add Cisco extensions, set the Transport to TCP-Only.
Make an extension for one of your cisco handsets, and run into the first gotcha. By default, FreePBX will create a random SIP password for you, those passwords are too long for the Cisco phones, I didn't yet trial-and-error out the maximum length, I just deleted half of the password and that worked. Even at half the length of the auto one, it's still plenty secure.
With the install running, and an extension ready, it's time to patch asterisk itself, and then create the config files for the phone.
Once the configuration files have been made, plug in a handset and let it boot, it will pick up all the settings and should register correctly. Ensure the DHCP server is offering a 150 response pointing to the FreePBX server so the phone can find the tftpboot service.
Patching Asterisk
Time to get your hands dirty. FreePBX does not come with the Asterisk source files but they do have source RPMs available that contain pretty much everything you need. The patch process is simple enough:
SSH into the FreePBX box as whatever user you use for this purpose, I'll select root for this document.
First, configure the build environment:
yum install epel-release
yum install mISDN-devel
yum install rpm-build
yum groupinstall "Development Tools"
yum remove epel-release
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
Now download the FreePBX SRPM and the patch. We also download mISDNuser, it makes building Asterisk easier if this is available. The filenames here are current at time of writing but you should check for newer ones as appropriate. The Asterisk version and the patch version *must* match.
cd ~/rpmbuild/SOURCES
wget http://download.opensuse.org/tumbleweed/repo/src-oss/suse/src/mISDNuser-2.0.19-1.5.src.rpm
wget https://issues.asterisk.org/jira/secure/attachment/53565/cisco-usecallmanager-11.21-2.patch
wget http://yum.freepbxdistro.org/pbx/SRPMS/asterisk/11/asterisk11-11.21.2-1.shmz65.1.104.src.rpm
Then it's just a case of unpack the files, tell FreePBX about the new patch, compile the files and install them:
And that's it! Reboot the server to make sure everything is settled in and you should be left with a working version of Asterisk 11 and FreePBX with the Cisco patches included.
Getting the firmware
Three files are needed directly from Cisco. To download them, you need a Cisco login, which for basic levels, is free.
You need the firmware files for your phone, the user locale and the network locale. Check the website linked earlier for some decent instructions on how to get and use those files. In fact, spend some time reading everything else on that site while you're at it.
Put the newly extracted files into /tftpboot
Configuration files
Device
Each phone must have a complete configuration file, they don't use templates in the way other SIP phones do. The file is lengthy, so I have added comments inline rather than explaining here. Don't simply copy/paste the file, look for the comments and adjust values as necessary. The shown file is for a phone with a MAC address of 1234567890 and configured as extension 102 for a server at pbx.domain.internal with a password of StrongPassword. It provides a BLF linekey, a DND linekey and an ad-hoc recording button.
You can use a file named XMLDefault.cnf.xml and provide a minimal version of the config so as to get a firmware onto the phone, but I've not bothered.
The file is named with the prefix of the type of phone, these devices use 'SEP' followed by the mac address of the phone with no separators and in uppercase, and has a .cnf.xml extension. As such, these files are known as SEPMAC config files, or variations on that theme.
Each config file has a <versionStamp> key, it contains a version 1 UUID. The phone uses this to recognise a changed file and it will extract the timestamp from the one in the main file to show a 'last configured' value.
The config files should be made for each phone, and placed in the /tftpboot folder of the FreePBX server.
When the phone loads the config file, it is checked for errors and the phone will refuse the file if errors are found, it will not however give any indication of where those errors may be. The file shown here *works* but there is many reasons why is may not be *perfect*. An excellent breakdown of the various sections is available, again at http://docs.acsdata.co.nz/asterisk-cisco
```
featurepolicy.xml
The 9900 series prefers to use the feature policy file to control the softkeys at the bottom of the display, but can be instructed to use a softkeys.xml file instead
Some of the available button options are rather Cisco in nature, and I did not find much value in having them available to the users. Fewer options seemed to be the path to success here.
As such, this file is small and provides only a few buttons:
pickup: answer a ringing phone in your ringgroup
redial: dial the last completed number
divert: used for incoming calls, rejects the call and sends to voicemail (if voicemail is configured for that phone, otherwise it terminates the call)
QRT: Quality Reporting Tool. If pressed during a call, this will send some debugging info back to Asterisk when the call completes, this can be seen on the console or in the logs.
Again, more details on what this file can provide can be found at the site linked in the introduction.
softkeys.xml
The 8800 series did not read the featurepolicy.xml file I had, and would only respond correctly to the softkeys.xml.
Here is the file I use, again I have removed the more 'Cisco' centric buttons, but this file does allow greater control of the phone, so it is longer and does offer a few more options.
Errors in this file will result in the phone ignoring it and simply displaying the default set of all buttons.
Asterisk settings
The patch provides documentation in the form of sample files, feel free to read them. Some things are certainly needed though, and are covered here.
extensions_custom.conf
A few additions to this file. We need to add some code to enable the 'pickup' softkey. It transmits a message to the server that would go unhandled otherwise. Also, if you are using video handsets, you may notice that a call to (for example) your mobile phone will result in a black screen on the deskphone as it tries to show you a video stream that will never arrive, a quick dialplan modification in this file can prevent that.
notes
Adhoc call recording
If the recording softkey has been enabled for a linekey in the sepmac.cnf.xml (9900 only) then the word 'Recording' will appear next to it. This does not mean that the call is currently recording, or being recorded. Press the button and a message will appear telling you that the recording has started. The state of the button will also change to indicate this.
The 8800 does not support 'record' as a linekey, and it must be added as a softkey instead.
blocking video
This works by instructing asterisk to use only the codec provided in the command. Asterisk 13 is happy with multiple codecs, such as ulaw&alaw&g729, Asterisk 11 on the other hand, is not. As a result, only a single codec can be selected, choose carefully.
sip_custom_post.conf
This one is interesting, it sets up a template for Cisco extensions and then applies those settings to each device. If a handset needs to subscribe for BLF hints, the subscription is added here.
For this example, we have three phones:
extension 101
extension 102, which has a BLF linekey for extension 103
extension 103, which has a BLF linekey for extension 102
extensions_override_freepbx.conf
Enabling those BLF buttons needs slightly different hints to be set up for the phones, add lines such as these for the example above.
sip_notify_custom.conf
It is very useful to be able to reboot the phones remotely. The patch allows this, so long as you have the required sip-notify commands available.
sip notify cisco-restart instructs the phone to reload the config files, allowing changes such as new lines keys to take affect. Takes just a few seconds.
sip notify cisco-reset performs a warm reboot of the phone, will pick up the full config and takes a bit longer than the restart.
very optional extras
beeps
We found that transferring a call was nicer if a beep was sounded as the connection switched, this isn't default behaviour, turn it on with this:
(not currently working correctly)
directory
In the SEPMAC config file, near the bottom, you may have noticed the entry for the directory. This points to a script that you can put anywhere.
I include here a script I wrote that will present three options to the user:
Internal Directory
Ring groups
Personal contacts
Put this script into /var/www/html/cisco and chown it to asterisk:asterisk
The script is called when you press the physical 'directory' button on the phone.
The Personal directory works like this: If your users use UCP, instruct them to make a group in their contacts, and name that group by their extension number. So whoever has extension 101 should make a group called 101. In that group, they put their contacts. The script will locate the numbers in that group, and show them on the phone.
Unsolved
Not everything is done. If you happen to know how to resolve these points, please do get in touch!
The 8800 series of phones show an outbound call on the display as "101@server.domain.com" instead of "101" as it is shown on the 9900 phones when configured in the same manner. I have not yet been able to resolve this
Recording a call using the linekey/softey does not make the recording available to the user in UCP
The recording key cannot be used to pause/unpause the Asterisk recorder (if configured) so *1 is still needed for this.
Setting the Bellcore style ring cadences in the sip headers works, but I've not found a way to instruct the phone to play a specific ringtone, so the selection of the tones is at the users discretion, rather than controled by admin.
Thanks
Major props to Gareth for writing the cisco-usecallmanager patch in the first place. It goes without saying that without his work, this document wouldn't exist and the Cisco phone on my desk... wouldn't be there.