From 9bc6e155498b56c20ced89668378754cde894639 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 25 Sep 2025 22:53:26 -0600 Subject: [PATCH] Update dynamic device key labels --- app/provision/resources/classes/provision.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 1386df7cd4..1d24055a61 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -819,8 +819,26 @@ $category = $row['device_key_category']; //build the device keys array - if ($row['device_key_label'] == '${caller_id_name}' && is_numeric($row['device_key_value'])) { - $device_keys[$category][$id]['device_key_label'] = $extension_labels[$row['device_key_value']]['caller_id_name']; + if (in_array($device_key_vendor, ['cisco', 'spa']) && $row['device_key_type'] == 'disabled') { + $device_key_array = explode(';', $row['device_key_value']); + foreach($device_key_array as $sub_row) { + list($key, $value) = explode('=', $sub_row); + if ($key == 'sub') { + $extension = explode('@', $value)[0]; //remove the @PROXY + $caller_id_name = $extension_labels[$extension]['caller_id_name']; + $device_key_label = str_replace('${caller_id_name}', $caller_id_name, $row['device_key_label']); + $device_key_label = str_replace('${extension}', $extension, $device_key_label); + $device_key_label = str_replace('${user}', $extension, $device_key_label); + $device_keys[$category][$id]['device_key_label'] = $device_key_label; + } + } + } elseif (is_numeric($row['device_key_value'])) { + $extension = $row['device_key_value']; + $caller_id_name = $extension_labels[$row['device_key_value']]['caller_id_name']; + $device_key_label = str_replace('${caller_id_name}', $caller_id_name, $row['device_key_label']); + $device_key_label = str_replace('${extension}', $extension, $device_key_label); + $device_key_label = str_replace('${user}', $extension, $device_key_label); + $device_keys[$category][$id]['device_key_label'] = $device_key_label; } } }