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:
markjcrane
2025-12-11 17:45:48 -07:00
parent dcc78adcb5
commit 793212ffd7
2 changed files with 29 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_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "allow extensions to be provisioned as contacts in provision templates"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "allow extensions to be provisioned as contacts in provision templates";
$y++; $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_uuid'] = "d157078e-b363-4f34-a6d4-8a86990a40b7";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "number_as_presence_id"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "number_as_presence_id";

View File

@@ -1002,6 +1002,23 @@ class provision {
// get the extensions and add them to the contacts array // 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)) { 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 // get contacts from the database
$sql = 'select extension_uuid as contact_uuid, directory_first_name, directory_last_name, '; $sql = 'select extension_uuid as contact_uuid, directory_first_name, directory_last_name, ';
$sql .= 'effective_caller_id_name, effective_caller_id_number, '; $sql .= 'effective_caller_id_name, effective_caller_id_number, ';
@@ -1009,6 +1026,10 @@ class provision {
$sql .= 'from v_extensions '; $sql .= 'from v_extensions ';
$sql .= 'where domain_uuid = :domain_uuid '; $sql .= 'where domain_uuid = :domain_uuid ';
$sql .= 'and enabled = true '; $sql .= 'and enabled = true ';
if (in_array('call_group', $contact_extensions_filter_by)) {
$sql .= "and call_group = :call_group ";
$parameters['call_group'] = $call_group;
}
$sql .= "and directory_visible = 'true' "; $sql .= "and directory_visible = 'true' ";
$sql .= 'order by directory_first_name, effective_caller_id_name asc '; $sql .= 'order by directory_first_name, effective_caller_id_name asc ';
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;