From bc22ab8cc4263dcd1bdf6cdcea243d04f7d80504 Mon Sep 17 00:00:00 2001 From: fusionate Date: Tue, 28 Jan 2025 17:18:28 -0700 Subject: [PATCH] Contact - View: Show speed dial prefix and number after a Contact's number, if defined. --- core/contacts/contact_phones_view.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/contacts/contact_phones_view.php b/core/contacts/contact_phones_view.php index 4f0cf25874..81fe1f4278 100644 --- a/core/contacts/contact_phones_view.php +++ b/core/contacts/contact_phones_view.php @@ -51,6 +51,29 @@ //show if exists if (!empty($contact_phones)) { + //detect speed dial prefix from dialplan + $sql = "select dialplan_detail_data from v_dialplan_details "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and dialplan_uuid = ( "; + $sql .= " select dialplan_uuid from v_dialplan_details "; + $sql .= " where domain_uuid = :domain_uuid "; + $sql .= " and dialplan_detail_data like 'app.lua speed_dial%' "; + $sql .= " and (dialplan_detail_enabled = true or dialplan_detail_enabled is null) "; + $sql .= " limit 1 "; + $sql .= ") "; + $sql .= "and dialplan_detail_tag = 'condition' "; + $sql .= "and dialplan_detail_type = 'destination_number' "; + $sql .= "and dialplan_detail_data like '^\\\\%' "; + $sql .= "and (dialplan_detail_enabled = true or dialplan_detail_enabled is null) "; + $sql .= "limit 1"; + $parameters['domain_uuid'] = $domain_uuid; + $database = new database; + $speed_dial_condition = $database->select($sql, $parameters, 'column'); + if (!empty($speed_dial_condition)) { + $speed_dial_prefix = str_replace('(.*)', '', trim($speed_dial_condition,'^\$')); // default: ^\*0(.*)$ + } + unset($sql, $speed_dial_condition); + //javascript function: send_cmd echo "