Provisioner V3 Issue - Cisco 3xx/5xx Attendant BLF

I installed the new updates for the endpoint manager and framework, and since then, I’ve found I am on v3 of the Provisioner system - using the JSON files instead of XML under /var/www/html/admin/modules/_ep_phone_modules/

Also, when I configure a Cisco phone - specifically a SPA 508G - with an attendant console using BLF, the function line says

<Unit_1_Key_1 Group="Attendant_Console/Unit_1">fnc=sd+blf+cp;[email protected]</Unit_1_Key_1>

You’ll notice at [email protected], there should be an IP address or hostname after the ampersand. Here this is not being done any more. This will not work as we have many customers who rely on attendant consoles, and who are not functional at the moment because of it. How can I revert back to v2.5 if this will not be fixed and working soon?

Thanks.

You can just edit the template to fix this.

Which template are you referring to? The device level template, or the spa$MAC.xml file?

I tried editing the SPA 508G template for those devices with sidecars, but it recreated the config files with the fnc line minus the IP address (i.e. [email protected] )

I’ve also tested this on two other FreePBX installations with the same updates installed - same issue occurs. The phone config rebuilds, but it does not add the PBX’s IP address after, to appear like this:

fnc=sd+cp+blf;[email protected]

I found the solution. I recommend this to be applied to a patch to the main system. Look at what I found and let me know if this is a universal problem, as I believe it to be.

On the new endpoint manager system - 2.10.3.7 - it is using the new Provisioner v3 system. When using Cisco SPA 5xx phones on this new update, BLF works fine on the phone’s line keys, but not on the attendant console. I then looked into the phone.php file under /var/www/html/admin/modules/_ep_phone_modules/endpoint/cisco/spa5xx/ and compared this file to the older version file.

On line 36, it says the following:

But on line 86 and 98, it says:

and

$this->settings['loops']['unit2'][$key]['data'] = "fnc=blf+sd+cp;sub=" . $temp_ext . "@" . $this->server[1]['ip'];.

Instead, I changed these two lines to read:

and

respectively.

Once I did this, I could then confirm that when specific spa$mac.xml file is built for the phone in /tftpboot/ it contains the PBX IP address, like it should.

Also, the family_data.json file for the spa5xx folder will need to be modified to add an 8_lines.json, a_unit1.json, a_unit2.json for the 508 phones and 12_lines.json, a_unit1.json, and a_unit2.json file for the 509 phones, respectively. Then cp the 4_lines.json file to 8_lines.json and 12_lines.json, and then modify the loop end portion to show 8 and 12, instead of 4.

I would be glad to upload my fixed Cisco SPA 5xx files, but I have no clue where to upload to to help contribute to the solution. If anybody knows where to send these files, please let me know.

Great catch. I would email this to Andrew. His address is on the provisioner.net website. He maintains the package.

BLF Short name fields for the phone’s line keys were also not displaying any descriptive name. They just appear as blank. I modified the phone.php file in /var/www/html/admin/modules/_ep_phone_modules/endpoint/cisco/spa5xx/ to say the following. This file includes my fixes for line key BLF short name appearance, and for BLF on the side cars to work properly. Line 32 contains the fix for short name (display name) to work for BLF on the phone’s line keys.

  
<?php

/**
 * Cisco SPA Phone File
 *
 * @author Andrew Nagy
 * @license MPL / GPLv2 / LGPL
 * @package Provisioner
 */
class endpoint_cisco_spa5xx_phone extends endpoint_cisco_base {

    public $family_line = 'spa5xx';

