From 6850095de7fc62adeeb7838e3c78207373eda2d6 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 11 Dec 2025 17:58:02 -0700 Subject: [PATCH] Add option to filter contact extension by call_group - This is needed for polycoms for a large client - So that it doesn't phone book limits on a Polycom --- app/provision/app_config.php | 8 ++++++++ app/provision/resources/classes/provision.php | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/app/provision/app_config.php b/app/provision/app_config.php index 3a3528f95e..2bfdfd18a5 100644 --- a/app/provision/app_config.php +++ b/app/provision/app_config.php @@ -296,6 +296,14 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "allow extensions to be provisioned as contacts in provision templates"; $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "594c01dc-f0c3-4a10-8039-7e9ca8263cae"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "contact_extensions_filter_by"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "array"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "call_summary"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Filter contact extensions by: call summary. Used in the phone book directory."; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "d157078e-b363-4f34-a6d4-8a86990a40b7"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "number_as_presence_id"; diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index acdf616c04..3f23b3ac2a 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -891,6 +891,23 @@ //get the extensions and add them to the contacts array if (is_uuid($device_uuid) && is_uuid($domain_uuid) && $this->settings->get('provision','contact_extensions',false)) { + // get the contact array filter by + $contact_extensions_filter_by = $this->settings->get('provision', 'contact_extensions_filter_by', array()); + + // filter by call summary + if (in_array('call_group', $contact_extensions_filter_by)) { + // get the extensions call group using the device line 1 + $sql = "select call_group "; + $sql .= "from v_extensions "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and extension = :extension "; + $parameters['domain_uuid'] = $domain_uuid; + $parameters['extension'] = $lines[1]['user_id']; + $call_groups = $this->database->select($sql, $parameters, 'row'); + $call_group = $call_groups['call_group']; + unset($sql, $parameters); + } + //get contacts from the database $sql = "select extension_uuid as contact_uuid, directory_first_name, directory_last_name, "; $sql .= "effective_caller_id_name, effective_caller_id_number, ";