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
This commit is contained in:
FusionPBX
2025-12-11 17:58:02 -07:00
committed by GitHub
parent 080cd27e25
commit 6850095de7
2 changed files with 25 additions and 0 deletions

View File

@@ -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";

View File

@@ -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, ";