Patching Asterisk 16 on FreePBX 16 with USECALLMANAGER.NZ Presence for Cisco SIP-Firmware Phones

 

Warning

The steps in this document end up modifying the version of Asterisk provided with 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.

This wiki has been updated for FreePBX 16 and Asterisk 16 from the original page created by Robert Keller on 15 Feb, 2018. Cisco

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 document is being updated to work with Asterisk 16. There will be some inconsistencies until this is finished.

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 and 9-4-2SR3 for the 796x/797x series

  • Asterisk 16.23.0

  • cisco-usecallmanager-patch 16.23.0

  • FreePBX 16 distribution (tested against 16.0.17)


About This Document

All of the notes here are based on other's 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 16 at installation. Once it's running, register and update all the modules (if necessary).

Important: The Cisco phones use TCP only. When you add Cisco extensions, set the Transport to TCP-Only. The phones will cause SIP retransmit errors when using UDP.

When creating a new extension, be aware of the automatically generated password, it is too long for the config file for the phone, the maximum password length is 16 characters.

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. Please note that with FreePBX 16, the sangoma-devel RPM is no longer compatible due to FreePBX supporting PHP7.4. Instead, we use sangoma-devel16.

References: SOLVED: Sangoma-devel RPM not available?

References: How to Set Up a Development Environment from the FreePBX 16 Distro

References: Asterisk 16.11.1 SRPM spec file has a syntax error(?)

 

First, configure the build environment:

yum groupinstall "Development Tools" yum install sangoma-devel16 mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

 

The version of Asterisk installed with the FreePBX deployed used for these instructions is 16.17.0, this should be increased for the current version of the patch. Use the command:

asterisk-version-switch

And select option 4 from the menu, this will install Asterisk 16.25.0.

 

Now source files are needed. The source for mISDNuser is needed for Asterisk to build, but it won't be installed.

cd ~/rpmbuild/SOURCES yumdownloader --source asterisk16-16.23.0 wget http://download.opensuse.org/source/tumbleweed/repo/oss/src/mISDNuser-2.1.0+2.0.22+git6-1.10.src.rpm wget https://raw.githubusercontent.com/usecallmanagernz/patches/master/asterisk/cisco-usecallmanager-16.23.0.patch

Then it's just a case of unpack the files, tell FreePBX about the new patch, compile the files and install them:

 

It appears that the asterisk16.spec file has a mistake in it. The spec file in the SRPM 16.23.0 file has the entry on line 7:

When, based on older spec files, it was:

Changing the Name from %{pkg_name} to asterisk16 seems to allow 16.23.0 to compile.

[Change line 7 from %{pkg_name} to asterisk16]

[Save the file and close the editor]

 

Continue on:

[Add this line below the Patch6 entry at line 25]

 

[Add this below the patch6 entry at line 611]

[save the file and close the editor]

 

Continue on:

 

Some final commands for good measure:

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 16 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. Cisco phones do not 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 line key, a DND line key 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 recognize 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 are many reasons why is may not be *perfect*. An excellent breakdown of the various sections is available at: SEPMAC.cnf.xml

 

```

featurepolicy.xml

The 9900 series prefers to use the feature policy file to control the soft keys 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 ring group

  • 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, or here: Feature Policy


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. Here: Soft Keys


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' soft key. 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 desk phone as it tries to show you a video stream that will never arrive, a quick dial plan modification in this file can prevent that.

Notes

Adhoc Call Recording

If the recording soft key has been enabled for a line key 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 line key, and it must be added as a soft key instead.

Blocking Video

This works by instructing asterisk to use only the codec provided in the command. Asterisk 16 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 line key for extension 103

  • extension 103, which has a BLF line key 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 effect. 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 behavior, 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.

Paging and Intercom

Below is an example of configuring a line on a Cisco SIP-Firmware phone for use as an intercom/paging extension that auto-answers when a call is received.

NB of the parameters autoAnswerEnabled and autoAnswerMode configured to enable auto-answer:

 

 


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 line key/soft key does not make the recording available to the user in UCP

  • The recording key cannot be used to pause/un-pause 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 user's discretion, rather than controller by the system 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.

I would also like to thank Robert Keller for creating this initial document here on the FreePBX wiki.

Return to Documentation Home I Return to Sangoma Support