Update Device Key Label when Changing Extension's Caller ID Name

dougs

New Member
Mar 1, 2018
29
2
3
39
I wanted a way to update all device BLF Key Labels when you changed the name associated with an extension. I wanted to only update the name of the extension in one place and have that value updated on every device that has that extension assigned as a BLF.

So now when you edit the "Effective Caller ID Name" of an extension it updates the "Label" of every device that has that extension as a BLF.

I accomplished this by editing the PHP of the "Extension" page. in "Advanced" > "PHP Editor" edit the following file: /var/www/fusionpbx/app/extensions/extension_edit.php

After the section with the remarks of "//update devices having extension assigned to line(s) with new password" I added the following:
//update device key label
if (strlen($effective_caller_id_name) > 0) {​
$sql = "update v_device_keys set ";​
$sql .= "device_key_label = '".$effective_caller_id_name."' ";​
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";​
$sql .= "and device_key_value = '".$extension."' ";​
$db->exec(check_sql($sql));​
unset($sql);​
}​
This is what mine looks like:
1521648854332.png

Obviously click save at the top and you're done.

I am not a developer by any means so there may be a better way to do this, but it works for me.