    function parse_lines_hook($line_data) {
        $line = $line_data['line'];
        if (strlen($line_data['displayname']) > 12) {
            $short_name = substr($line_data['displayname'], 0, 8) . "...";
        } else {
            $short_name = $line_data['displayname'];
        }
        if ((isset($line_data['secret'])) && ($line_data['secret'] != "")) {
            $line_data['dial_plan'] = $this->settings['dial_plan'];
        } else {
            $line_data['dial_plan'] = "";
        }
        if (isset($this->settings['loops']['lineops'][$line])) {
            
            $line_data['displaynameline'] = str_replace('{$count}', $line_data['count'], $this->settings['loops']['lineops'][$line]['displaynameline']);
            $line_data['short_name'] = str_replace('{$count}', $line_data['count'], $short_name);
            
            if (($this->settings['loops']['lineops'][$line]['keytype'] == "blf") AND ($this->settings['loops']['lineops'][$line]['blfext'] != "")) {
                $line_data['short_name'] = $line_data['displaynameline'];
		$line_data['username'] = $this->settings['loops']['lineops'][$line]['blfext'];
                $line_data['secret'] = 'n/a';
                $line_data['blf_ext_type'] = "Disabled";
                $line_data['share_call_appearance'] = "shared";
                $line_data['extended_function'] = "fnc=blf+sd+cp;sub=" . $this->settings['loops']['lineops'][$line]['blfext'] . "@" . $this->settings['line'][0]['server_host'];
            } elseif (($this->settings['loops']['lineops'][$line]['keytype'] == "sd") AND ($this->settings['loops']['lineops'][$line]['blfext'] != "")) {
                $line_data['username'] = $this->settings['loops']['lineops'][$line]['blfext'];
                $line_data['secret'] = 'n/a';
                $line_data['blf_ext_type'] = "Disabled";
                $line_data['share_call_appearance'] = "shared";
                $line_data['extended_function'] = "fnc=sd;sub=" . $this->settings['loops']['lineops'][$line]['blfext'] . "@" . $this->settings['line'][0]['server_host'];
            } elseif($this->settings['loops']['lineops'][$line]['keytype'] == "disabled") {
                $line_data['blf_ext_type'] = "Disabled";
            } else {
                if (!isset($line_data['secret'])) {
                    $line_data['displaynameline'] = $this->lines[1]['options']['displaynameline'];
                    $line_data['short_name'] = $this->lines[1]['options']['short_name'];
                    $line_data['username'] = '';
                    $line_data['secret'] = '';
                    $line_data['blf_ext_type'] = "1";
                    $line_data['share_call_appearance'] = "private";
                    $line_data['extended_function'] = "";
                } else {
                    $line_data['blf_ext_type'] = $line;
                    $line_data['share_call_appearance'] = "private";
                    $line_data['extended_function'] = "";
                }
            }
        } else {
            $line_data['displaynameline'] = $line_data['displayname'];
            $line_data['short_name'] = $short_name;
            $line_data['blf_ext_type'] = "1";
            $line_data['share_call_appearance'] = "private";
            $line_data['extended_function'] = "";
        }
        return($line_data);
    }

    function prepare_for_generateconfig() {
        parent::prepare_for_generateconfig();
        
        for($i = 0; $i <= $this->max_lines-1; $i++) {
            if(!isset($this->settings['line'][$i]['line'])) {
                $this->settings['line'][$i]['line'] = $i+1;
            }
        }

        if (isset($this->settings['loops']['unit1'])) {
            foreach ($this->settings['loops']['unit1'] as $key => $data) {
                if ($this->settings['loops']['unit1'][$key]['data'] == '') {
                    unset($this->settings['loops']['unit1'][$key]);
                }
                if (($this->settings['loops']['unit1'][$key]['data'] != '') && ($this->settings['loops']['unit1'][$key]['keytype'] == 'blf')) {
                    $temp_ext = $this->settings['loops']['unit1'][$key]['data'];
                    $this->settings['loops']['unit1'][$key]['data'] = "fnc=blf+sd+cp;sub=" . $temp_ext . "@" . $this->settings['line'][0]['server_host'];
                }
            }
        }

        if (isset($this->settings['loops']['unit2'])) {
            foreach ($this->settings['loops']['unit2'] as $key => $data) {
                if ($this->settings['loops']['unit2'][$key]['data'] == '') {
                    unset($this->settings['loops']['unit2'][$key]);
                }
                if (($this->settings['loops']['unit2'][$key]['data'] != '') && ($this->settings['loops']['unit2'][$key]['keytype'] == 'blf')) {
                    $temp_ext = $this->settings['loops']['unit2'][$key]['data'];
                    $this->settings['loops']['unit2'][$key]['data'] = "fnc=blf+sd+cp;sub=" . $temp_ext . "@" . $this->settings['line'][0]['server_host'];
                }
            }
        }
    }

}
 

Hey xptpa2020, I fixed all the scripts for all the spa5xx phones. I also included XML functions along with the BLF and Speed dial. PM me and I will send them to you. I did email Andrew and sent him all the fixes for all the phones. He must be busy. Have not heard from him.

The issue is completely solved now - BLF for line keys and sidecars, display name for all line keys on the phone, speed dial on both line and side car keys. Everything works excellently, due to the help of gwinton (previous post).

He has fixed the Cisco SPA3xx/5xx files and saved them in a tarball for all to use. This can be downloaded from his website at [link removed, fixed in endpoint manager].

I recommend you to save it to /var/www/html/admin/modules/_ep_phone_modules/endpoint/cisco/spa5xx and then tar xzvf into the same directory. It WILL overwrite the files presently there, but this will fix everything. If you are concerned, you can also back up the current files first.

Thanks again, gwinton.

Why dont you guys submit these fixes into freepbx.org/trac so they can get included in the module direct. Asking people to download files from a different website is not good for the community and if they update the module after that the changes will get lost.

Thanks Tony, I have asked where to place these and also sent them to Andrew. I had no answer from anyone untill now. I will submit these.

Thanks Tony Lewis for clarifying. As Tony has stated many many many times we don’t always get a chance to check these forums.

The nice thing about bug reports is that they go directly to my email, which then goes directly to my phone and alerts me in the face.

I did email gwinton, however, as he mentioned a week later all of my emails were marked ‘SPAM’ so he never saw them. Regardless I believe this issue is fully fixed.