Cisco SPA Template Mods & Notes


I had to do some rejigging of the Cisco SPA templates to get the disable and blf function working the way I wanted it to.

Here are my edits to line 185 to 94 of the SPA504g template, I've highlighted the changes:

{foreach $keys["line"] as $row}
{if $row.device_key_category == "line"}
<!-- Phone/Line_Key_{$row.device_key_id} -->

<Extension_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if {$row.device_key_type} == "disabled" or {$row.device_key_type} == "blf"}Disabled{else}{$row.device_key_line}{/if}</Extension_{$row.device_key_id}_>
<!-- This line detects if either "disabled" or "blf" is in the key type field and sets disabled in the extension field of the phone -->

<Short_Name_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{$row.device_key_label}</Short_Name_{$row.device_key_id}_>

<Share_Call_Appearance_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if $row.device_key_type == "shared"}shared{else}private{/if}</Share_Call_Appearance_{$row.device_key_id}_>

<Extended_Function_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if {$row.device_key_type} == "blf"}fnc=blf+sd+cp;sub={$row.device_key_value}@{$domain_name};ext={$row.device_key_value}@{$domain_name}{else}{$row.device_key_value}{/if}</Extended_Function_{$row.device_key_id}_>
<!-- This line detects if blf was entered as they key type and populates the extended functions field on the phone with the right values for a BLF based the value entered in the line value field of the device. Note its uses the $doamin_name vairable -->


The line key has to be disabled for extended functions like blf to work. I also like to be able to disable line keys that are not in use, these functions didn't seem to be working, thus the hacks

Bellow is an image of a phone device (SPA504) setup with two extensions, keys 1 and 2 are assigned to the extensions, key 3 is disabled, and key 4 is a BLF monitoring extension 101


This is the resulting phone tab on the phone:


This has been tested on the SPA504G
Last edited:
OK Not sure why i keep working on the Cisco/Linksys SPA templates when the phones are EOL. I guess its because these where my go to phones for a long time.

Anyway, there's a bit of code in the Cisco templates that should be in the Linksys templates if you want the provisioning button to work and you're using http auth for provisioning.

In the Linksys template you need to insert this at line 135

{if isset ($http_auth_username)}
<Profile_Rule group="Provisioning/Configuration_Profile">[--uid {$http_auth_username} --pwd {$http_auth_password}]http://{$domain_name}{$project_path}/app/provision/?mac=$MA</Profile_Rule>
<Profile_Rule group="Provisioning/Configuration_Profile">http://{$domain_name}{$project_path}/app/provision/?mac=$MA</Profile_Rule>
Hello. I was trying to modify your suggestions to get the line key to "disable" on my Spa 525g2 but I screwed up all the code on the provisioning editor for the spa 525 g2. You wouldn't by chance fix that section the way it should be starting at line 702-710 for me and post it here would you? I would be in your debt. I broke it beyond use
Here is the original lines 702-711 of spa525g2 template:

{foreach $keys["line"] as $row}
{if $row.device_key_category == "line"}

<Extension_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{$row.device_key_line}</Extension_{$row.device_key_id}_> <!-- options: 1/2/3/4/5/6/7/8/9/10/11/12/Disabled -->
<Short_Name_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{$row.device_key_label}</Short_Name_{$row.device_key_id}_>
<Share_Call_Appearance_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if $row.device_key_type == "shared"}shared{else}private{/if}</Share_Call_Appearance_{$row.device_key_id}_> <!-- options: private/shared -->
<Extended_Function_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{$row.device_key_value}</Extended_Function_{$row.device_key_id}_>

Before modifiying the files its helpful to make a backup. The files are located here: /var/www/fusionpbx/resources/templates/provision/cisco/

I'll try to get some time to work out how to modify the 525.
Ok so I dug a SPA525 out of junk drawer and surprise.. It was junk, I couldn't get it to work so I couldn't test it fully but here are my instructions.

## backup your existing provisioning files. This is over kill but everything will be backed up:

cd /var/backups
tar -czvf provisioningbackup.tar.gz /var/www/fusionpbx/resources/templates/provision

This should give you gzip of the provisioning template directory.

Now in the Fusion GUI go to Advanced => Provision Editor
In the provision editor select cisco => spa525g2 => {$mac}.xml

