diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 2ee3b540b1..e911918859 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -250,11 +250,13 @@ $queue_timeout_data = implode($action_array); //add the recording path if needed - if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting)) { - $queue_greeting_path = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting; - } - else if (trim($queue_greeting) != '') { - $queue_greeting_path = $queue_greeting; + if ($queue_greeting != '') { + if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting)) { + $queue_greeting_path = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting; + } + else { + $queue_greeting_path = trim($queue_greeting); + } } //prepare the array diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 55ec083021..c04299a2c1 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -245,7 +245,7 @@ } if (permission_exists('call_flow_edit')) { echo " "; - echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($row['call_flow_enabled'] == "true" ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); document.getElementById('toggle_field').value = 'call_flow_enabled';list_form_submit('form_list')"]); + echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($row['call_flow_enabled'] == "true" ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); document.getElementById('toggle_field').value = 'call_flow_enabled'; list_form_submit('form_list')"]); } else { echo " "; diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index 10320a3e07..ee92278e09 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -217,8 +217,10 @@ if (!class_exists('call_flows')) { foreach($call_flows as $uuid => $call_flow) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->toggle_field] = $call_flow['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; - $array['dialplans'][$x]['dialplan_uuid'] = $call_flow['dialplan_uuid']; - $array['dialplans'][$x]['dialplan_enabled'] = $call_flow['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; + if ($this->toggle_field == 'call_flow_enabled') { + $array['dialplans'][$x]['dialplan_uuid'] = $call_flow['dialplan_uuid']; + $array['dialplans'][$x]['dialplan_enabled'] = $call_flow['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; + } $x++; } diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 6a7a05ac9e..d0a90e7e0b 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -104,8 +104,6 @@ } unset($sql, $parameters, $row); } - //get assigned user - $device_user_uuid = $_POST["device_user_uuid"]; //devices $domain_uuid = $_POST["domain_uuid"]; $device_uuid = $_POST["device_uuid"]; @@ -242,99 +240,146 @@ //prepare the array $array['devices'][0]['domain_uuid'] = $domain_uuid; $array['devices'][0]['device_uuid'] = $device_uuid; - $array['devices'][0]['device_mac_address'] = $device_mac_address; + if (permission_exists('device_mac_address')) { + $array['devices'][0]['device_mac_address'] = $device_mac_address; + } //$array['devices'][0]['device_provisioned_ip'] = $device_provisioned_ip; - $array['devices'][0]['domain_uuid'] = $domain_uuid; - $array['devices'][0]['device_label'] = $device_label; - $array['devices'][0]['device_user_uuid'] = $device_user_uuid; - $array['devices'][0]['device_username'] = $device_username; - $array['devices'][0]['device_password'] = $device_password; - $array['devices'][0]['device_vendor'] = $device_vendor; - $array['devices'][0]['device_uuid_alternate'] = $device_uuid_alternate; - $array['devices'][0]['device_model'] = $device_model; - $array['devices'][0]['device_firmware_version'] = $device_firmware_version; - $array['devices'][0]['device_enabled'] = $device_enabled; - $array['devices'][0]['device_enabled_date'] = 'now()'; - $array['devices'][0]['device_template'] = $device_template; - $array['devices'][0]['device_profile_uuid'] = $device_profile_uuid; - $array['devices'][0]['device_description'] = $device_description; + if (permission_exists('device_label')) { + $array['devices'][0]['device_label'] = $device_label; + } + if (permission_exists('device_user') && is_uuid($device_user_uuid)) { + $array['devices'][0]['device_user_uuid'] = $device_user_uuid; + } + if (permission_exists('device_username_password')) { + $array['devices'][0]['device_username'] = $device_username; + $array['devices'][0]['device_password'] = $device_password; + } + if (permission_exists('device_vendor')) { + $array['devices'][0]['device_vendor'] = $device_vendor; + } + if (permission_exists('device_alternate') && is_uuid($device_uuid_alternate)) { + $array['devices'][0]['device_uuid_alternate'] = $device_uuid_alternate; + } + if (permission_exists('device_model')) { + $array['devices'][0]['device_model'] = $device_model; + } + if (permission_exists('device_firmware')) { + $array['devices'][0]['device_firmware_version'] = $device_firmware_version; + } + if (permission_exists('device_enable')) { + $array['devices'][0]['device_enabled'] = $device_enabled; + $array['devices'][0]['device_enabled_date'] = 'now()'; + } + if (permission_exists('device_template')) { + $array['devices'][0]['device_template'] = $device_template; + } + if (permission_exists('device_profile_edit') && is_uuid($device_profile_uuid)) { + $array['devices'][0]['device_profile_uuid'] = $device_profile_uuid; + } + if (permission_exists('device_description')) { + $array['devices'][0]['device_description'] = $device_description; + } - $y = 0; - foreach ($device_lines as $row) { - if (strlen($row['line_number']) > 0) { - if (is_uuid($row["device_line_uuid"])) { - $device_line_uuid = $row["device_line_uuid"]; + if (permission_exists('device_line_edit')) { + $y = 0; + foreach ($device_lines as $row) { + if (strlen($row['line_number']) > 0) { + if (is_uuid($row["device_line_uuid"])) { + $device_line_uuid = $row["device_line_uuid"]; + } + else { + $device_line_uuid = uuid(); + } + $array['devices'][0]['device_lines'][$y]['domain_uuid'] = $domain_uuid; + $array['devices'][0]['device_lines'][$y]['device_uuid'] = $device_uuid; + $array['devices'][0]['device_lines'][$y]['device_line_uuid'] = $device_line_uuid; + $array['devices'][0]['device_lines'][$y]['line_number'] = $row["line_number"]; + $array['devices'][0]['device_lines'][$y]['server_address'] = $row["server_address"]; + if (permission_exists('device_line_outbound_proxy_primary')) { + $array['devices'][0]['device_lines'][$y]['outbound_proxy_primary'] = $row["outbound_proxy_primary"]; + } + if (permission_exists('device_line_outbound_proxy_secondary')) { + $array['devices'][0]['device_lines'][$y]['outbound_proxy_secondary'] = $row["outbound_proxy_secondary"]; + } + if (permission_exists('device_line_server_address_primary')) { + $array['devices'][0]['device_lines'][$y]['server_address_primary'] = $row["server_address_primary"]; + } + if (permission_exists('device_line_server_address_secondary')) { + $array['devices'][0]['device_lines'][$y]['server_address_secondary'] = $row["server_address_secondary"]; + } + $array['devices'][0]['device_lines'][$y]['display_name'] = $row["display_name"]; + $array['devices'][0]['device_lines'][$y]['user_id'] = $row["user_id"]; + if (permission_exists('device_line_auth_id')) { + $array['devices'][0]['device_lines'][$y]['auth_id'] = $row["auth_id"]; + } + if (permission_exists('device_line_password')) { + $array['devices'][0]['device_lines'][$y]['password'] = $row["password"]; + } + $array['devices'][0]['device_lines'][$y]['shared_line'] = $row["shared_line"]; + $array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"]; + $array['devices'][0]['device_lines'][$y]['sip_port'] = $row["sip_port"]; + $array['devices'][0]['device_lines'][$y]['sip_transport'] = $row["sip_transport"]; + $array['devices'][0]['device_lines'][$y]['register_expires'] = $row["register_expires"]; + $y++; } - else { - $device_line_uuid = uuid(); - } - $array['devices'][0]['device_lines'][$y]['domain_uuid'] = $domain_uuid; - $array['devices'][0]['device_lines'][$y]['device_uuid'] = $device_uuid; - $array['devices'][0]['device_lines'][$y]['device_line_uuid'] = $device_line_uuid; - $array['devices'][0]['device_lines'][$y]['line_number'] = $row["line_number"]; - $array['devices'][0]['device_lines'][$y]['server_address'] = $row["server_address"]; - $array['devices'][0]['device_lines'][$y]['outbound_proxy_primary'] = $row["outbound_proxy_primary"]; - $array['devices'][0]['device_lines'][$y]['outbound_proxy_secondary'] = $row["outbound_proxy_secondary"]; - $array['devices'][0]['device_lines'][$y]['server_address_primary'] = $row["server_address_primary"]; - $array['devices'][0]['device_lines'][$y]['server_address_secondary'] = $row["server_address_secondary"]; - $array['devices'][0]['device_lines'][$y]['display_name'] = $row["display_name"]; - $array['devices'][0]['device_lines'][$y]['user_id'] = $row["user_id"]; - $array['devices'][0]['device_lines'][$y]['auth_id'] = $row["auth_id"]; - $array['devices'][0]['device_lines'][$y]['password'] = $row["password"]; - $array['devices'][0]['device_lines'][$y]['shared_line'] = $row["shared_line"]; - $array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"]; - $array['devices'][0]['device_lines'][$y]['sip_port'] = $row["sip_port"]; - $array['devices'][0]['device_lines'][$y]['sip_transport'] = $row["sip_transport"]; - $array['devices'][0]['device_lines'][$y]['register_expires'] = $row["register_expires"]; - $y++; } } - $y = 0; - foreach ($device_keys as $row) { - if (strlen($row['device_key_category']) > 0) { - if (is_uuid($row["device_key_uuid"])) { - $device_key_uuid = $row["device_key_uuid"]; + if (permission_exists('device_key_edit')) { + $y = 0; + foreach ($device_keys as $row) { + if (strlen($row['device_key_category']) > 0) { + if (is_uuid($row["device_key_uuid"])) { + $device_key_uuid = $row["device_key_uuid"]; + } + else { + $device_key_uuid = uuid(); + } + $array['devices'][0]['device_keys'][$y]['domain_uuid'] = $domain_uuid; + $array['devices'][0]['device_keys'][$y]['device_uuid'] = $device_uuid; + $array['devices'][0]['device_keys'][$y]['device_key_uuid'] = $device_key_uuid; + $array['devices'][0]['device_keys'][$y]['device_key_category'] = $row["device_key_category"]; + $array['devices'][0]['device_keys'][$y]['device_key_vendor'] = $row["device_key_vendor"]; + if (permission_exists('device_key_id')) { + $array['devices'][0]['device_keys'][$y]['device_key_id'] = $row["device_key_id"]; + } + $array['devices'][0]['device_keys'][$y]['device_key_type'] = $row["device_key_type"]; + if (permission_exists('device_key_line')) { + $array['devices'][0]['device_keys'][$y]['device_key_line'] = $row["device_key_line"]; + } + $array['devices'][0]['device_keys'][$y]['device_key_value'] = $row["device_key_value"]; + if (permission_exists('device_key_extension')) { + $array['devices'][0]['device_keys'][$y]['device_key_extension'] = $row["device_key_extension"]; + } + //$array['devices'][0]['device_keys'][$y]['device_key_protected'] = $row["device_key_protected"]; + $array['devices'][0]['device_keys'][$y]['device_key_label'] = $row["device_key_label"]; + $array['devices'][0]['device_keys'][$y]['device_key_icon'] = $row["device_key_icon"]; + $y++; } - else { - $device_key_uuid = uuid(); - } - $array['devices'][0]['device_keys'][$y]['domain_uuid'] = $domain_uuid; - $array['devices'][0]['device_keys'][$y]['device_uuid'] = $device_uuid; - $array['devices'][0]['device_keys'][$y]['device_key_uuid'] = $device_key_uuid; - $array['devices'][0]['device_keys'][$y]['device_key_category'] = $row["device_key_category"]; - $array['devices'][0]['device_keys'][$y]['device_key_vendor'] = $row["device_key_vendor"]; - $array['devices'][0]['device_keys'][$y]['device_key_id'] = $row["device_key_id"]; - $array['devices'][0]['device_keys'][$y]['device_key_type'] = $row["device_key_type"]; - $array['devices'][0]['device_keys'][$y]['device_key_line'] = $row["device_key_line"]; - $array['devices'][0]['device_keys'][$y]['device_key_value'] = $row["device_key_value"]; - $array['devices'][0]['device_keys'][$y]['device_key_extension'] = $row["device_key_extension"]; - //$array['devices'][0]['device_keys'][$y]['device_key_protected'] = $row["device_key_protected"]; - $array['devices'][0]['device_keys'][$y]['device_key_label'] = $row["device_key_label"]; - $array['devices'][0]['device_keys'][$y]['device_key_icon'] = $row["device_key_icon"]; - $y++; } } - $y = 0; - foreach ($device_settings as $row) { - if (strlen($row['device_setting_subcategory']) > 0) { - if (is_uuid($row["device_setting_uuid"])) { - $device_setting_uuid = $row["device_setting_uuid"]; + if (permission_exists('device_setting_edit')) { + $y = 0; + foreach ($device_settings as $row) { + if (strlen($row['device_setting_subcategory']) > 0) { + if (is_uuid($row["device_setting_uuid"])) { + $device_setting_uuid = $row["device_setting_uuid"]; + } + else { + $device_setting_uuid = uuid(); + } + $array['devices'][0]['device_settings'][$y]['domain_uuid'] = $domain_uuid; + $array['devices'][0]['device_settings'][$y]['device_uuid'] = $device_uuid; + $array['devices'][0]['device_settings'][$y]['device_setting_uuid'] = $device_setting_uuid; + $array['devices'][0]['device_settings'][$y]['device_setting_category'] = $row["device_setting_category"]; + $array['devices'][0]['device_settings'][$y]['device_setting_subcategory'] = $row["device_setting_subcategory"]; + $array['devices'][0]['device_settings'][$y]['device_setting_name'] = $row["device_setting_name"]; + $array['devices'][0]['device_settings'][$y]['device_setting_value'] = $row["device_setting_value"]; + $array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"]; + $array['devices'][0]['device_settings'][$y]['device_setting_description'] = $row["device_setting_description"]; + $y++; } - else { - $device_setting_uuid = uuid(); - } - $array['devices'][0]['device_settings'][$y]['domain_uuid'] = $domain_uuid; - $array['devices'][0]['device_settings'][$y]['device_uuid'] = $device_uuid; - $array['devices'][0]['device_settings'][$y]['device_setting_uuid'] = $device_setting_uuid; - $array['devices'][0]['device_settings'][$y]['device_setting_category'] = $row["device_setting_category"]; - $array['devices'][0]['device_settings'][$y]['device_setting_subcategory'] = $row["device_setting_subcategory"]; - $array['devices'][0]['device_settings'][$y]['device_setting_name'] = $row["device_setting_name"]; - $array['devices'][0]['device_settings'][$y]['device_setting_value'] = $row["device_setting_value"]; - $array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"]; - $array['devices'][0]['device_settings'][$y]['device_setting_description'] = $row["device_setting_description"]; - $y++; } } @@ -906,7 +951,7 @@ echo "\n"; } - if (permission_exists('device_line_view')) { + if (permission_exists('device_line_edit')) { echo " "; echo " ".$text['label-lines'].""; echo " "; @@ -1159,9 +1204,13 @@ if ($vendor_count == 0) { echo " \n"; echo " ".$text['label-device_key_category']."\n"; - echo " ".$text['label-device_key_id']."\n"; + if (permission_exists('device_key_id')) { + echo " ".$text['label-device_key_id']."\n"; + } echo " ".$text['label-device_key_type']."\n"; - echo " ".$text['label-device_key_line']."\n"; + if (permission_exists('device_key_line')) { + echo " ".$text['label-device_key_line']."\n"; + } echo " ".$text['label-device_key_value']."\n"; if (permission_exists('device_key_extension')) { echo " ".$text['label-device_key_extension']."\n"; @@ -1183,13 +1232,17 @@ if ($previous_device_key_vendor != $row['device_key_vendor']) { echo " \n"; echo " ".$text['label-device_key_category']."\n"; - echo " ".$text['label-device_key_id']."\n"; + if (permission_exists('device_key_id')) { + echo " ".$text['label-device_key_id']."\n"; + } if ($vendor_count > 1 && strlen($row['device_key_vendor']) > 0) { echo " ".ucwords($row['device_key_vendor'])."\n"; } else { echo " ".$text['label-device_key_type']."\n"; } - echo " ".$text['label-device_key_line']."\n"; + if (permission_exists('device_key_line')) { + echo " ".$text['label-device_key_line']."\n"; + } echo " ".$text['label-device_key_value']."\n"; if (permission_exists('device_key_extension')) { echo " ".$text['label-device_key_extension']."\n"; @@ -1333,15 +1386,17 @@ echo " \n"; echo "\n"; - echo "\n"; - $selected = "selected='selected'"; - echo " \n"; + echo " \n"; + for ($i = 1; $i <= 255; $i++) { + echo " \n"; + } + echo " \n"; + echo "\n"; } - echo " \n"; - echo "\n"; echo "\n"; //echo " \n"; @@ -1381,14 +1436,16 @@ } echo "\n"; echo "\n"; - echo "\n"; - echo " \n"; + echo " \n"; + for ($l = 0; $l <= 12; $l++) { + echo " \n"; + } + echo " \n"; + echo "\n"; } - echo " \n"; - echo "\n"; echo "\n"; echo " \n"; diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index f3f81b6447..41d0a5f97d 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -626,18 +626,16 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; } - if (strlen($prefix_number) > 0) { - if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') { - $y++; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); - $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'action'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = 'set'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'prefix='.$prefix_number; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - } + if (strlen($prefix_number) > 2) { + $y++; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); + $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'action'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = 'set'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'provider_prefix='.$prefix_number; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; } if ($gateway_type == "transfer") { $dialplan_detail_type = 'transfer'; } else { $dialplan_detail_type = 'bridge'; } diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 52edbc9356..b8709831ee 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -51,10 +51,10 @@ $apps[$x]['destinations'][$y]['sql'] = "select extension, number_alias, user_context as context, description from v_extensions "; $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and enabled = 'true' "; $apps[$x]['destinations'][$y]['order_by'] = "number_alias, extension asc"; - //$apps[$x]['destinations'][$y]['field']['context'] = "user_context"; $apps[$x]['destinations'][$y]['field']['destination'] = "number_alias,extension"; + $apps[$x]['destinations'][$y]['field']['context'] = "user_context"; $apps[$x]['destinations'][$y]['field']['description'] = "description"; - $apps[$x]['destinations'][$y]['select_value']['user_contact'] = "loopback/\${destination}"; + $apps[$x]['destinations'][$y]['select_value']['user_contact'] = "loopback/\${destination}/\${context}"; $apps[$x]['destinations'][$y]['select_label'] = "\${destination} \${description}"; $y++; $apps[$x]['destinations'][$y]['type'] = "sql"; @@ -230,7 +230,7 @@ $apps[$x]['default_settings'][$y]['default_setting_category'] = "extension"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "password_length"; $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "10"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "20"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the length for generated passwords for extensions."; $y++; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 0ce914f317..3454c094ea 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -969,17 +969,18 @@ echo " \n"; echo "
\n"; } - - echo " \n"; + echo " \n"; + foreach($users as $field) { + echo " \n"; + } + echo " "; + if ($action == "update") { + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + } + echo "
\n"; } - echo " "; - if ($action == "update") { - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); - } - echo "
\n"; echo " ".$text['description-user_list']."\n"; echo "
\n"; echo " "; diff --git a/app/messages/app_config.php b/app/messages/app_config.php index c438211b23..5f8c733ab8 100644 --- a/app/messages/app_config.php +++ b/app/messages/app_config.php @@ -15,38 +15,33 @@ $y = 0; $apps[$x]['permissions'][$y]['name'] = 'message_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_media_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_media_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_media_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'message_media_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'message_key'; + //$apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; //messages table diff --git a/app/music_on_hold/app_config.php b/app/music_on_hold/app_config.php index fcf9220ae6..de7f4489c9 100644 --- a/app/music_on_hold/app_config.php +++ b/app/music_on_hold/app_config.php @@ -3,7 +3,7 @@ //application details $apps[$x]['name'] = "Music on Hold"; $apps[$x]['uuid'] = "1dafe0f8-c08a-289b-0312-15baf4f20f81"; - $apps[$x]['category'] = "Switch";; + $apps[$x]['category'] = "Switch"; $apps[$x]['subcategory'] = ""; $apps[$x]['version'] = "1.0"; $apps[$x]['license'] = "Mozilla Public License 1.1"; diff --git a/app/scripts/resources/scripts/app/ring_groups/index.lua b/app/scripts/resources/scripts/app/ring_groups/index.lua index 226e1e2732..7b4d35f90a 100644 --- a/app/scripts/resources/scripts/app/ring_groups/index.lua +++ b/app/scripts/resources/scripts/app/ring_groups/index.lua @@ -903,6 +903,18 @@ user_exists = row.user_exists; destination_number = row.destination_number; domain_name = row.domain_name; + destination_prompt = row.destination_prompt; + + --determine confirm prompt + if (destination_prompt == nil) then + group_confirm = "confirm=false,"; + elseif (destination_prompt == "1") then + group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir:gsub('\\','/') .."/confirm.lua,confirm=true,"; + elseif (destination_prompt == "2") then + group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir:gsub('\\','/') .."/confirm.lua,confirm=true,"; + else + group_confirm = "confirm=false,"; + end --if the timeout was reached exit the loop and go to the timeout action if (tonumber(ring_group_call_timeout) == timeout) then diff --git a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua index 25b561c957..269963c56b 100644 --- a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua +++ b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua @@ -1,6 +1,6 @@ -- xml_handler.lua -- Part of FusionPBX --- Copyright (C) 2015-2018 Mark J Crane +-- Copyright (C) 2015-2020 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -179,19 +179,15 @@ --get and then set the complete agent_contact with the call_timeout and when necessary confirm --confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1"; --if you change this variable also change app/call_center/call_center_agent_edit.php - confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout; + confirm = "group_confirm_file=ivr/ivr-accept_reject_voicemail.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout; if (string.find(agent_contact, '}') == nil) then --not found if (string.find(agent_contact, 'sofia/gateway') == nil) then --add the call_timeout - agent_contact = "{call_timeout="..agent_call_timeout..",sip_h_caller_destination=${caller_destination}}"..agent_contact; + agent_contact = "{call_timeout="..agent_call_timeout..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",sip_h_caller_destination=${caller_destination}}"..agent_contact; else --add the call_timeout and confirm - tmp_pos = string.find(agent_contact, "}"); - tmp_first = string.sub(agent_contact, 0, tmp_pos); - tmp_last = string.sub(agent_contact, tmp_pos); - agent_contact = tmp_first..',call_timeout='..agent_call_timeout..tmp_last; - agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout..",sip_h_caller_destination=${caller_destination}}"..agent_contact; + agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",sip_h_caller_destination=${caller_destination}}"..agent_contact; end else --found diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index b393a7adc9..a6fa04e325 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -243,14 +243,6 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = ""; $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "53c56ddb-bd20-4fbd-b646-1ca9f8d2af11"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "cdr"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "remove_prefix"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "false"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Remove outbound prefix in the call detail records."; - $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "cdb19dda-234b-407a-9eda-e8af74597d4b"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "cdr"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "limit"; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 8f15e920c8..3880ab4591 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -303,6 +303,14 @@ if (!class_exists('xml_cdr')) { $destination_number = urldecode($xml->variables->last_sent_callee_id_number); } + //remove the provider prefix + if (isset($xml->variables->provider_prefix) && isset($destination_number)) { + $provider_prefix = $xml->variables->provider_prefix; + if ($provider_prefix == substr($destination_number, 0, strlen($provider_prefix))) { + $destination_number = substr($destination_number, strlen($provider_prefix), strlen($destination_number)); + } + } + //set missed calls $missed_call = 'false'; if ($xml->variables->call_direction == 'local' || $xml->variables->call_direction == 'inbound') { diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 73d2dbac93..58535cb6d5 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -138,6 +138,7 @@ //caller info $database->fields['caller_destination'] = urldecode($xml->variables->caller_destination); + //misc $uuid = urldecode($xml->variables->uuid); $database->fields['xml_cdr_uuid'] = $uuid; @@ -147,6 +148,7 @@ //$database->fields['digits_dialed'] = urldecode($xml->variables->digits_dialed); $database->fields['sip_hangup_disposition'] = urldecode($xml->variables->sip_hangup_disposition); $database->fields['pin_number'] = urldecode($xml->variables->pin_number); + //time $database->fields['start_epoch'] = urldecode($xml->variables->start_epoch); $start_stamp = urldecode($xml->variables->start_stamp); @@ -159,6 +161,7 @@ $database->fields['mduration'] = urldecode($xml->variables->mduration); $database->fields['billsec'] = urldecode($xml->variables->billsec); $database->fields['billmsec'] = urldecode($xml->variables->billmsec); + //codecs $database->fields['read_codec'] = urldecode($xml->variables->read_codec); $database->fields['read_rate'] = urldecode($xml->variables->read_rate); @@ -167,6 +170,7 @@ $database->fields['remote_media_ip'] = urldecode($xml->variables->remote_media_ip); $database->fields['hangup_cause'] = urldecode($xml->variables->hangup_cause); $database->fields['hangup_cause_q850'] = urldecode($xml->variables->hangup_cause_q850); + //call center $database->fields['cc_side'] = urldecode($xml->variables->cc_side); $database->fields['cc_member_uuid'] = urldecode($xml->variables->cc_member_uuid); @@ -183,13 +187,16 @@ $database->fields['cc_cancel_reason'] = urldecode($xml->variables->cc_cancel_reason); $database->fields['cc_cause'] = urldecode($xml->variables->cc_cause); $database->fields['waitsec'] = urldecode($xml->variables->waitsec); + //app info $database->fields['last_app'] = urldecode($xml->variables->last_app); $database->fields['last_arg'] = urldecode($xml->variables->last_arg); + //conference $database->fields['conference_name'] = urldecode($xml->variables->conference_name); $database->fields['conference_uuid'] = urldecode($xml->variables->conference_uuid); $database->fields['conference_member_id'] = urldecode($xml->variables->conference_member_id); + //call quality $rtp_audio_in_mos = urldecode($xml->variables->rtp_audio_in_mos); if (strlen($rtp_audio_in_mos) > 0) { @@ -222,7 +229,7 @@ foreach ($xml->callflow as $row) { if ($i == 0) { $context = urldecode($row->caller_profile->context); - $database->fields['destination_number'] = urldecode($row->caller_profile->destination_number); + $destination_number = urldecode($row->caller_profile->destination_number); $database->fields['context'] = $context; $database->fields['network_addr'] = urldecode($row->caller_profile->network_addr); } @@ -238,9 +245,20 @@ //if last_sent_callee_id_number is set use it for the destination_number if (($leg == 'a') && (strlen($xml->variables->last_sent_callee_id_number) > 0)) { - $database->fields['destination_number'] = urldecode($xml->variables->last_sent_callee_id_number); + $destination_number = urldecode($xml->variables->last_sent_callee_id_number); } + //remove the provider prefix + if (isset($xml->variables->provider_prefix) && isset($destination_number)) { + $provider_prefix = $xml->variables->provider_prefix; + if ($provider_prefix == substr($destination_number, 0, strlen($provider_prefix))) { + $destination_number = substr($destination_number, strlen($provider_prefix), strlen($destination_number)); + } + } + + //store the destination_number + $database->fields['destination_number'] = $destination_number; + //store the call leg $database->fields['leg'] = $leg; @@ -614,6 +632,7 @@ return; } } + //loop through all attribues //foreach($xml->settings->param[1]->attributes() as $a => $b) { // echo $a,'="',$b,"\"
\n"; @@ -631,6 +650,7 @@ } xml_cdr_log("process cdr via post\n"); + //parse the xml and insert the data into the db process_xml_cdr($db, $leg, $xml_string); } diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 2663f7658f..1c25691826 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -742,48 +742,13 @@ } //destination if (permission_exists('xml_cdr_destination')) { - if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') { - //get outbound prefix variable from json table if exists - $json_string = trim($row["json"]); - $array = json_decode($json_string,true); - $remove_prefix = false; - $prefix = false; - if (is_array($array["app_log"]["application"])) { - foreach ($array["app_log"]["application"] as $application) { - $app_data = urldecode($application["@attributes"]["app_data"]); - if (substr($app_data,0,7) == "prefix=") { - $prefix = substr($app_data,7); - $remove_prefix = true; - } - } - } - } $content .= " "; $content .= " \n"; if (is_numeric($row['destination_number'])) { - if ($prefix) { - //confirms call was made with a prefix - $is_prefixed = substr(format_phone(escape(substr($row['destination_number'], 0, 20))),0,strlen($prefix)); - - //remove the prefix - if ($prefix == $is_prefixed) { - $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n"; - } - else { - $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; - } - } - else { - $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; - } + $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; } else { - if ($remove_prefix == 'true') { - $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n"; - } - else { - $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; - } + $content .= escape(substr($row['destination_number'], 0, 20))."\n"; } $content .= " \n"; $content .= " \n"; diff --git a/core/domains/app_config.php b/core/domains/app_config.php index 39cc8018fc..b49bdb6f7e 100644 --- a/core/domains/app_config.php +++ b/core/domains/app_config.php @@ -1,5 +1,5 @@ +$text['button-permissions']['en-us'] = "Permissions"; +$text['button-permissions']['en-gb'] = "Permissions"; +$text['button-permissions']['ar-eg'] = ""; +$text['button-permissions']['de-at'] = "Berechtigungen"; //copied from de-de +$text['button-permissions']['de-ch'] = "Berechtigungen"; //copied from de-de +$text['button-permissions']['de-de'] = "Berechtigungen"; +$text['button-permissions']['es-cl'] = "Permisos"; +$text['button-permissions']['es-mx'] = "Permisos"; //copied from es-cl +$text['button-permissions']['fr-ca'] = "Permissions"; //copied from fr-fr +$text['button-permissions']['fr-fr'] = "Permissions"; +$text['button-permissions']['he-il'] = "הרשאות"; +$text['button-permissions']['it-it'] = "Permessi"; +$text['button-permissions']['nl-nl'] = ""; +$text['button-permissions']['pl-pl'] = "Uprawnienia"; +$text['button-permissions']['pt-br'] = "Permissões"; //copied from pt-pt +$text['button-permissions']['pt-pt'] = "Permissões"; +$text['button-permissions']['ro-ro'] = ""; +$text['button-permissions']['ru-ru'] = "Права"; +$text['button-permissions']['sv-se'] = "Rättigheter"; +$text['button-permissions']['uk-ua'] = "Привілеї"; + +?> \ No newline at end of file diff --git a/core/users/user_edit.php b/core/users/user_edit.php index 8a2d3a27cd..98f3df7344 100644 --- a/core/users/user_edit.php +++ b/core/users/user_edit.php @@ -136,7 +136,7 @@ $group_uuid_name = $_POST["group_uuid_name"]; $user_enabled = $_POST["user_enabled"]; $api_key = $_POST["api_key"]; - if (permission_exists('message_view')) { + if (permission_exists('message_key')) { $message_key = $_POST["message_key"]; } @@ -329,7 +329,7 @@ unset($sql, $parameters, $row); //check to see if message key is set - if (permission_exists('message_view')) { + if (permission_exists('message_key')) { $sql = "select user_setting_uuid, user_setting_value from v_user_settings "; $sql .= "where user_setting_category = 'message' "; $sql .= "and user_setting_subcategory = 'key' "; @@ -670,12 +670,18 @@ echo "
".$text['message-unsaved_changes']."
"; } if (permission_exists('user_add') || permission_exists('user_edit')) { - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'users.php']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'users.php']); } + $button_margin = 'margin-left: 15px;'; if (permission_exists('ticket_add') || permission_exists('ticket_edit')) { - echo button::create(['type'=>'button','label'=>$text['button-tickets'],'icon'=>'tags','style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/tickets/tickets.php?user_uuid='.urlencode($user_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-tickets'],'icon'=>'tags','style'=>$button_margin,'link'=>PROJECT_PATH.'/app/tickets/tickets.php?user_uuid='.urlencode($user_uuid)]); + unset($button_margin); } - echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','onclick'=>'submit_form();']); + if (permission_exists('user_permissions') && file_exists('../../app/user_permissions/user_permissions.php')) { + echo button::create(['type'=>'button','label'=>$text['button-permissions'],'icon'=>'key','style'=>$button_margin,'link'=>PROJECT_PATH.'/app/user_permissions/user_permissions.php?id='.urlencode($user_uuid)]); + unset($button_margin); + } + echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;','onclick'=>'submit_form();']); echo " \n"; echo "
\n"; echo "\n"; @@ -1013,7 +1019,7 @@ echo " "; } - if (permission_exists('message_view')) { + if (permission_exists('message_key')) { echo " "; echo " ".$text['label-message_key'].""; echo " \n"; @@ -1032,8 +1038,8 @@ echo "\n"; echo "\n"; echo " \n"; echo "
\n"; echo $text['description-enabled']."\n"; @@ -1059,16 +1065,7 @@ } echo "