Provisioning CISCO phones with SEP{$mac}.cnf.xml files... in uppercase

Status
Not open for further replies.

cainram

New Member
Nov 12, 2019
9
1
3
43
Greetings! Long time reader, first time poster.

I have created a template in my FusionPBX server in the ..../cisco/8845 folder and a correctly formatted xml file is created. The problem is that FusionPBX likes to change the letters in the mac address to lower case. And I need them to be upper case (how I typed them in) for the Cisco phones to download the config files. The format is as follows: SEP1234567890AB.cnf.xml. The AB has to be capitalized. Interestingly, if I go to the Devices section and 'correct' the lower case letter issue, a new file with capital letters is generated and that is the file that gets updated when changes are made to the device via the web gui. The MAC address field in the FusionPBX web gui still displays in lower case, however.

So, I got it working with this extra step but I'm looking around for an option I can toggle somewhere to stop forcing the MAC addresses into the lower case format.
Am I out of luck? Has no one else had this issue?

Thanks in advance!
 

cainram

New Member
Nov 12, 2019
9
1
3
43
Thanks for taking the time to read and reply. I'll try to be more specific. I have a template I created for provisioning my Cisco phones. The file name of the template is SEP{$mac}.cnf.xml. When I create a device either from the Devices page or by adding a device to an extension from the Extension page, I enter the MAC with the alpha characters in upper case. Fusion then creates a file in my designated TFTP folder from the template, populating it with the appropriate data. The {$mac} part of the filename is replaced with the MAC that I entered but in lower case. The file ends up looking like SEP94d4690af18b.cnf.xml rather than SEP94D4690AF18B.cnf.xml which is what the phone is trying to download. The device in the Devices page as well as the device entry in the Extension page shows the MAC with lower case characters.

Interestingly, I can go into the Devices page and change the MAC's lower case characters to upper case and a new file, with upper case letters, is generated. I have found that further changes to the device are reflected in this new file, although it still always displays as lower case in the web gui.

I hope this is more clear. While I have found a workaround, I would like to have the files generated with upper case letters from the get-go, of course.

Thanks again.

EDIT:

I have found this...

//prepare the mac address
if (isset($mac)) {
//normalize the mac address to lower case
$mac = strtolower($mac);
//replace all non hexadecimal values and validate the mac address
$mac = preg_replace("#[^a-fA-F0-9./]#", "", $mac);
if (strlen($mac) != 12) {
echo "invalid mac address";
exit;
}
}

Can I comment out the lower case section... Or will this have greater repercussions ... I see another section regarding Cisco 79xx series phones... I'm going to continue digging into thing but any help is appreciated.
 
Last edited:

cainram

New Member
Nov 12, 2019
9
1
3
43
I have commented out the two lines in index.php that refer to strtolower($mac) as well as a similar line in app_defaults.php and restarted nginx. Still having the same behavior. Is there another php file I should be looking in?
 

JamesBorne

Active Member
Jan 24, 2019
294
56
28
Australia
After reading your reply, it looks like you don't want the new devices to have lowercase letters.
In the case, you would apply the same logic, but to the app/devices/device_edit.php page.

Also, no need to restart Nginx for PHP changes.
 

cainram

New Member
Nov 12, 2019
9
1
3
43
Thanks! I really appreciate the help. It seems I've made a little progress but not all the way there. I have commented out the line:
$device_mac_address = strtolower($device_mac_address);
in device_edit.php under the
//normalize the mac address
section.
Now when I create a device in the webGUI's Device page, the MAC displayed in the MAC Address field stays capitalized but the file generated in my TFTP folder still has lowercase letters and the MAC is displayed with lowercase letters in the Devices list in the webGUI.
There is also a reference to strtolower in the //show all the rows in the array section and also in devices.php but it seems like they are just for searching and displaying the list of devices and I didn't want to just start wiping out lines of code willy-nilly.

I feel like I'm getting close, I just need to keep digging and find the right line...
 

cainram

New Member
Nov 12, 2019
9
1
3
43
Ok, the file app/provision/resources/classes/provision.php is FULL of strtolower($device_mac_address); calls and I feel like this may be what Im' looking for. But I can't just start experimenting with commenting them out having very little idea of the unintended consequences. If anyone out there is comfortable with this particular code, I would be eternally grateful for some guidance here. MANY thanks in advance...
 
  • Like
Reactions: JamesBorne
Status
Not open for further replies.