Replace line 705 with the following:
<Extension_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if {$row.device_key_type} == "disabled" or {$row.device_key_type} == "blf"}Disabled{else}{$row.device_key_line}{/if}</Extension_{$row.device_key_id}_>
Then replace line 708 with the following:
<Extension_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if {$row.device_key_type} == "disabled" or {$row.device_key_type} == "blf"}Disabled{else}{$row.device_key_line}{/if}</Extension_{$row.device_key_id}_>
Now save the file clicking on the disk icon.

I did not test on a phone but I did create a device with the modified template and downloaded the XML provisioning file that was generated. It has the following output which should do what you want on the phone (I created a blf on line 4):

<Extension_4_ group="Phone/Line_Key_4">Disabled</Extension_4_>
<Short_Name_4_ group="Phone/Line_Key_4">104</Short_Name_4_>
<Share_Call_Appearance_4_ group="Phone/Line_Key_4">private</Share_Call_Appearance_4_>
<!-- options: private/shared -->
<Extended_Function_4_ group="Phone/Line_Key_4">fnc=blf+sd+cp;sub=104@;ext=104@</Extended_Function_4_>

If it gets screwed up again just re-insert the original lines.
This should be line 708:

<Extended_Function_{$row.device_key_id}_ group="Phone/Line_Key_{$row.device_key_id}">{if {$row.device_key_type} == "blf"}fnc=blf+sd+cp;sub={$row.device_key_value}@{$domain_name};ext={$row.device_key_value}@{$domain_name}{else}{$row.device_key_value}{/if}</Extended_Function_{$row.device_key_id}_>
I also found that call pickup wasn't working on our SPA525G2's, but OK on our SPA504's.
That is, when you press a BLF line key on an extension which is ringing, it should pick up the call.

I had to change the following line in the 525G2 provisioning to fix it:

Line 1439 from this:
<Attendant_Console_Call_Pickup_Code group="Att_Console/General">*98</Attendant_Console_Call_Pickup_Code>

To this:
<Attendant_Console_Call_Pickup_Code group="Att_Console/General">**#</Attendant_Console_Call_Pickup_Code>

The time zone settings were also incorrect on the SPA525G2 template.

Line 681 from this:
<Time_Zone group="Regional/Time">GMT-04:00</Time_Zone>

To this:
<Time_Zone group="Regional/Time">{$spa_time_zone}</Time_Zone>
Last edited:
Thanks :)

Here's one more - the side panels (SPA500) didnt work for me, so I had to add the below around line 713. It will let you use 'BLF' or 'Line' settings. Line works as a speed dial.

Then you can configure profiles to deploy the settings to multiple devices. Works great!

{foreach $keys["expansion-1"] as $row}
<Unit_1_Key_{$row.device_key_id} group="Attendant_Console/Unit_1">
    {if {$row.device_key_type} == "blf"}
    {if {$row.device_key_type} == "line"}
I have found that call parking does not work correctly on the SPA 525G2 template. It works great on the 504 and the 508. But I can't figure out why it does not work on the SPA525G2. I use the same string on the 525 that I did on the 508 with different results. On the 508 it works perfectly. On the 525G2 it returns a message that says "invalid number" "Anonymous call" when attempted. This is the string I used on both.

fnc=blf+sd+cp;sub=park+*5901@$PROXY (Works perfectly on the 504 and 508)

I also tried this based on other articles I have read on Freeswitch with no success


Any suggestions to modify the template would be appreciated.

Attached Files:

Make sure that the call park supplementary service is enabled:

<Call_Park_Serv group="Phone/Supplementary_Services">Yes</Call_Park_Serv>

Also check the other related fields:

<Call_Park_Monitor_Enable_1_ group="Ext_1/Call_Feature_Settings">No</Call_Park_Monitor_Enable_1_>

<Call_Park_Code group="Regional/Vertical_Service_Activation_Codes">*38</Call_Park_Code>

<Call_Pickup_Code group="Regional/Vertical_Service_Activation_Codes">*36</Call_Pickup_Code>

<Call_UnPark_Code group="Regional/Vertical_Service_Activation_Codes">*39</Call_UnPark_Code>

Honestly not sure what the settings should be for your situation, but that's where I'd look to comapre to the 508 template.