diff --git a/app/call_block/resources/dashboard/config.php b/app/call_block/resources/dashboard/config.php index 96bd82114e..fa7d3b2657 100644 --- a/app/call_block/resources/dashboard/config.php +++ b/app/call_block/resources/dashboard/config.php @@ -45,4 +45,3 @@ $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user'; $y++; ?> - diff --git a/app/call_centers/app_config.php b/app/call_centers/app_config.php index c4c9879568..f1a46d8a58 100644 --- a/app/call_centers/app_config.php +++ b/app/call_centers/app_config.php @@ -216,7 +216,7 @@ $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_center"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "record_name"; $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "\${sip_from_user}-\${sip_to_user}-\${strftime(%Y)}\${strftime(%b)}\${strftime(%d)}.\${record_ext}"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "\${sip_from_user}-\${sip_to_user}-\${strftime(%Y)}\${strftime(%b)}\${strftime(%d)}-\${uuid}.\${record_ext}"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Custom name for call recording. Options: \${record_ext}, \${sip_from_user}, \${sip_to_user}, \${caller_id_number}, \${uuid}"; $y++; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 3db04a2404..0d02440c7c 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -42,6 +42,10 @@ $language = new text; $text = $language->get(); +//initialize database and settings + $database = database::new(); + $settings = new settings(['database' => $database, $_SESSION['domain_uuid'] ?? '', $_SESSION['user_uuid'] ?? '']); + //set the defaults $queue_name = ''; $queue_extension = ''; @@ -61,24 +65,24 @@ $action = "add"; } -//get the domain_uuid +//get the domain details $domain_uuid = $_SESSION['domain_uuid']; + $domain_name = $_SESSION['domain_name']; -//initialize the destinations object +//initialize the destination object $destination = new destinations; //get total call center queues count from the database, check limit, if defined if ($action == 'add') { - if (!empty($_SESSION['limit']['call_center_queues']['numeric'])) { + if (!empty($settings->get('limit','call_center_queues', ''))) { $sql = "select count(*) from v_call_center_queues "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; - $database = new database; $total_call_center_queues = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); - if ($total_call_center_queues >= $_SESSION['limit']['call_center_queues']['numeric']) { - message::add($text['message-maximum_queues'].' '.$_SESSION['limit']['call_center_queues']['numeric'], 'negative'); + if ($total_call_center_queues >= $settings->get('limit','call_center_queues', 0)) { + message::add($text['message-maximum_queues'].' '.$settings->get('limit','call_center_queues', ''), 'negative'); header('Location: call_center_queues.php'); return; } @@ -124,7 +128,7 @@ $queue_context = $_POST["queue_context"]; } else if ($action == 'add') { - $queue_context = $_SESSION['domain_name']; + $queue_context = $domain_name; } //remove invalid characters @@ -149,7 +153,6 @@ $sql .= "and t.call_center_queue_uuid = q.call_center_queue_uuid; "; $parameters['domain_uuid'] = $domain_uuid; $parameters['call_center_tier_uuid'] = $call_center_tier_uuid; - $database = new database; $tiers = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -168,7 +171,7 @@ if ($esl->is_connected()) { //callcenter_config tier del [queue_name] [agent_name] if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid)) { - $cmd = "callcenter_config tier del ".$queue_extension."@".$_SESSION['domain_name']." ".$call_center_agent_uuid; + $cmd = "callcenter_config tier del ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid; $response = event_socket::api($cmd); } } @@ -181,7 +184,6 @@ $p = permissions::new(); $p->add('call_center_tier_delete', 'temp'); - $database = new database; $database->app_name = 'call_centers'; $database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370'; $database->delete($array); @@ -205,7 +207,6 @@ $sql = "select * from v_call_center_queues "; $sql .= "where call_center_queue_uuid = :call_center_queue_uuid "; $parameters['call_center_queue_uuid'] = $call_center_queue_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { //if (!permission_exists('call_center_queue_domain')) { @@ -298,8 +299,8 @@ //add the recording path if needed if (!empty($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; + if (file_exists($settings->get('switch','recordings', '').'/'.$domain_name.'/'.$queue_greeting)) { + $queue_greeting_path = $settings->get('switch','recordings', '').'/'.$domain_name.'/'.$queue_greeting; } else { $queue_greeting_path = trim($queue_greeting); @@ -371,8 +372,8 @@ //add definable export variables can be set in default settings $export_variables = 'call_center_queue_uuid,sip_h_Alert-Info'; - if (!empty($_SESSION['call_center']['export_vars'])) { - foreach ($_SESSION['call_center']['export_vars'] as $export_variable) { + if (!empty($settings->get('call_center','export_vars', []))) { + foreach ($settings->get('call_center','export_vars', []) as $export_variable) { $export_variables .= ','.$export_variable; } } @@ -413,7 +414,7 @@ if (!empty($queue_cc_exit_keys)) { $dialplan_xml .= " \n"; } - $dialplan_xml .= " \n"; + $dialplan_xml .= " \n"; if ($destination->valid($queue_timeout_app.':'.$queue_timeout_data)) { $dialplan_xml .= " \n"; } @@ -439,7 +440,6 @@ $p->add("dialplan_edit", "temp"); //save to the data - $database = new database; $database->app_name = 'call_centers'; $database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370'; $database->save($array); @@ -457,7 +457,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["domain_name"]); + $cache->delete("dialplan:".$domain_name); //clear the destinations session array if (isset($_SESSION['destinations']['array'])) { @@ -496,19 +496,19 @@ */ //add the agent if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid) && is_numeric($tier_level) && is_numeric($tier_position)) { - $cmd = "callcenter_config tier add ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position; + $cmd = "callcenter_config tier add ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position; $response = event_socket::api($cmd); } usleep(200); //agent set level if (is_numeric($queue_extension) && is_numeric($tier_level)) { - $cmd = "callcenter_config tier set level ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level; + $cmd = "callcenter_config tier set level ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid." ".$tier_level; $response = event_socket::api($cmd); } usleep(200); //agent set position if (is_numeric($queue_extension) && is_numeric($tier_position)) { - $cmd = "callcenter_config tier set position ".$queue_extension."@".$_SESSION["domain_name"]." ".$tier_position; + $cmd = "callcenter_config tier set position ".$queue_extension."@".$domain_name." ".$tier_position; $response = event_socket::api($cmd); } usleep(200); @@ -538,7 +538,6 @@ $sql .= "and call_center_queue_uuid = :call_center_queue_uuid "; $parameters['domain_uuid'] = $domain_uuid; $parameters['call_center_queue_uuid'] = $call_center_queue_uuid; - $database = new database; $call_center_queues = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -587,17 +586,16 @@ $sql .= "order by tier_level asc, tier_position asc, a.agent_name asc"; $parameters['domain_uuid'] = $domain_uuid; $parameters['call_center_queue_uuid'] = $call_center_queue_uuid ?? null; - $database = new database; $tiers = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); //add an empty row to the tiers array if (count($tiers) == 0) { - $rows = $_SESSION['call_center']['agent_add_rows']['numeric'] ?? null; + $rows = $settings->get('call_center','agent_add_rows', null); $id = 0; } if (count($tiers) > 0) { - $rows = $_SESSION['call_center']['agent_edit_rows']['numeric']; + $rows = $settings->get('call_center','agent_edit_rows', null); $id = count($tiers)+1; } for ($x = 0; $x < $rows; $x++) { @@ -615,7 +613,6 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "order by agent_name asc"; $parameters['domain_uuid'] = $domain_uuid; - $database = new database; $agents = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -624,6 +621,7 @@ $audio_files[0] = $sounds->get(); unset($sounds); +//get the list of sounds if (permission_exists('call_center_announce_sound')) { $sounds = new sounds; $sounds->sound_types = ['recordings']; @@ -646,7 +644,7 @@ if (empty($queue_tier_rule_no_agent_no_wait)) { $queue_tier_rule_no_agent_no_wait = "true"; } if (empty($queue_discard_abandoned_after)) { $queue_discard_abandoned_after = "900"; } if (empty($queue_abandoned_resume_allowed)) { $queue_abandoned_resume_allowed = "false"; } - if (empty($queue_context)) { $queue_context = $_SESSION['domain_name']; } + if (empty($queue_context)) { $queue_context = $domain_name; } //create token $object = new token; @@ -667,12 +665,8 @@ } //set the record_template - if (empty($_SESSION['call_center']['record_name']['text'])) { - $record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}"; - } - else { - $record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".$_SESSION['call_center']['record_name']['text']; - } + $record_template = $settings->get('switch','recordings', '')."/".$domain_name."/archive/"; + $record_template .= $settings->get('call_center','record_name', "\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}"); //show the content if (permission_exists('recording_play') || permission_exists('recording_download')) { @@ -757,7 +751,7 @@ } echo "\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'call_center_queues.php']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme','button_icon_back', ''),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'call_center_queues.php']); if ($action == "update") { if (permission_exists('call_center_wallboard')) { @@ -765,10 +759,10 @@ } //echo button::create(['type'=>'button','label'=>$text['button-stop'],'icon'=>$_SESSION['theme']['button_icon_stop'],'link'=>'cmd.php?cmd=unload&id='.urlencode($call_center_queue_uuid)]); //echo button::create(['type'=>'button','label'=>$text['button-start'],'icon'=>$_SESSION['theme']['button_icon_start'],'link'=>'cmd.php?cmd=load&id='.urlencode($call_center_queue_uuid)]); - echo button::create(['type'=>'button','label'=>$text['button-reload'],'icon'=>$_SESSION['theme']['button_icon_reload'],'link'=>'cmd.php?cmd=reload&id='.urlencode($call_center_queue_uuid)]); - echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/call_center_active/call_center_active.php?queue_name='.urlencode($call_center_queue_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-reload'],'icon'=>$settings->get('theme','button_icon_reload', ''),'link'=>'cmd.php?cmd=reload&id='.urlencode($call_center_queue_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$settings->get('theme','button_icon_view', ''),'style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/call_center_active/call_center_active.php?queue_name='.urlencode($call_center_queue_uuid)]); } - echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']); + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$settings->get('theme','button_icon_save', ''),'id'=>'btn_save']); echo "
\n"; echo "
\n"; echo "\n"; @@ -791,7 +785,7 @@ echo " ".$text['label-extension']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " get('call_center','extension_range', '')."\">\n"; echo "
\n"; echo $text['description-extension']."\n"; echo "\n"; @@ -818,8 +812,8 @@ if ($key == 'recordings') { if ( !empty($instance_value) && - ($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) && - file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME)) + ($instance_value == $row["value"] || $instance_value == $settings->get('switch','recordings', '')."/".$domain_name.'/'.$row["value"]) && + file_exists($settings->get('switch','recordings', '')."/".$domain_name.'/'.pathinfo($row["value"], PATHINFO_BASENAME)) ) { $selected = "selected='selected'"; $playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME); @@ -862,7 +856,7 @@ case 'ogg' : $mime_type = 'audio/ogg'; break; } echo ""; - echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]); + echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$settings->get('theme','button_icon_play', ''),'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]); unset($playable, $mime_type); } echo "
\n"; @@ -1318,8 +1312,8 @@ if ($key == 'recordings') { if ( !empty($instance_value) && - ($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) && - file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME)) + ($instance_value == $row["value"] || $instance_value == $settings->get('switch','recordings', '')."/".$domain_name.'/'.$row["value"]) && + file_exists($settings->get('switch','recordings', '')."/".$domain_name.'/'.pathinfo($row["value"], PATHINFO_BASENAME)) ) { $selected = "selected='selected'"; $playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME); @@ -1362,7 +1356,7 @@ case 'ogg' : $mime_type = 'audio/ogg'; break; } echo ""; - echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]); + echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$settings->get('theme','button_icon_play', ''),'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]); unset($playable, $mime_type); } echo "
\n"; diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index 8250c220f1..0060eb7092 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.php @@ -253,9 +253,6 @@ if (is_array($call_recordings) && @sizeof($call_recordings) != 0) { $x = 0; foreach ($call_recordings as $row) { - //add padding to the call recording length - $call_recording_length_padding = (!empty($row['call_recording_length'])) ? str_pad($row['call_recording_length'], 2, '0', STR_PAD_LEFT) : ''; - //playback progress bar if (permission_exists('call_recording_play')) { echo "".(permission_exists('xml_cdr_details') ? "" : null)."\n"; @@ -301,7 +298,7 @@ } echo " \n"; } - echo " ".($row['call_recording_length'] <= 59 ? '0:' : null).escape($call_recording_length_padding)."\n"; + echo " ".escape(gmdate("G:i:s", $row['call_recording_length']))."\n"; echo " ".escape($row['call_recording_date_formatted'])." ".escape($row['call_recording_time_formatted'])."\n"; echo " ".($row['call_direction'] != '' ? escape($text['label-'.$row['call_direction']]) : null)."\n"; if (permission_exists('xml_cdr_details')) { diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index ed526cba09..bdcae911f5 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -72,7 +72,7 @@ } //get the call recording extension - $record_extension = $settings->get('call_recordings', 'record_extension', 'wav'); + $record_extension = $settings->get('call_recordings', 'record_extension', 'mp3'); //get total destination count from the database, check limit, if defined if (!permission_exists('destination_domain')) { @@ -462,7 +462,6 @@ } //authorized specific dialplan_detail_type that are safe, sanitize all other values - $dialplan_detail_type = $settings->get('dialplan', 'destination', ''); switch ($dialplan_detail_type) { case 'destination_number': break; diff --git a/app/destinations/resources/classes/destinations.php b/app/destinations/resources/classes/destinations.php index 6b05c30c64..2e5fea96de 100644 --- a/app/destinations/resources/classes/destinations.php +++ b/app/destinations/resources/classes/destinations.php @@ -52,22 +52,33 @@ if (!class_exists('destinations')) { private $list_page; private $table; private $uuid_prefix; + private $database; private $settings; /** * Called when the object is created */ - public function __construct($settings = null) { + public function __construct($setting_array = []) { + + //open a database connection + if (empty($setting_array['database'])) { + $this->database = database::new(); + } else { + $this->database = $setting_array['database']; + } + + //get the settings object + if (empty($setting_array['settings'])) { + $this->settings = new settings(); + } else { + $this->settings = $setting_array['settings']; + } + //set the domain details if (is_null($this->domain_uuid)) { $this->domain_uuid = $_SESSION['domain_uuid']; } - //get the email queue settings - if (!isset($settings)) { - $this->settings = new settings(); - } - //assign private variables $this->app_name = 'destinations'; $this->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139'; @@ -180,8 +191,7 @@ if (!class_exists('destinations')) { $sql = "select domain_name from v_domains "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $this->domain_uuid; - $database = new database; - $this->domain_name = $database->select($sql, $parameters, 'column'); + $this->domain_name = $this->database->select($sql, $parameters, 'column'); //initialize variable $response = ''; @@ -252,8 +262,7 @@ if (!class_exists('destinations')) { } $sql .= "order by ".trim($row['order_by']); $sql = str_replace("\${domain_uuid}", $this->domain_uuid, $sql); - $database = new database; - $result = $database->select($sql, null, 'all'); + $result = $this->database->select($sql, null, 'all'); $this->destinations[$x]['result']['sql'] = $sql; $this->destinations[$x]['result']['data'] = $result; @@ -550,9 +559,6 @@ if (!class_exists('destinations')) { //set the global variables global $db_type; - //connect to the database - $database = new database; - //set default values $destination_name = ''; $destination_id = ''; @@ -561,7 +567,7 @@ if (!class_exists('destinations')) { $sql = "select domain_name from v_domains "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $this->domain_uuid; - $this->domain_name = $database->select($sql, $parameters, 'column'); + $this->domain_name = $this->database->select($sql, $parameters, 'column'); //get the destinations if (!is_array($this->destinations)) { @@ -625,7 +631,7 @@ if (!class_exists('destinations')) { } $sql .= "order by ".trim($row['order_by']); $sql = str_replace("\${domain_uuid}", $this->domain_uuid, $sql); - $result = $database->select($sql, null, 'all'); + $result = $this->database->select($sql, null, 'all'); $this->destinations[$x]['result']['sql'] = $sql; $this->destinations[$x]['result']['data'] = $result; @@ -764,14 +770,11 @@ if (!class_exists('destinations')) { //set the global variables global $db_type; - //connect to the database - $database = new database; - //get the domain_name $sql = "select domain_name from v_domains "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $this->domain_uuid; - $this->domain_name = $database->select($sql, $parameters, 'column'); + $this->domain_name = $this->database->select($sql, $parameters, 'column'); //get the destinations if (!is_array($this->destinations)) { @@ -836,7 +839,7 @@ if (!class_exists('destinations')) { } $sql .= "order by ".trim($row['order_by']); $sql = str_replace("\${domain_uuid}", $this->domain_uuid, $sql); - $result = $database->select($sql, null, 'all'); + $result = $this->database->select($sql, null, 'all'); $this->destinations[$x]['result']['sql'] = $sql; $this->destinations[$x]['result']['data'] = $result; @@ -1063,8 +1066,7 @@ if (!class_exists('destinations')) { $sql = "select dialplan_uuid, destination_context from v_destinations "; $sql .= "where destination_uuid = :destination_uuid "; $parameters['destination_uuid'] = $record['uuid']; - $database = new database; - $row = $database->select($sql, $parameters, 'row'); + $row = $this->database->select($sql, $parameters, 'row'); unset($sql, $parameters); //include dialplan in array @@ -1086,10 +1088,9 @@ if (!class_exists('destinations')) { $p->add('dialplan_detail_delete', 'temp'); //execute delete - $database = new database; - $database->app_name = $this->app_name; - $database->app_uuid = $this->app_uuid; - $database->delete($array); + $this->database->app_name = $this->app_name; + $this->database->app_uuid = $this->app_uuid; + $this->database->delete($array); unset($array); //revoke temporary permissions @@ -1255,8 +1256,7 @@ if (!class_exists('destinations')) { if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('destination_summary_all'))) { $parameters['domain_uuid'] = $this->domain_uuid; } - $database = new database; - $summary = $database->select($sql, $parameters, 'all'); + $summary = $this->database->select($sql, $parameters, 'all'); unset($parameters); //if (!empty($this->start_stamp_begin) && !empty($this->start_stamp_end)) { diff --git a/app/devices/app_config.php b/app/devices/app_config.php index da31452c5a..a346b9fd38 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -224,6 +224,9 @@ $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "device_serial_number"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "device_model"; //$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; @@ -462,6 +465,11 @@ $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_serial_number"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_model"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "phone_model"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; diff --git a/app/devices/app_defaults.php b/app/devices/app_defaults.php index 9dde91d806..1df2f32a0b 100644 --- a/app/devices/app_defaults.php +++ b/app/devices/app_defaults.php @@ -77,86 +77,90 @@ if ($domains_processed == 1) { unset($sql, $device_keys); //set the device profile keys - $sql = "select count(*) from v_device_profile_keys "; - $num_rows = $database->select($sql, null, 'column'); - if ($num_rows == 0) { - //get the device profile keys from device_keys table - $sql = "select * from v_device_keys "; - $sql .= "where device_profile_uuid is not null "; - $device_profile_keys = $database->select($sql, null, 'all'); + if ($database->column_exists('v_device_keys', 'device_profile_uuid')) { + $sql = "select count(*) from v_device_profile_keys "; + $num_rows = $database->select($sql, null, 'column'); + if ($num_rows == 0) { + //get the device profile keys from device_keys table + $sql = "select * from v_device_keys "; + $sql .= "where device_profile_uuid is not null "; + $device_profile_keys = $database->select($sql, null, 'all'); - //loop through the device_keys to build the data array - if (!empty($device_profile_keys)) { - foreach ($device_profile_keys as $index => $row) { - $array['device_profile_keys'][$index]['device_profile_key_uuid'] = $row["device_key_uuid"]; - $array['device_profile_keys'][$index]['domain_uuid'] = $row["domain_uuid"]; - $array['device_profile_keys'][$index]['device_profile_uuid'] = $row["device_profile_uuid"]; - $array['device_profile_keys'][$index]['profile_key_id'] = $row["device_key_id"]; - $array['device_profile_keys'][$index]['profile_key_category'] = $row["device_key_category"]; - $array['device_profile_keys'][$index]['profile_key_vendor'] = $row["device_key_vendor"]; - $array['device_profile_keys'][$index]['profile_key_type'] = $row["device_key_type"]; - $array['device_profile_keys'][$index]['profile_key_line'] = $row["device_key_line"]; - $array['device_profile_keys'][$index]['profile_key_value'] = $row["device_key_value"]; - $array['device_profile_keys'][$index]['profile_key_extension'] = $row["device_key_extension"]; - $array['device_profile_keys'][$index]['profile_key_protected'] = $row["device_key_protected"]; - $array['device_profile_keys'][$index]['profile_key_label'] = $row["device_key_label"]; - $array['device_profile_keys'][$index]['profile_key_icon'] = $row["device_key_icon"]; + //loop through the device_keys to build the data array + if (!empty($device_profile_keys)) { + foreach ($device_profile_keys as $index => $row) { + $array['device_profile_keys'][$index]['device_profile_key_uuid'] = $row["device_key_uuid"]; + $array['device_profile_keys'][$index]['domain_uuid'] = $row["domain_uuid"]; + $array['device_profile_keys'][$index]['device_profile_uuid'] = $row["device_profile_uuid"]; + $array['device_profile_keys'][$index]['profile_key_id'] = $row["device_key_id"]; + $array['device_profile_keys'][$index]['profile_key_category'] = $row["device_key_category"]; + $array['device_profile_keys'][$index]['profile_key_vendor'] = $row["device_key_vendor"]; + $array['device_profile_keys'][$index]['profile_key_type'] = $row["device_key_type"]; + $array['device_profile_keys'][$index]['profile_key_line'] = $row["device_key_line"]; + $array['device_profile_keys'][$index]['profile_key_value'] = $row["device_key_value"]; + $array['device_profile_keys'][$index]['profile_key_extension'] = $row["device_key_extension"]; + $array['device_profile_keys'][$index]['profile_key_protected'] = $row["device_key_protected"]; + $array['device_profile_keys'][$index]['profile_key_label'] = $row["device_key_label"]; + $array['device_profile_keys'][$index]['profile_key_icon'] = $row["device_key_icon"]; + } + } + + //save the array + if (!empty($array)) { + $p = permissions::new(); + $p->add('device_profile_key_add', 'temp'); + + $database->app_name = 'devices'; + $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; + $database->save($array); + $response = $database->message; + unset($array); + + $p->delete('device_profile_key_add', 'temp'); } } - - //save the array - if (!empty($array)) { - $p = permissions::new(); - $p->add('device_profile_key_add', 'temp'); - - $database->app_name = 'devices'; - $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; - $database->save($array); - $response = $database->message; - unset($array); - - $p->delete('device_profile_key_add', 'temp'); - } + unset($sql, $device_profile_keys); } - unset($sql, $device_profile_keys); //set the device profile settings - $sql = "select count(*) from v_device_profile_settings "; - $num_rows = $database->select($sql, null, 'column'); - if ($num_rows == 0) { - //get the device profile keys from device_keys table - $sql = "select * from v_device_settings "; - $sql .= "where device_profile_uuid is not null "; - $device_profile_keys = $database->select($sql, null, 'all'); + if ($database->column_exists('v_device_settings', 'device_profile_uuid')) { + $sql = "select count(*) from v_device_profile_settings "; + $num_rows = $database->select($sql, null, 'column'); + if ($num_rows == 0) { + //get the device profile keys from device_keys table + $sql = "select * from v_device_settings "; + $sql .= "where device_profile_uuid is not null "; + $device_profile_keys = $database->select($sql, null, 'all'); - //loop through the device_keys to build the data array - if (!empty($device_profile_keys)) { - foreach ($device_profile_keys as $index => $row) { - $array['device_profile_settings'][$index]['device_profile_setting_uuid'] = $row["device_setting_uuid"]; - $array['device_profile_settings'][$index]['domain_uuid'] = $row["domain_uuid"]; - $array['device_profile_settings'][$index]['device_profile_uuid'] = $row["device_profile_uuid"]; - $array['device_profile_settings'][$index]['profile_setting_name'] = $row["device_setting_subcategory"]; - $array['device_profile_settings'][$index]['profile_setting_value'] = $row["device_setting_value"]; - $array['device_profile_settings'][$index]['profile_setting_enabled'] = $row["device_setting_enabled"]; - $array['device_profile_settings'][$index]['profile_setting_description'] = $row["device_setting_description"]; + //loop through the device_keys to build the data array + if (!empty($device_profile_keys)) { + foreach ($device_profile_keys as $index => $row) { + $array['device_profile_settings'][$index]['device_profile_setting_uuid'] = $row["device_setting_uuid"]; + $array['device_profile_settings'][$index]['domain_uuid'] = $row["domain_uuid"]; + $array['device_profile_settings'][$index]['device_profile_uuid'] = $row["device_profile_uuid"]; + $array['device_profile_settings'][$index]['profile_setting_name'] = $row["device_setting_subcategory"]; + $array['device_profile_settings'][$index]['profile_setting_value'] = $row["device_setting_value"]; + $array['device_profile_settings'][$index]['profile_setting_enabled'] = $row["device_setting_enabled"]; + $array['device_profile_settings'][$index]['profile_setting_description'] = $row["device_setting_description"]; + } + } + + //save the array + if (!empty($array)) { + $p = permissions::new(); + $p->add('device_profile_setting_add', 'temp'); + + $database->app_name = 'devices'; + $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; + $database->save($array); + $response = $database->message; + unset($array); + + $p->delete('device_profile_setting_add', 'temp'); } } - - //save the array - if (!empty($array)) { - $p = permissions::new(); - $p->add('device_profile_setting_add', 'temp'); - - $database->app_name = 'devices'; - $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; - $database->save($array); - $response = $database->message; - unset($array); - - $p->delete('device_profile_setting_add', 'temp'); - } + unset($sql, $device_profile_keys); } - unset($sql, $device_profile_keys); //add device vendor functions to the database $sql = "select count(*) from v_device_vendors; "; @@ -247,6 +251,7 @@ if ($domains_processed == 1) { $sql = "update v_device_lines set label = display_name where label is null;\n"; $database->execute($sql); unset($sql); + } ?> diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index a1893028e9..1fe1aa92be 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -3198,6 +3198,32 @@ $text['label-device_location']['zh-cn'] = "地点"; $text['label-device_location']['ja-jp'] = "位置"; $text['label-device_location']['ko-kr'] = "위치"; +$text['label-device_serial_number']['en-us'] = "Serial Number"; +$text['label-device_serial_number']['en-gb'] = "Serial Number"; +$text['label-device_serial_number']['ar-eg'] = ""; +$text['label-device_serial_number']['de-at'] = ""; +$text['label-device_serial_number']['de-ch'] = ""; +$text['label-device_serial_number']['de-de'] = ""; +$text['label-device_serial_number']['el-gr'] = ""; +$text['label-device_serial_number']['es-cl'] = ""; +$text['label-device_serial_number']['es-mx'] = ""; +$text['label-device_serial_number']['fr-ca'] = ""; +$text['label-device_serial_number']['fr-fr'] = ""; +$text['label-device_serial_number']['he-il'] = ""; +$text['label-device_serial_number']['it-it'] = ""; +$text['label-device_serial_number']['ka-ge'] = ""; +$text['label-device_serial_number']['nl-nl'] = ""; +$text['label-device_serial_number']['pl-pl'] = ""; +$text['label-device_serial_number']['pt-br'] = ""; +$text['label-device_serial_number']['pt-pt'] = ""; +$text['label-device_serial_number']['ro-ro'] = ""; +$text['label-device_serial_number']['ru-ru'] = ""; +$text['label-device_serial_number']['sv-se'] = ""; +$text['label-device_serial_number']['uk-ua'] = ""; +$text['label-device_serial_number']['zh-cn'] = ""; +$text['label-device_serial_number']['ja-jp'] = ""; +$text['label-device_serial_number']['ko-kr'] = ""; + $text['label-device_key_vendor']['en-us'] = "Vendor"; $text['label-device_key_vendor']['en-gb'] = "Vendor"; $text['label-device_key_vendor']['ar-eg'] = "البائع"; @@ -6634,6 +6660,32 @@ $text['description-device_location']['zh-cn'] = "输入设备位置。"; $text['description-device_location']['ja-jp'] = "デバイスの場所を入力します。"; $text['description-device_location']['ko-kr'] = "장치 위치를 입력합니다."; +$text['description-device_serial_number']['en-us'] = "Enter the device serial number."; +$text['description-device_serial_number']['en-gb'] = "Enter the device serial number."; +$text['description-device_serial_number']['ar-eg'] = ""; +$text['description-device_serial_number']['de-at'] = ""; +$text['description-device_serial_number']['de-ch'] = ""; +$text['description-device_serial_number']['de-de'] = ""; +$text['description-device_serial_number']['el-gr'] = ""; +$text['description-device_serial_number']['es-cl'] = ""; +$text['description-device_serial_number']['es-mx'] = ""; +$text['description-device_serial_number']['fr-ca'] = ""; +$text['description-device_serial_number']['fr-fr'] = ""; +$text['description-device_serial_number']['he-il'] = ""; +$text['description-device_serial_number']['it-it'] = ""; +$text['description-device_serial_number']['ka-ge'] = ""; +$text['description-device_serial_number']['nl-nl'] = ""; +$text['description-device_serial_number']['pl-pl'] = ""; +$text['description-device_serial_number']['pt-br'] = ""; +$text['description-device_serial_number']['pt-pt'] = ""; +$text['description-device_serial_number']['ro-ro'] = ""; +$text['description-device_serial_number']['ru-ru'] = ""; +$text['description-device_serial_number']['sv-se'] = ""; +$text['description-device_serial_number']['uk-ua'] = ""; +$text['description-device_serial_number']['zh-cn'] = ""; +$text['description-device_serial_number']['ja-jp'] = ""; +$text['description-device_serial_number']['ko-kr'] = ""; + $text['description-device_time_zone']['en-us'] = "Enter the time zone."; $text['description-device_time_zone']['en-gb'] = "Enter the time zone."; $text['description-device_time_zone']['ar-eg'] = "أدخل المنطقة الزمنية"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 10f5035460..b8cedfff56 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -119,12 +119,12 @@ //$device_provisioned_ip = $_POST["device_provisioned_ip"]; $domain_uuid = $_POST["domain_uuid"]; $device_label = $_POST["device_label"]; - $device_label = $_POST["device_label"]; $device_user_uuid = $_POST["device_user_uuid"]; $device_username = $_POST["device_username"]; $device_password = $_POST["device_password"]; $device_vendor = $_POST["device_vendor"]; $device_location = $_POST["device_location"]; + $device_serial_number = $_POST["device_serial_number"]; $device_uuid_alternate = $_POST["device_uuid_alternate"] ?? null; $device_model = $_POST["device_model"] ?? null; $device_firmware_version = $_POST["device_firmware_version"] ?? null; @@ -270,6 +270,9 @@ if (permission_exists('device_location')) { $array['devices'][0]['device_location'] = $device_location; } + if (permission_exists('device_serial_number')) { + $array['devices'][0]['device_serial_number'] = $device_serial_number; + } if (permission_exists('device_alternate')) { $array['devices'][0]['device_uuid_alternate'] = is_uuid($device_uuid_alternate) ? $device_uuid_alternate : null; } @@ -517,12 +520,12 @@ $device_provisioned_ip = $row["device_provisioned_ip"]; $domain_uuid = $row["domain_uuid"]; $device_label = $row["device_label"]; - $device_label = $row["device_label"]; $device_user_uuid = $row["device_user_uuid"]; $device_username = $row["device_username"]; $device_password = $row["device_password"]; $device_vendor = $row["device_vendor"]; $device_location = $row["device_location"]; + $device_serial_number = $row["device_serial_number"]; $device_uuid_alternate = $row["device_uuid_alternate"]; $device_model = $row["device_model"]; $device_firmware_version = $row["device_firmware_version"]; @@ -1917,6 +1920,19 @@ echo "\n"; } + if (permission_exists('device_serial_number')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-device_serial_number']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-device_serial_number']."\n"; + echo "\n"; + echo "\n"; + } + if (permission_exists('device_model')) { echo "\n"; echo "\n"; diff --git a/app/devices/devices.php b/app/devices/devices.php index af2fb3015b..ec56e1a667 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -101,17 +101,6 @@ $total_devices = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); -//get the domains if user has permission for show all - $domains = []; - if ($has_device_domain_all) { - $rows = $database->select("select domain_uuid, domain_name from v_domains where domain_enabled = 'true'"); - if (!empty($rows)) { - foreach ($rows as $row) { - $domains[$row['domain_uuid']] = $row['domain_name']; - } - } - } - //get the devices profiles $sql = "select * from v_device_profiles "; $sql .= "where true "; @@ -196,7 +185,11 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select d.*, d2.device_label as alternate_label, "; + $sql = "select "; + if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) { + $sql .= "d3.domain_name, "; + } + $sql .="d.*, d2.device_label as alternate_label, "; $sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'DD Mon YYYY') as provisioned_date_formatted, \n"; $sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'HH12:MI:SS am') as provisioned_time_formatted \n"; $sql .= "from v_devices as d, v_devices as d2 "; @@ -426,7 +419,7 @@ echo " \n"; } if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) { - echo " ".escape($domains[$row['domain_uuid']])."\n"; + echo " ".escape($row['domain_name'])."\n"; } echo " "; echo permission_exists('device_edit') ? "".escape(format_device_address($row['device_address']))."" : escape(format_device_address($row['device_address'])); diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index 0b116a691c..bdfa84c3d1 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -11,12 +11,17 @@ //include files include "resources/classes/permissions.php"; + include_once "resources/phpmailer/class.phpmailer.php"; + include_once "resources/phpmailer/class.smtp.php"; //increase limits set_time_limit(0); //ini_set('max_execution_time',1800); //30 minutes ini_set('memory_limit', '512M'); +//connect to the database + $database = database::new(); + //save the arguments to variables $script_name = $argv[0]; if (!empty($argv[1])) { @@ -76,7 +81,7 @@ //prevent the process running more than once if ($pid_exists) { - //echo "Cannot lock pid file {$pid_file}\n"; + echo "Cannot lock pid file {$pid_file}\n"; exit; } @@ -125,15 +130,10 @@ } } -//includes - include_once "resources/phpmailer/class.phpmailer.php"; - include_once "resources/phpmailer/class.smtp.php"; - //get the email details to send $sql = "select * from v_email_queue "; $sql .= "where email_queue_uuid = :email_queue_uuid "; $parameters['email_queue_uuid'] = $email_queue_uuid; - $database = new database(); $row = $database->select($sql, $parameters, 'row'); if (is_array($row)) { $domain_uuid = $row["domain_uuid"]; diff --git a/app/event_guard/resources/service/event_guard.php b/app/event_guard/resources/service/event_guard.php index b916d578df..e7c8db7090 100644 --- a/app/event_guard/resources/service/event_guard.php +++ b/app/event_guard/resources/service/event_guard.php @@ -233,7 +233,7 @@ $p->add('event_guard_log_edit', 'temp'); $database->app_name = 'event guard'; $database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637'; - $database->save($array); + $database->save($array, false); //$message = $database->message; $p->delete('event_guard_log_edit', 'temp'); unset($array); @@ -353,7 +353,7 @@ $p->add('event_guard_log_add', 'temp'); $database->app_name = 'event guard'; $database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637'; - $database->save($array); + $database->save($array, false); $p->delete('event_guard_log_add', 'temp'); //send debug information to the console diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 8542c3430b..0bddf373df 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -38,13 +38,56 @@ exit; } -//initialize the database object - $database = new database; +//get the domain and user UUIDs + $domain_uuid = $domain_uuid ?? ''; + $user_uuid = $user_uuid ?? ''; //add multi-lingual support $language = new text; $text = $language->get(); +//initialize the core objects + $domain_uuid = $_SESSION['domain_uuid'] ?? ''; + $user_uuid = $_SESSION['user_uuid'] ?? ''; + $config = config::load(); + $database = database::new(['config' => $config]); + $domain_name = $database->select('select domain_name from v_domains where domain_uuid = :domain_uuid', ['domain_uuid' => $domain_uuid], 'column'); + $settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]); + +//set defaults + $limit_extensions = $settings->get('limit', 'extensions', null); + $limit_devices = $settings->get('limit', 'devices', null); + $extension_limit_max = $settings->get('extension', 'limit_max', 5); + $extension_call_timeout = $settings->get('extension', 'call_timeout', 30); + $extension_max_registrations = $settings->get('extension', 'max_registrations', null); + $extension_password_length = $settings->get('extension', 'password_length', 20); //set default to 20 + $extension_password_strength = $settings->get('extension', 'password_strength', 4); //set default to use numbers, Upper/Lowercase letters, special characters + $extension_user_record_default = $settings->get('extension', 'user_record_default', ''); + $provision_path = $settings->get('provision', 'path', ''); + $provision_line_label = $settings->get('provision','line_label', null); + $provision_line_display_name = $settings->get('provision','line_display_name', null); + $provision_outbound_proxy_primary = $settings->get('provision','outbound_proxy_primary', null); + $provision_outbound_proxy_secondary = $settings->get('provision','outbound_proxy_primary', null); + $provision_server_address_primary = $settings->get('provision','outbound_proxy_primary', null); + $provision_server_address_secondary = $settings->get('provision','outbound_proxy_primary', null); + $provision_line_sip_port = $settings->get('provision','line_sip_port', null); + $provision_line_sip_transport = $settings->get('provision','line_sip_transport', null); + $provision_line_register_expires = $settings->get('provision','line_register_expires', null); + $theme_input_toggle_style = $settings->get('theme','input_toggle_style', ''); //set default to empty string + $voicemail_password_length = $settings->get('voicemail', 'password_length', 6); //set default to 6 + $voicemail_transcription_enabled_default = $settings->get('voicemail', 'transcription_enabled_default', false); //set default to false + $voicemail_enabled_default = $settings->get('voicemail', 'enabled_default', true); + $switch_voicemail = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail') . "/default/$domain_name"; + $switch_extensions = $settings->get('switch', 'extensions', '/etc/freeswitch/directory'); + $switch_sounds = $settings->get('switch', 'sounds', '/usr/share/freeswitch/sounds'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); + +//cast to integers if they have values + if ($limit_extensions !== null) $limit_extensions = intval($limit_extensions); + if ($limit_devices !== null) $limit_devices = intval($limit_devices); + if ($extension_password_length !== null) $extension_password_length = intval($extension_password_length); + if ($extension_max_registrations !== null) $extension_max_registrations = intval($extension_max_registrations); + //set the action as an add or an update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -57,16 +100,16 @@ //get total extension count from the database, check limit, if defined if ($action == 'add') { - if (!empty($_SESSION['limit']['extensions']['numeric'])) { - $sql = "select count(*) "; + if ($limit_extensions > 0) { + $sql = "select count(extension_uuid) "; $sql .= "from v_extensions "; $sql .= "where domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $total_extensions = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); - if ($total_extensions >= $_SESSION['limit']['extensions']['numeric']) { - message::add($text['message-maximum_extensions'].' '.$_SESSION['limit']['extensions']['numeric'], 'negative'); + if ($total_extensions >= $limit_extensions) { + message::add($text['message-maximum_extensions'].' '.$limit_extensions, 'negative'); header('Location: extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)); exit; } @@ -176,14 +219,14 @@ $user_uuid = $_POST["extension_users"][0]["user_uuid"] ?? null; //device provisioning variables - if (is_array($_POST["devices"]) && @sizeof($_POST["devices"]) != 0) { + if (!empty($_POST["devices"])) { //get the devices $sql = "select count(device_uuid) from v_devices "; $sql .= "where domain_uuid = :domain_uuid "; if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { $sql .= "and device_user_uuid = :user_uuid "; - $parameters['user_uuid'] = $_SESSION['user_uuid']; + $parameters['user_uuid'] = $user_uuid; } $sql .= "order by device_address asc "; $parameters['domain_uuid'] = $domain_uuid; @@ -195,8 +238,8 @@ !empty($device["device_address"]) && strtolower($device["device_address"]) == 'uuid' && ( - !isset($_SESSION['limit']['devices']['numeric']) || - $total_devices < $_SESSION['limit']['devices']['numeric'] + $limit_devices === null || + $total_devices < $limit_devices )) { $device_address = strtolower(uuid()); } @@ -229,7 +272,7 @@ $parameters['device_address'] = $device_address; $row = $database->select($sql, $parameters, 'row'); if (is_array($row)) { - if ($_SESSION['domain_uuid'] == $row['domain_uuid']) { + if ($domain_uuid == $row['domain_uuid']) { $device_uuid = $row['device_uuid']; $device_domain_name = $row['device_domain_name']; $device_unique = true; @@ -314,7 +357,7 @@ $domain_uuid = $_POST["domain_uuid"]; } else { - $domain_uuid = $_SESSION['domain_uuid']; + $domain_uuid = $domain_uuid; } //validate the token @@ -345,10 +388,8 @@ } //prevent users from bypassing extension limit by using range - if (!empty($_SESSION['limit']['extensions']['numeric'])) { - if (isset($total_extensions) && ($total_extensions ?? 0) + $range > $_SESSION['limit']['extensions']['numeric']) { - $range = $_SESSION['limit']['extensions']['numeric'] - $total_extensions; - } + if (isset($total_extensions) && ($total_extensions ?? 0) + $range > $limit_extensions) { + $range = $limit_extensions - $total_extensions; } //add or update the database @@ -401,10 +442,23 @@ //extension exists } else { + //password permission not assigned get the password from the database + if ($action == "update" && !permission_exists('extension_password')) { + $sql = "select password from v_extensions "; + $sql .= "where extension_uuid = :extension_uuid "; + $sql .= "and domain_uuid = :domain_uuid "; + $parameters['domain_uuid'] = $domain_uuid; + $parameters['extension_uuid'] = $extension_uuid; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row) && @sizeof($row) != 0) { + $password = $row["password"]; + } + unset($sql, $parameters, $row); + } //get the password length and strength - $password_length = $_SESSION["extension"]["password_length"]["numeric"]; - $password_strength = $_SESSION["extension"]["password_strength"]["numeric"]; + $password_length = $extension_password_length; + $password_strength = $extension_password_strength; //extension does not exist add it if ($action == "add" || $range > 1) { @@ -415,7 +469,7 @@ //prepare the values for mwi account if (!empty($mwi_account) && strpos($mwi_account, '@') === false) { - $mwi_account .= "@".$_SESSION['domain_name']; + $mwi_account .= "@".$domain_name; } //generate a password @@ -479,7 +533,7 @@ } else { if ($action == "add") { - $array["extensions"][$i]["max_registrations"] = $_SESSION['extension']['max_registrations']['numeric']; + $array["extensions"][$i]["max_registrations"] = $extension_max_registrations; } } if (permission_exists("extension_limit")) { @@ -491,7 +545,7 @@ } else { if ($action == "add") { - $array["extensions"][$i]["user_context"] = $_SESSION['domain_name']; + $array["extensions"][$i]["user_context"] = $domain_name; } } if (permission_exists('extension_missed_call')) { @@ -592,11 +646,11 @@ } //get the dislplay label - if ($_SESSION['provision']['line_label']['text'] == 'auto') { + if ($provision_line_label == 'auto') { $line_label = $extension; } else { - $line_label = $_SESSION['provision']['line_label']['text']; + $line_label = $provision_line_label; $line_label = str_replace("\${name}", $name, $line_label); $line_label = str_replace("\${effective_caller_id_name}", $effective_caller_id_name, $line_label); $line_label = str_replace("\${caller_id_name}", $effective_caller_id_name, $line_label); @@ -609,11 +663,11 @@ } //get the dislplay name - if ($_SESSION['provision']['line_display_name']['text'] == 'auto') { + if ($provision_line_display_name == 'auto') { $line_display_name = $name; } else { - $line_display_name = $_SESSION['provision']['line_display_name']['text']; + $line_display_name = $provision_line_display_name; $line_display_name = str_replace("\${name}", $name, $line_display_name); $line_display_name = str_replace("\${effective_caller_id_name}", $effective_caller_id_name, $line_display_name); $line_display_name = str_replace("\${caller_id_name}", $effective_caller_id_name, $line_display_name); @@ -627,14 +681,14 @@ //send a message to the user the device is not unique if (!$device_unique) { - $message = $text['message-duplicate'].(if_group("superadmin") && $_SESSION["domain_name"] != $device_domain_name ? ": ".$device_domain_name : null); + $message = $text['message-duplicate'].(if_group("superadmin") && $domain_name != $device_domain_name ? ": ".$device_domain_name : null); message::add($message,'negative'); } //build the devices array if ($device_unique && $device_address != '000000000000') { $array["devices"][$j]["device_uuid"] = $device_uuids[$d]; - $array["devices"][$j]["domain_uuid"] = $_SESSION['domain_uuid']; + $array["devices"][$j]["domain_uuid"] = $domain_uuid; $array["devices"][$j]["device_address"] = $device_address; $array["devices"][$j]["device_label"] = $extension; if (!empty($device_vendor)) { @@ -646,21 +700,21 @@ $array["devices"][$j]["device_enabled"] = "true"; $array["devices"][$j]["device_lines"][0]["device_uuid"] = $device_uuids[$d]; $array["devices"][$j]["device_lines"][0]["device_line_uuid"] = uuid(); - $array["devices"][$j]["device_lines"][0]["domain_uuid"] = $_SESSION['domain_uuid']; - $array["devices"][$j]["device_lines"][0]["server_address"] = $_SESSION['domain_name']; - $array["devices"][$j]["device_lines"][0]["outbound_proxy_primary"] = $_SESSION['provision']['outbound_proxy_primary']['text']; - $array["devices"][$j]["device_lines"][0]["outbound_proxy_secondary"] = $_SESSION['provision']['outbound_proxy_secondary']['text']; - $array["devices"][$j]["device_lines"][0]["server_address_primary"] = $_SESSION['provision']['server_address_primary']['text']; - $array["devices"][$j]["device_lines"][0]["server_address_secondary"] = $_SESSION['provision']['server_address_secondary']['text']; + $array["devices"][$j]["device_lines"][0]["domain_uuid"] = $domain_uuid; + $array["devices"][$j]["device_lines"][0]["server_address"] = $domain_name; + if ($provision_outbound_proxy_primary !== null) $array["devices"][$j]["device_lines"][0]["outbound_proxy_primary"] = $provision_outbound_proxy_primary; + if ($provision_outbound_proxy_secondary !== null) $array["devices"][$j]["device_lines"][0]["outbound_proxy_secondary"] = $provision_outbound_proxy_secondary; + if ($provision_server_address_primary !== null) $array["devices"][$j]["device_lines"][0]["server_address_primary"] = $provision_server_address_primary; + if ($provision_server_address_secondary !== null) $array["devices"][$j]["device_lines"][0]["server_address_secondary"] = $provision_server_address_secondary; $array["devices"][$j]["device_lines"][0]["label"] = $line_label; $array["devices"][$j]["device_lines"][0]["display_name"] = $line_display_name; $array["devices"][$j]["device_lines"][0]["user_id"] = $extension; $array["devices"][$j]["device_lines"][0]["auth_id"] = $extension; $array["devices"][$j]["device_lines"][0]["password"] = $password; $array["devices"][$j]["device_lines"][0]["line_number"] = is_numeric($line_numbers[$d]) ? $line_numbers[$d] : '1'; - $array["devices"][$j]["device_lines"][0]["sip_port"] = $_SESSION['provision']['line_sip_port']['numeric']; - $array["devices"][$j]["device_lines"][0]["sip_transport"] = $_SESSION['provision']['line_sip_transport']['text']; - $array["devices"][$j]["device_lines"][0]["register_expires"] = $_SESSION['provision']['line_register_expires']['numeric']; + if ($provision_line_sip_port !== null) $array["devices"][$j]["device_lines"][0]["sip_port"] = $provision_line_sip_port; + if ($provision_line_sip_transport !== null) $array["devices"][$j]["device_lines"][0]["sip_transport"] = $provision_line_sip_transport; + if ($provision_line_register_expires !== null) $array["devices"][$j]["device_lines"][0]["register_expires"] = $provision_line_register_expires; $array["devices"][$j]["device_lines"][0]["enabled"] = "true"; } @@ -676,7 +730,7 @@ if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { //set the voicemail password if (empty($voicemail_password)) { - $voicemail_password = generate_password($_SESSION['voicemail']['password_length']['numeric'], 1); + $voicemail_password = generate_password($voicemail_password_length, 1); } //add the voicemail to the array @@ -698,8 +752,8 @@ $voicemail_uuid = uuid(); $voicemail_tutorial = 'true'; //if adding a mailbox and don't have the transcription permission, set the default transcribe behavior - if (!permission_exists('voicemail_transcription_enabled') && isset($_SESSION['voicemail']['transcription_enabled_default']['boolean'])) { - $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; + if (!permission_exists('voicemail_transcription_enabled')) { + $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; } } @@ -725,8 +779,8 @@ $array["voicemails"][$i]["voicemail_description"] = $description; //make sure the voicemail directory exists - if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id)) { - mkdir($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id, 0770, true); + if (!file_exists($switch_voicemail.'/'.$voicemail_id)) { + mkdir($switch_voicemail."/".$voicemail_id, 0770, true); } } @@ -759,8 +813,8 @@ $sql .= "and server_address = :server_address "; $sql .= "and user_id = :user_id "; $parameters['password'] = $password; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['server_address'] = $_SESSION['domain_name']; + $parameters['domain_uuid'] = $domain_uuid; + $parameters['server_address'] = $domain_name; $parameters['user_id'] = $extension; $database->execute($sql, $parameters); unset($sql, $parameters); @@ -773,7 +827,7 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and device_key_value = :device_key_value "; $parameters['device_key_label'] = $effective_caller_id_name; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $parameters['device_key_value'] = $extension; $database->execute($sql, $parameters); unset($sql, $parameters); @@ -795,7 +849,7 @@ if (permission_exists('extension_add') || permission_exists('extension_edit')) { //synchronize configuration - if (!empty($_SESSION['switch']['extensions']['dir']) && is_writable($_SESSION['switch']['extensions']['dir'])) { + if (is_writable($switch_extensions)) { require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); @@ -803,12 +857,10 @@ } //write the provision files - if (!empty($_SESSION['provision']['path']['text'])) { - if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { - $prov = new provision; - $prov->domain_uuid = $domain_uuid; - $response = $prov->write(); - } + if (!empty($provision_path) && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { + $prov = new provision; + $prov->domain_uuid = $domain_uuid; + $response = $prov->write(); } //clear the cache @@ -929,8 +981,8 @@ } else { - $voicemail_file = $_SESSION['voicemail']['voicemail_file']['text']; - $voicemail_local_after_email = $_SESSION['voicemail']['keep_local']['boolean']; + $voicemail_file = $settings->get('voicemail', 'voicemail_file', 'attach'); + $voicemail_local_after_email = $settings->get('voicemail','keep_local', true); } //get the device lines @@ -953,7 +1005,7 @@ $sql .= "where domain_uuid = :domain_uuid "; if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { $sql .= "and device_user_uuid = :user_uuid "; - $parameters['user_uuid'] = $_SESSION['user_uuid']; + $parameters['user_uuid'] = $user_uuid; } $sql .= "order by device_address asc "; $parameters['domain_uuid'] = $domain_uuid; @@ -1031,30 +1083,30 @@ $toll_allow = str_replace(':',',', $toll_allow ?? ''); //get installed languages - $language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*"); + $language_paths = glob($switch_sounds."/*/*/*"); foreach ($language_paths as $key => $path) { - $path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path); + $path = str_replace($switch_sounds.'/', "", $path); $path_array = explode('/', $path); if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) { unset($language_paths[$key]); } - $language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? ''); + $language_paths[$key] = str_replace($switch_sounds."/","",$language_paths[$key] ?? ''); if (empty($language_paths[$key])) { unset($language_paths[$key]); } } //set the defaults - if (empty($user_context)) { $user_context = $_SESSION['domain_name']; } - if (empty($max_registrations)) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric'] ?? ''; } + if (empty($user_context)) { $user_context = $domain_name; } + if (empty($max_registrations)) { $max_registrations = $extension_max_registrations ?? ''; } if (empty($accountcode)) { $accountcode = get_accountcode(); } - if (empty($limit_max)) { $limit_max = $_SESSION['extension']['limit_max']['numeric'] ?? 5; } + if (empty($limit_max)) { $limit_max = $extension_limit_max; } if (empty($limit_destination)) { $limit_destination = '!USER_BUSY'; } - if (empty($call_timeout)) { $call_timeout = $_SESSION['extension']['call_timeout']['numeric'] ?? 30; } + if (empty($call_timeout)) { $call_timeout = $extension_call_timeout; } if (empty($call_screen_enabled)) { $call_screen_enabled = 'false'; } - if (empty($user_record)) { $user_record = $_SESSION['extension']['user_record_default']['text']; } - if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; } - if (empty($voicemail_enabled)) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; } + if (empty($user_record)) { $user_record = $extension_user_record_default; } + if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; } + if (empty($voicemail_enabled)) { $voicemail_enabled = $voicemail_enabled_default; } if (empty($enabled)) { $enabled = 'true'; } //create token @@ -1119,7 +1171,7 @@ } echo "\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)]); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','link'=>'extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)]); if ($action == 'update') { $button_margin = 'margin-left: 15px;'; if (permission_exists('xml_cdr_view')) { @@ -1131,14 +1183,14 @@ unset($button_margin); } if (permission_exists('extension_setting_view')) { - echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$_SESSION['theme']['button_icon_settings'],'id'=>'btn_settings','style'=>'','link'=>PROJECT_PATH.'/app/extension_settings/extension_settings.php?id='.urlencode($extension_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$settings->get('theme', 'button_icon_settings'),'id'=>'btn_settings','style'=>'','link'=>PROJECT_PATH.'/app/extension_settings/extension_settings.php?id='.urlencode($extension_uuid)]); } if (permission_exists('extension_copy')) { - echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','style'=>'margin-left: 15px;','onclick'=>"copy_extension();"]); + echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','style'=>'margin-left: 15px;','onclick'=>"copy_extension();"]); } } - 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 button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$settings->get('theme', 'button_icon_save'),'id'=>'btn_save','style'=>'margin-left: 15px;','onclick'=>'submit_form();']); echo "
\n"; echo "
\n"; echo "\n"; @@ -1152,7 +1204,7 @@ echo "\n"; echo "\n"; if ($action == "add" || permission_exists("extension_extension")) { - echo " \n"; + echo " get('extension','extension_range','')."\">\n"; echo " \n"; //help defeat browser auto-fill echo "
\n"; echo $text['description-extension']."\n"; @@ -1257,7 +1309,7 @@ } echo " "; if ($action == "update") { - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add')]); } echo "
\n"; } @@ -1391,7 +1443,7 @@ } } } - if (permission_exists('device_address_uuid') && (!isset($_SESSION['limit']['devices']['numeric']) || $total_devices < $_SESSION['limit']['devices']['numeric'])) { + if (permission_exists('device_address_uuid') && ($limit_devices === null || $total_devices < $limit_devices)) { echo " \n"; echo " \n"; } @@ -1426,7 +1478,7 @@ echo " \n"; if (is_array($device_lines) && @sizeof($device_lines) != 0) { echo " \n"; - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add')]); echo " \n"; } echo " \n"; @@ -1775,7 +1827,7 @@ echo "\n"; echo "\n"; - if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") { + if (permission_exists('voicemail_transcription_enabled') && $transcribe_enabled) { echo "\n"; echo "\n"; echo " ".$text['label-voicemail_transcription_enabled']."\n"; @@ -1891,10 +1943,10 @@ echo " ".$text['label-call_group']."\n"; echo "\n"; echo "\n"; - if (!empty($_SESSION['call_group']['name']) && is_array($_SESSION['call_group']['name'])) { + if (!empty($settings->get('call_group', 'name')) && is_array($settings->get('call_group', 'name'))) { echo " \n"; echo " \n"; @@ -2298,7 +2350,7 @@ echo "\n"; echo ""; if (!permission_exists('extension_domain')) { - echo ""; + echo ""; } echo ""; echo ""; diff --git a/app/fax/app_config.php b/app/fax/app_config.php index db9727586e..75f64f9b62 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -312,7 +312,23 @@ $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; $apps[$x]['default_settings'][$y]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system."; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Notice displayed in the footer of the cover sheet."; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Footer field of a new fax (displayed below the box on the cover sheet)."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "034a7f00-9455-4354-978e-7978d193f675"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "cover_message"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Message field of a new fax (displayed inside the box on the cover sheet)."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "760eb1ec-249a-4482-bdc4-3fd35d604db9"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "cover_message_height"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "6.15"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the default height (inches) of the Message box on the cover sheet."; $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e907df99-6b3a-4864-bd11-681888f20289"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; @@ -320,7 +336,7 @@ $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default information displayed beneath the logo in the header of the cover sheet."; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Header field of a new fax (displayed near the top of the cover sheet, beneath the logo)."; $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "8338a404-3966-416e-b4f9-a1ac36c37bd1"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index fff0a9d60f..9c6b59e9f7 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -433,7 +433,7 @@ if (!function_exists('fax_split_dtmf')) { if (in_array($logo_fileext, ['gif','jpg','jpeg','png','bmp'])) { if (file_exists($logo_dirname.'/'.$logo_filename)) { $logo = $logo_dirname.'/'.$logo_filename; - $display_logo = true; + $display_logo = true; } else { $raw = file_get_contents($logo); @@ -568,7 +568,13 @@ if (!function_exists('fax_split_dtmf')) { unset($yn); } else { - $pdf->Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D'); + //determine cover message box height, and difference, to adjust footer position accordingly + $cover_message_height = $setting->get('fax','cover_message_height'); + $cover_message_height = (float) ($cover_message_height ?? 6.15); + $height_difference = 6.15 - $cover_message_height; + + // draw message box + $pdf->Rect($x + 0.5, $y + 3.4, 7.5, $cover_message_height, 'D'); $y = $pdf->GetY(); } @@ -577,7 +583,7 @@ if (!function_exists('fax_split_dtmf')) { $pdf->SetAutoPageBreak(true, 0.6); $pdf->SetTopMargin(0.6); $pdf->SetFont("helvetica", "", 8); - $pdf->SetXY($x + 0.5, $y + 0.6); + $pdf->SetXY($x + 0.5, $y + 0.6 - (float) ($height_difference ?? 0)); $pdf->MultiCell(7.5, 0.75, $fax_footer, 0, 'C', false); } $pdf->SetAutoPageBreak(false); @@ -669,7 +675,7 @@ if (!function_exists('fax_split_dtmf')) { } exit; } - + //prepare variables send the fax $mail_from_address = (!empty($setting->get('fax','smtp_from'))) ? $setting->get('fax','smtp_from') : $setting->get('email','smtp_from'); @@ -746,7 +752,7 @@ if (!function_exists('fax_split_dtmf')) { $fax_file = $dir_fax_sent."/".$fax_instance_uuid.".tif"; $common_variables = "fax_queue_uuid=".$fax_queue_uuid.","; $common_variables .= "fax_uuid=" . $fax_uuid . ","; - //$common_variables .= "accountcode='".$fax_accountcode."',"; + $common_variables .= "accountcode='".$fax_accountcode."',"; $common_variables .= "sip_h_accountcode='".$fax_accountcode."',"; $common_variables .= "domain_uuid=".$domain_uuid.","; $common_variables .= "domain_name=".$domain_name.","; @@ -760,6 +766,8 @@ if (!function_exists('fax_split_dtmf')) { if (!empty($provider_prefix)) { $common_variables .= "provider_prefix='".$provider_prefix."',"; } + $common_variables .= "hangup_after_bridge=true,"; + $common_variables .= "continue_on_fail=true,"; if (!empty($fax_numbers)) { foreach ($fax_numbers as $fax_number) { @@ -940,7 +948,7 @@ if (!defined('STDIN')) { } if (is_array($contact_labels)) { //sort by name(s) - asort($contact_labels, SORT_NATURAL); + asort($contact_labels, SORT_NATURAL); } } @@ -1015,7 +1023,7 @@ if (!defined('STDIN')) { echo "\n"; echo $text['description-2']." ".(permission_exists('fax_extension_view_domain') ? $text['description-3'] : null)."\n"; echo "

\n"; - + if ($domain_enabled == false) { echo "
".$text['notice-sending-disabled']."
\n"; } @@ -1160,7 +1168,7 @@ if (!defined('STDIN')) { echo " ".$text['label-fax-message']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-fax-message']."\n"; echo "\n"; @@ -1220,4 +1228,4 @@ function showgrid($pdf) { } } */ -?> +?> \ No newline at end of file diff --git a/app/fax_queue/app_config.php b/app/fax_queue/app_config.php index 65345b81a4..8740002353 100644 --- a/app/fax_queue/app_config.php +++ b/app/fax_queue/app_config.php @@ -76,6 +76,14 @@ $apps[$x]['default_settings'][$y]['default_setting_value'] = "30"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of days to retain the fax queue logs in the database for the maintenance app."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "5506cf35-e19d-4f02-ab9d-43fd0f8460f7"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "prefer_local"; + $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'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Determine whether fax calls should attempt to stay local or route to the provider."; //$y++; //$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "afd729d9-cf69-4793-a140-21093814d314"; //$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue"; diff --git a/app/fax_queue/resources/job/fax_send.php b/app/fax_queue/resources/job/fax_send.php index 61c7dff3d7..515364fa40 100644 --- a/app/fax_queue/resources/job/fax_send.php +++ b/app/fax_queue/resources/job/fax_send.php @@ -224,6 +224,23 @@ //sending the fax if ($fax_status == 'waiting' || $fax_status == 'trying' || $fax_status == 'busy') { + //get the provider_prefix from the domain_variables dialplan + $sql = "select dialplan_detail_data from v_dialplan_details "; + $sql .= "where dialplan_uuid in ( "; + $sql .= " select dialplan_uuid from v_dialplans "; + $sql .= " where dialplan_name = 'domain-variables' "; + $sql .= " and domain_uuid = :domain_uuid "; + $sql .= ") "; + $sql .= "and dialplan_detail_data like 'provider_prefix%' "; + $sql .= "and dialplan_detail_enabled = 'true' "; + $parameters['domain_uuid'] = $domain_uuid; + $row = $database->select($sql, $parameters, 'row'); + $dialplan_detail_data = $row["dialplan_detail_data"]; + unset($sql, $parameters, $row); + if (!empty($dialplan_detail_data)) { + $provider_prefix = explode('=', $dialplan_detail_data)[1]; + } + //create event socket handle $esl = event_socket::create(); if (!$esl->is_connected()) { @@ -280,21 +297,23 @@ } //check to see if the destination number is local - $sql = "select count(destination_uuid) "; - $sql .= "from v_destinations "; - $sql .= "where ("; - $sql .= " destination_number = :destination_number "; - $sql .= " or concat(destination_prefix, destination_number) = :destination_number "; - $sql .= " or concat(destination_trunk_prefix, destination_number) = :destination_number "; - $sql .= " or concat(destination_area_code, destination_number) = :destination_number "; - $sql .= " or concat(destination_prefix, destination_area_code, destination_number) = :destination_number "; - $sql .= ")"; - $parameters['destination_number'] = $fax_number; - $destination_count = $database->select($sql, $parameters, 'column'); $local_destination = false; - if ($destination_count > 0) { - $local_destination = true; - $route_array[] = 'loopback/'.$fax_number.'/public'; + if ($setting->get('fax_queue','prefer_local', false)) { + $sql = "select count(destination_uuid) "; + $sql .= "from v_destinations "; + $sql .= "where ("; + $sql .= " destination_number = :destination_number "; + $sql .= " or concat(destination_prefix, destination_number) = :destination_number "; + $sql .= " or concat(destination_trunk_prefix, destination_number) = :destination_number "; + $sql .= " or concat(destination_area_code, destination_number) = :destination_number "; + $sql .= " or concat(destination_prefix, destination_area_code, destination_number) = :destination_number "; + $sql .= ") "; + $parameters['destination_number'] = $fax_number; + $destination_count = $database->select($sql, $parameters, 'column'); + if ($destination_count > 0) { + $local_destination = true; + $route_array[] = 'loopback/'.$fax_number.'/public'; + } } //define the fax file @@ -308,6 +327,8 @@ $common_variables .= "fax_ident='" . escape_quote($fax_caller_id_number) . "',"; $common_variables .= "fax_header='" . escape_quote($fax_caller_id_name) . "',"; $common_variables .= "fax_file='" . escape_quote($fax_file) . "',"; + $common_variables .= "hangup_after_bridge=true,"; + $common_variables .= "continue_on_fail=true,"; //add the fax destination number variables if ($local_destination) { @@ -315,9 +336,13 @@ $common_variables .= "sip_req_user=".$fax_number.","; } + //prepare the fax command + $channel_variables["toll_allow"] = !empty($fax_toll_allow) ? $fax_toll_allow : null; + $route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables); + if (empty($route_array)) { - $route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables); + //send the internal call to the registered extension if (count($route_array) == 0) { //check for valid extension $sql = "select count(extension_uuid) "; @@ -329,18 +354,36 @@ $extension_count = $database->select($sql, $parameters, 'column'); if ($extension_count > 0) { //send the internal call to the registered extension - $route_array[] = "user/".$fax_number."@".$domain_name; + $fax_uri = "user/".$fax_number."@".$domain_name; } else { + $fax_uri = ''; $fax_status = 'failed'; } } } + else { + foreach($route_array as $key => $bridge) { + //add the bridge to the fax_uri, after first iteration add the delimiter + if ($key == 0) { + $fax_uri = $bridge; + } + else { + $fax_uri .= '|'.$bridge; + } + + //add the provider_prefix + if (!empty($provider_prefix)) { + $fax_uri = preg_replace('/\${provider_prefix}/', $provider_prefix, $fax_uri); + } + + //remove switch ${variables} from the bridge statement + $fax_uri = preg_replace('/\${[^}]+}/', '', $fax_uri); + } + } //set the origination uuid - if (!is_uuid($origination_uuid)) { - $origination_uuid = uuid(); - } + $origination_uuid = uuid(); //build a list of fax variables $dial_string = $common_variables; @@ -362,21 +405,18 @@ //connect to event socket and send the command if ($fax_status != 'failed' && file_exists($fax_file)) { //send the fax and try another route if the fax fails - foreach($route_array as $route) { - $fax_command = "originate {" . $dial_string . ",fax_uri=".$route."}" . $route." &txfax('".$fax_file."')"; - $fax_response = event_socket::api($fax_command); - $response = str_replace("\n", "", $fax_response); - $response = trim(str_replace("+OK", "", $response)); - if (is_uuid($response)) { - //originate command accepted - $uuid = $response; - echo "uuid: ".$uuid."\n"; - break; - } - else { - //originate command failed (-ERR INVALID_GATEWAY or other errors) - echo "response: ".$response."\n"; - } + $fax_command = "originate {" . $dial_string . ",fax_uri=".$fax_uri."}" . $fax_uri." &txfax('".$fax_file."')"; + $fax_response = event_socket::api($fax_command); + $response = str_replace("\n", "", $fax_response); + $response = trim(str_replace("+OK", "", $response)); + if (is_uuid($response)) { + //originate command accepted + $uuid = $response; + echo "uuid: ".$uuid."\n"; + } + else { + //originate command failed (-ERR INVALID_GATEWAY or other errors) + echo "response: ".$response."\n"; } //set the fax file name without the extension diff --git a/app/fifo/fifo_edit.php b/app/fifo/fifo_edit.php index 0087904d74..ef1d4cf2a1 100644 --- a/app/fifo/fifo_edit.php +++ b/app/fifo/fifo_edit.php @@ -396,14 +396,11 @@ echo "
".$text['title-fifo']."
\n"; echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$button_icon_back,'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'fifo.php']); -// if ($action == 'update') { -// if (permission_exists('fifo_member_add')) { -// echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$button_icon_copy,'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]); -// } -// if (permission_exists('fifo_member_delete')) { -// echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]); -// } -// } + if ($action == 'update') { + if (permission_exists('fifo_member_delete')) { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>'display: none; margin-right: 15px;']); + } + } echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$button_icon_save,'id'=>'btn_save','collapse'=>'hide-xs']); echo "
\n"; echo "
\n"; @@ -482,7 +479,7 @@ echo " ".$text['label-member_enabled']."\n"; if (is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) { echo " \n"; - echo " ".$text['label-action']."\n"; + echo " ".$text['label-delete']."\n"; echo " \n"; echo " \n"; } @@ -497,9 +494,9 @@ if (empty($row["member_wrap_up_time"])) { $row["member_wrap_up_time"] = '10'; } echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " $member_contact\n"; echo " \n"; diff --git a/app/flyingvoice/app_config.php b/app/flyingvoice/app_config.php index 67f9c12630..a2357bb0e4 100644 --- a/app/flyingvoice/app_config.php +++ b/app/flyingvoice/app_config.php @@ -980,7 +980,7 @@ $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "flyingvoice_voice_vad"; $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "1"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set 1 = On, 0 = Off (default)"; $y++; diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index e85eab669a..2c4968369d 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -42,6 +42,9 @@ $language = new text; $text = $language->get(); +//connect to the database + $database = database::new(); + //define defaults $action = ''; $search = ''; @@ -112,7 +115,6 @@ $sql .= ")"; $parameters['search'] = '%'.$search.'%'; } - $database = new database; $num_rows = $database->select($sql, $parameters ?? '', 'column'); //prepare to page the results @@ -147,7 +149,6 @@ } $sql .= order_by($order_by, $order, 'ivr_menu_name', 'asc', $sort); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $ivr_menus = $database->select($sql, $parameters ?? '', 'all'); unset($sql, $parameters); diff --git a/app/number_translations/app_defaults.php b/app/number_translations/app_defaults.php index 782d0ac654..3ccd87b9fe 100644 --- a/app/number_translations/app_defaults.php +++ b/app/number_translations/app_defaults.php @@ -74,4 +74,3 @@ } ?> - diff --git a/app/provision/index.php b/app/provision/index.php index 7bd70c3ef5..bd610bc10a 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -210,7 +210,7 @@ //get the domain_uuid $sql = "select domain_uuid from v_domains "; - $sql .= "where domain_name = :domain_name "; + $sql .= "where lower(domain_name) = lower(:domain_name) "; $parameters['domain_name'] = $domain_name; $domain_uuid = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index bd6cc5ea71..53acb6ae90 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -802,20 +802,11 @@ //set the variables $line_number = $row['line_number']; $register_expires = $row['register_expires']; - $sip_transport = strtolower($row['sip_transport']); - $sip_port = $row['sip_port']; + $sip_transport = strtolower($row['sip_transport'] ?? 'tcp'); + $sip_port = $row['sip_port'] ?? '5060'; //set defaults if (empty($register_expires)) { $register_expires = "120"; } - if (empty($sip_transport)) { $sip_transport = "tcp"; } - if (!isset($sip_port)) { - if ($line_number == "" || $line_number == "1") { - $sip_port = "5060"; - } - else { - $sip_port = "506".($line_number + 1); - } - } //convert seconds to minutes for grandstream if ($device_vendor == 'grandstream') { diff --git a/app/registrations/resources/dashboard/registrations.php b/app/registrations/resources/dashboard/registrations.php index 6883af3d3d..ff01d99c89 100644 --- a/app/registrations/resources/dashboard/registrations.php +++ b/app/registrations/resources/dashboard/registrations.php @@ -12,10 +12,7 @@ $text = $language->get($_SESSION['domain']['language']['code'], dirname($dashboard_url)); //get the dashboard label - $dashboard_label = $text['title-'.$dashboard_key]; - if (empty($dashboard_label)) { - $dashboard_label = $dashboard_name; - } + $dashboard_label = $text['title-'.$dashboard_key] ?? $dashboard_name; //prepare variables $dashboard_target = ($dashboard_target == 'new') ? '_blank' : '_self'; @@ -25,9 +22,7 @@ } //channel count - if ($esl == null) { - $esl = event_socket::create(); - } + $esl = event_socket::create(); //registration count if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) { @@ -41,6 +36,7 @@ //get the total enabled extensions $sql = "select count(*) as count from v_extensions "; $sql .= "where enabled = 'true' "; + $parameters = null; if (!permission_exists("registration_all")) { $sql .= "and domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -59,7 +55,7 @@ echo " ".escape($dashboard_label).""; echo "
\n"; echo " \n"; - echo " ".$active_registrations." / ".($active_registrations + $inactive_registrations)."\n"; + echo " ".$active_registrations." / ".($active_registrations + $inactive_registrations)."\n"; echo "
\n"; echo " \n"; if (empty($dashboard_details_state) || $dashboard_details_state != "disabled") { diff --git a/app/switch/resources/conf/languages/ar/vm/sounds.xml b/app/switch/resources/conf/languages/ar/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/ar/vm/sounds.xml +++ b/app/switch/resources/conf/languages/ar/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ar/vm/voicemail.xml b/app/switch/resources/conf/languages/ar/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/ar/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ar/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/de/vm/sounds.xml b/app/switch/resources/conf/languages/de/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/de/vm/sounds.xml +++ b/app/switch/resources/conf/languages/de/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/de/vm/voicemail.xml b/app/switch/resources/conf/languages/de/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/de/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/de/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/el/vm/sounds.xml b/app/switch/resources/conf/languages/el/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/el/vm/sounds.xml +++ b/app/switch/resources/conf/languages/el/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/el/vm/voicemail.xml b/app/switch/resources/conf/languages/el/vm/voicemail.xml index 1483493e7a..858788e1ad 100644 --- a/app/switch/resources/conf/languages/el/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/el/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/en/vm/sounds.xml b/app/switch/resources/conf/languages/en/vm/sounds.xml index 14866b7383..537dfd6eab 100644 --- a/app/switch/resources/conf/languages/en/vm/sounds.xml +++ b/app/switch/resources/conf/languages/en/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/es/vm/sounds.xml b/app/switch/resources/conf/languages/es/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/es/vm/sounds.xml +++ b/app/switch/resources/conf/languages/es/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/es/vm/voicemail.xml b/app/switch/resources/conf/languages/es/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/es/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/es/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/fr/vm/sounds.xml b/app/switch/resources/conf/languages/fr/vm/sounds.xml index 4e77210426..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/fr/vm/sounds.xml +++ b/app/switch/resources/conf/languages/fr/vm/sounds.xml @@ -85,21 +85,40 @@ - + - + - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/fr/vm/voicemail.xml b/app/switch/resources/conf/languages/fr/vm/voicemail.xml index 273d28dd35..3218186ccc 100644 --- a/app/switch/resources/conf/languages/fr/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/fr/vm/voicemail.xml @@ -37,7 +37,7 @@ - + @@ -48,6 +48,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -93,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/he/vm/sounds.xml b/app/switch/resources/conf/languages/he/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/he/vm/sounds.xml +++ b/app/switch/resources/conf/languages/he/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/he/vm/voicemail.xml b/app/switch/resources/conf/languages/he/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/he/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/he/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/it/vm/sounds.xml b/app/switch/resources/conf/languages/it/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/it/vm/sounds.xml +++ b/app/switch/resources/conf/languages/it/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/it/vm/voicemail.xml b/app/switch/resources/conf/languages/it/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/it/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/it/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/nl/vm/sounds.xml b/app/switch/resources/conf/languages/nl/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/nl/vm/sounds.xml +++ b/app/switch/resources/conf/languages/nl/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/nl/vm/voicemail.xml b/app/switch/resources/conf/languages/nl/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/nl/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/nl/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/pt/vm/sounds.xml b/app/switch/resources/conf/languages/pt/vm/sounds.xml index 250cb96e1d..14866b7383 100644 --- a/app/switch/resources/conf/languages/pt/vm/sounds.xml +++ b/app/switch/resources/conf/languages/pt/vm/sounds.xml @@ -104,6 +104,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/pt/vm/voicemail.xml b/app/switch/resources/conf/languages/pt/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/pt/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/pt/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ro/vm/sounds.xml b/app/switch/resources/conf/languages/ro/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/ro/vm/sounds.xml +++ b/app/switch/resources/conf/languages/ro/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ro/vm/voicemail.xml b/app/switch/resources/conf/languages/ro/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/ro/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ro/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ru/vm/sounds.xml b/app/switch/resources/conf/languages/ru/vm/sounds.xml index 250cb96e1d..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/ru/vm/sounds.xml +++ b/app/switch/resources/conf/languages/ru/vm/sounds.xml @@ -85,7 +85,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ru/vm/voicemail.xml b/app/switch/resources/conf/languages/ru/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/ru/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ru/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/sv/vm/sounds.xml b/app/switch/resources/conf/languages/sv/vm/sounds.xml index 9706d7a5d8..226abdcdc7 100644 --- a/app/switch/resources/conf/languages/sv/vm/sounds.xml +++ b/app/switch/resources/conf/languages/sv/vm/sounds.xml @@ -96,7 +96,7 @@ - + @@ -118,6 +118,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/sv/vm/voicemail.xml b/app/switch/resources/conf/languages/sv/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/sv/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/sv/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/tr/vm/sounds.xml b/app/switch/resources/conf/languages/tr/vm/sounds.xml index 250cb96e1d..14866b7383 100644 --- a/app/switch/resources/conf/languages/tr/vm/sounds.xml +++ b/app/switch/resources/conf/languages/tr/vm/sounds.xml @@ -104,6 +104,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/tr/vm/voicemail.xml b/app/switch/resources/conf/languages/tr/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/tr/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/tr/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/uk/vm/sounds.xml b/app/switch/resources/conf/languages/uk/vm/sounds.xml index 55cfb91776..00ba8ac144 100644 --- a/app/switch/resources/conf/languages/uk/vm/sounds.xml +++ b/app/switch/resources/conf/languages/uk/vm/sounds.xml @@ -103,7 +103,26 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/uk/vm/voicemail.xml b/app/switch/resources/conf/languages/uk/vm/voicemail.xml index 0daec58637..3218186ccc 100644 --- a/app/switch/resources/conf/languages/uk/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/uk/vm/voicemail.xml @@ -65,6 +65,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -96,6 +121,17 @@ + + + + + + + + + + + diff --git a/app/switch/resources/scripts/app/ring_groups/index.lua b/app/switch/resources/scripts/app/ring_groups/index.lua index e4dd3bfa6b..ec5bf23e6e 100644 --- a/app/switch/resources/scripts/app/ring_groups/index.lua +++ b/app/switch/resources/scripts/app/ring_groups/index.lua @@ -418,9 +418,9 @@ log = require "resources.functions.log".ring_group local sql = "SELECT * FROM v_email_templates "; sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; sql = sql .. "AND template_language = :template_language "; - sql = sql .. "AND template_category = 'missed' " - sql = sql .. "AND template_enabled = 'true' " - sql = sql .. "ORDER BY domain_uuid DESC " + sql = sql .. "AND template_category = 'missed' "; + sql = sql .. "AND template_enabled = 'true' "; + sql = sql .. "ORDER BY domain_uuid DESC "; local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/remove_deleted_messages.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/remove_deleted_messages.lua index 20ba9629c5..7fd4379f7d 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/remove_deleted_messages.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/remove_deleted_messages.lua @@ -81,12 +81,11 @@ end message_number = message_number + 1; end - --clear the variable db_voicemail_uuid = ''; messages_to_delete = {}; - + --flush dtmf digits from the input buffer session:flushDigits(); diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 0a9e7eecb2..b74ceafb36 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -243,6 +243,112 @@ $text['message-unavailable']['zh-cn'] = "不可用"; $text['message-unavailable']['ja-jp'] = "利用不可"; $text['message-unavailable']['ko-kr'] = "없는"; +$text['label-service']['en-us'] = 'Service'; +$text['label-service']['en-gb'] = 'Service'; +$text['label-service']['ar-eg'] = 'خدمة'; +$text['label-service']['de-at'] = 'Service'; +$text['label-service']['de-ch'] = 'Service'; +$text['label-service']['de-de'] = 'Service'; +$text['label-service']['el-gr'] = 'Υπηρεσία'; +$text['label-service']['es-cl'] = 'Servicio'; +$text['label-service']['es-mx'] = 'Servicio'; +$text['label-service']['fr-ca'] = 'Service'; +$text['label-service']['fr-fr'] = 'Service'; +$text['label-service']['he-il'] = 'שֵׁרוּת'; +$text['label-service']['it-it'] = 'Servizio'; +$text['label-service']['ka-ge'] = 'სერვისი'; +$text['label-service']['nl-nl'] = 'Dienst'; +$text['label-service']['pl-pl'] = 'Praca'; +$text['label-service']['pt-br'] = 'Serviço'; +$text['label-service']['pt-pt'] = 'Serviço'; +$text['label-service']['ro-ro'] = 'Serviciu'; +$text['label-service']['ru-ru'] = 'Услуга'; +$text['label-service']['sv-se'] = 'Service'; +$text['label-service']['uk-ua'] = 'Сервіс'; +$text['label-service']['tr-tr'] = 'Hizmet'; +$text['label-service']['zh-cn'] = '服务'; +$text['label-service']['ja-jp'] = 'サービス'; +$text['label-service']['ko-kr'] = '서비스'; + +$text['label-running']['en-us'] = "Running"; +$text['label-running']['en-gb'] = "Running"; +$text['label-running']['ar-eg'] = "فعال"; +$text['label-running']['de-at'] = "Aktiv"; +$text['label-running']['de-ch'] = "Aktiv"; +$text['label-running']['de-de'] = "Aktiv"; +$text['label-running']['el-gr'] = "Τρέξιμο"; +$text['label-running']['es-cl'] = "Corriendo"; +$text['label-running']['es-mx'] = "Corriendo"; +$text['label-running']['fr-ca'] = "Actif"; +$text['label-running']['fr-fr'] = "Actif"; +$text['label-running']['he-il'] = "ריצה"; +$text['label-running']['it-it'] = "Attivo"; +$text['label-running']['ka-ge'] = "გაშვებულია"; +$text['label-running']['nl-nl'] = "Aktief"; +$text['label-running']['pl-pl'] = "Uruchomiony"; +$text['label-running']['pt-br'] = "Em execução"; +$text['label-running']['pt-pt'] = "Em execução"; +$text['label-running']['ro-ro'] = "Alergare"; +$text['label-running']['ru-ru'] = "Запущено"; +$text['label-running']['sv-se'] = "Löpning"; +$text['label-running']['uk-ua'] = "Запущено"; +$text['label-running']['tr-tr'] = "Koşma"; +$text['label-running']['zh-cn'] = "跑步"; +$text['label-running']['ja-jp'] = "ランニング"; +$text['label-running']['ko-kr'] = "달리기"; + +$text['label-yes']['en-us'] = "Yes"; +$text['label-yes']['en-gb'] = "Yes"; +$text['label-yes']['ar-eg'] = "نعم"; +$text['label-yes']['de-at'] = "Ja"; +$text['label-yes']['de-ch'] = "Ja"; +$text['label-yes']['de-de'] = "Ja"; +$text['label-yes']['el-gr'] = "Ναί"; +$text['label-yes']['es-cl'] = "Si"; +$text['label-yes']['es-mx'] = "Si"; +$text['label-yes']['fr-ca'] = "Oui"; +$text['label-yes']['fr-fr'] = "Oui"; +$text['label-yes']['he-il'] = "כן"; +$text['label-yes']['it-it'] = "Si"; +$text['label-yes']['nl-nl'] = "Ja"; +$text['label-yes']['pl-pl'] = "Tak"; +$text['label-yes']['pt-br'] = "Sim"; +$text['label-yes']['pt-pt'] = "Sim"; +$text['label-yes']['ro-ro'] = "da"; +$text['label-yes']['ru-ru'] = "Да"; +$text['label-yes']['sv-se'] = "Ja"; +$text['label-yes']['uk-ua'] = "Так"; +$text['label-yes']['tr-tr'] = "Evet"; +$text['label-yes']['zh-cn'] = "是的"; +$text['label-yes']['ja-jp'] = "はい"; +$text['label-yes']['ko-kr'] = "예"; + +$text['label-no']['en-us'] = "No"; +$text['label-no']['en-gb'] = "No"; +$text['label-no']['ar-eg'] = "لا"; +$text['label-no']['de-at'] = "Nein"; +$text['label-no']['de-ch'] = "Nein"; +$text['label-no']['de-de'] = "Nein"; +$text['label-no']['el-gr'] = "Οχι"; +$text['label-no']['es-cl'] = "No"; +$text['label-no']['es-mx'] = "No"; +$text['label-no']['fr-ca'] = "Non"; +$text['label-no']['fr-fr'] = "Non"; +$text['label-no']['he-il'] = "לא"; +$text['label-no']['it-it'] = "No"; +$text['label-no']['nl-nl'] = "Nee"; +$text['label-no']['pl-pl'] = "Nie"; +$text['label-no']['pt-br'] = "Não "; +$text['label-no']['pt-pt'] = "Não"; +$text['label-no']['ro-ro'] = "Nu"; +$text['label-no']['ru-ru'] = "Нет"; +$text['label-no']['sv-se'] = "Nej"; +$text['label-no']['uk-ua'] = "Ні"; +$text['label-no']['tr-tr'] = "HAYIR"; +$text['label-no']['zh-cn'] = "不"; +$text['label-no']['ja-jp'] = "いいえ"; +$text['label-no']['ko-kr'] = "아니요"; + $text['label-os']['en-us'] = "Operating System"; $text['label-os']['en-gb'] = "Operating System"; $text['label-os']['ar-eg'] = "מערכת הפעלה"; diff --git a/app/system/resources/dashboard/config.php b/app/system/resources/dashboard/config.php index 6cecf9bc94..933ea2363a 100644 --- a/app/system/resources/dashboard/config.php +++ b/app/system/resources/dashboard/config.php @@ -46,8 +46,8 @@ $y = 0; $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '41befc82-c65a-499e-9e29-513a3dd7974a'; $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'beade936-846b-4f02-986c-a2de6fa762c2'; $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin'; -$x++; +$x++; $array['dashboard'][$x]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1'; $array['dashboard'][$x]['dashboard_name'] = 'System Counts'; $array['dashboard'][$x]['dashboard_path'] = 'system/system_counts'; @@ -61,6 +61,21 @@ $y = 0; $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'a772d2a8-7c1f-4453-b77b-2e15b510a78d'; $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1'; $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin'; + +$x++; +$array['dashboard'][$x]['dashboard_uuid'] = '2a0a6742-bd2d-449a-88ac-b3ed255c9f8e'; +$array['dashboard'][$x]['dashboard_name'] = 'System Services'; +$array['dashboard'][$x]['dashboard_path'] = 'system/system_services'; +$array['dashboard'][$x]['dashboard_column_span'] = '1'; +$array['dashboard'][$x]['dashboard_row_span'] = '2'; +$array['dashboard'][$x]['dashboard_details_state'] = 'hidden'; +$array['dashboard'][$x]['dashboard_order'] = '110'; +$array['dashboard'][$x]['dashboard_enabled'] = 'false'; +$array['dashboard'][$x]['dashboard_description'] = 'A list of showing the count of active and inactive services'; +$y = 0; +$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '719d8a56-00b2-437e-83c0-a9e5005a53c5'; +$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '4bd3e11d-f4cd-4e37-8e7b-445e1e4aa7d5'; +$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin'; //$y++; //$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '127382ae-0dd1-45eb-869c-56a708220de5'; //$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1'; diff --git a/app/system/resources/dashboard/system_disk_usage.php b/app/system/resources/dashboard/system_disk_usage.php index 02135183ea..ada15830fd 100644 --- a/app/system/resources/dashboard/system_disk_usage.php +++ b/app/system/resources/dashboard/system_disk_usage.php @@ -21,8 +21,8 @@ echo "
\n"; $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; + $row_style['0'] = "row_style0"; + $row_style['1'] = "row_style1"; //disk usage if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') { @@ -37,16 +37,16 @@ if (!empty($percent_disk_usage)) { //add half doughnut chart - echo "
\n"; + echo "
\n"; echo " ".$text['label-disk_usage']."\n"; if (!isset($dashboard_chart_type) || $dashboard_chart_type == "doughnut") { ?> -
+
\n"; + +if ($dashboard_details_state != 'disabled') { +echo "
\n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; + $row_style[false] = "row_style0"; + $row_style[true] = "row_style1"; + $c = true; + foreach ($services as $name => $enabled) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $c = !$c; + } +echo "
".($text['label-service'] ?? 'Service')."".($text['label-running'] ?? 'Running')."
$name" . ($enabled ? $text['label-yes'] ?? 'Yes' : $text['label-no'] ?? 'No') . "
\n"; +echo "
\n"; +} +echo "
\n"; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index 9c5b571c08..a8e88448c4 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -111,7 +111,7 @@ echo "\n"; echo "
\n"; echo " \n"; - echo " ".$messages['new']."\n"; + echo " ".$messages['new']."\n"; echo "
\n"; echo "
"; } diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 4785ad81da..a5aaec41da 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -89,6 +89,7 @@ //set the variables from the HTTP values $voicemail_id = $_POST["voicemail_id"]; + $voicemail_id_previous = $_POST["voicemail_id_previous"]; $voicemail_password = $_POST["voicemail_password"]; $greeting_id = $_POST["greeting_id"]; $voicemail_options = $_POST["voicemail_options"]; @@ -261,9 +262,21 @@ $p->delete('voicemail_option_add', 'temp'); $p->delete('voicemail_destination_add', 'temp'); - //make sure the voicemail directory exists + //create or rename voicemail directory as needed if (is_numeric($voicemail_id)) { - if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id)) { + // old and new voicemail ids differ, old directory exists and new doesn't, rename directory + if ( + !empty($voicemail_id_previous) && is_numeric($voicemail_id_previous) && $voicemail_id_previous != $voicemail_id && + file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id_previous) && + !file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id) + ) { + rename( + $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id_previous, // previous + $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id // new + ); + } + // new directory doesn't exist, create + else if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id)) { mkdir($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id, 0770); } } @@ -560,6 +573,7 @@ echo "\n"; echo "\n"; echo " \n"; + echo " \n"; echo " \n"; //help defeat browser auto-fill echo "
\n"; echo $text['description-voicemail_id']."\n"; diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 98f5944920..c01ea17d31 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -267,6 +267,21 @@ $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $y++; + $apps[$x]['permissions'][$y]['name'] = 'xml_cdr_extension_view'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'xml_cdr_extension_add'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'xml_cdr_extension_edit'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'xml_cdr_extension_delete'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'xml_cdr_extension_all'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; //default settings $y=0; @@ -856,6 +871,85 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + //xml cdr extensions + $y++; + $apps[$x]['db'][$y]['table']['name'] = 'v_xml_cdr_extensions'; + $apps[$x]['db'][$y]['table']['parent'] = ''; + $z = 0; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'xml_cdr_extension_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'xml_cdr_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_xml_cdr"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = ''; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'extension_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = ''; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'start_stamp'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'end_stamp'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'duration'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = ''; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'insert_date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'insert_user'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'update_date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'update_user'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + //schema details $y++; $apps[$x]['db'][$y]['table']['name'] = "v_xml_cdr_json"; diff --git a/app/xml_cdr/app_languages.php b/app/xml_cdr/app_languages.php index a293590e66..19dde926d7 100644 --- a/app/xml_cdr/app_languages.php +++ b/app/xml_cdr/app_languages.php @@ -243,6 +243,32 @@ $text['label-name']['zh-cn'] = "姓名"; $text['label-name']['ja-jp'] = "名前"; $text['label-name']['ko-kr'] = "이름"; +$text['label-volume']['en-us'] = "Volume"; +$text['label-volume']['en-gb'] = "Volume"; +$text['label-volume']['ar-eg'] = ""; +$text['label-volume']['de-at'] = ""; +$text['label-volume']['de-ch'] = ""; +$text['label-volume']['de-de'] = ""; +$text['label-volume']['el-gr'] = ""; +$text['label-volume']['es-cl'] = ""; +$text['label-volume']['es-mx'] = ""; +$text['label-volume']['fr-ca'] = ""; +$text['label-volume']['fr-fr'] = ""; +$text['label-volume']['he-il'] = ""; +$text['label-volume']['it-it'] = ""; +$text['label-volume']['nl-nl'] = ""; +$text['label-volume']['pl-pl'] = ""; +$text['label-volume']['pt-br'] = ""; +$text['label-volume']['pt-pt'] = ""; +$text['label-volume']['ro-ro'] = ""; +$text['label-volume']['ru-ru'] = ""; +$text['label-volume']['sv-se'] = ""; +$text['label-volume']['uk-ua'] = ""; +$text['label-volume']['tr-tr'] = ""; +$text['label-volume']['zh-cn'] = ""; +$text['label-volume']['ja-jp'] = ""; +$text['label-volume']['ko-kr'] = ""; + $text['label-minutes']['en-us'] = "Minutes"; $text['label-minutes']['en-gb'] = "Minutes"; $text['label-minutes']['ar-eg'] = "دقائق"; @@ -3240,6 +3266,32 @@ $text['label-answer']['zh-cn'] = "回答"; $text['label-answer']['ja-jp'] = "答え"; $text['label-answer']['ko-kr'] = "答え"; +$text['label-asr']['en-us'] = "ASR"; +$text['label-asr']['en-gb'] = "ASR"; +$text['label-asr']['ar-eg'] = ""; +$text['label-asr']['de-at'] = ""; +$text['label-asr']['de-ch'] = ""; +$text['label-asr']['de-de'] = ""; +$text['label-asr']['el-gr'] = ""; +$text['label-asr']['es-cl'] = ""; +$text['label-asr']['es-mx'] = ""; +$text['label-asr']['fr-ca'] = ""; +$text['label-asr']['fr-fr'] = ""; +$text['label-asr']['he-il'] = ""; +$text['label-asr']['it-it'] = ""; +$text['label-asr']['nl-nl'] = ""; +$text['label-asr']['pl-pl'] = ""; +$text['label-asr']['pt-br'] = ""; +$text['label-asr']['pt-pt'] = ""; +$text['label-asr']['ro-ro'] = ""; +$text['label-asr']['ru-ru'] = ""; +$text['label-asr']['sv-se'] = ""; +$text['label-asr']['uk-ua'] = ""; +$text['label-asr']['tr-tr'] = ""; +$text['label-asr']['zh-cn'] = ""; +$text['label-asr']['ja-jp'] = ""; +$text['label-asr']['ko-kr'] = ""; + $text['label-aloc']['en-us'] = "ALOC"; $text['label-aloc']['en-gb'] = "ALOC"; $text['label-aloc']['ar-eg'] = "ALOC"; @@ -3672,6 +3724,84 @@ $text['description-mos']['zh-cn'] = "平均意见得分"; $text['description-mos']['ja-jp'] = "平均意見スコア"; $text['description-mos']['ko-kr'] = "평균 의견 점수"; +$text['description-volume']['en-us'] = "Inbound, Outbound, and Local"; +$text['description-volume']['en-gb'] = "Inbound, Outbound, and Local"; +$text['description-volume']['ar-eg'] = ""; +$text['description-volume']['de-at'] = ""; +$text['description-volume']['de-ch'] = ""; +$text['description-volume']['de-de'] = ""; +$text['description-volume']['el-gr'] = ""; +$text['description-volume']['es-cl'] = ""; +$text['description-volume']['es-mx'] = ""; +$text['description-volume']['fr-ca'] = ""; +$text['description-volume']['fr-fr'] = ""; +$text['description-volume']['he-il'] = ""; +$text['description-volume']['it-it'] = ""; +$text['description-volume']['nl-nl'] = ""; +$text['description-volume']['pl-pl'] = ""; +$text['description-volume']['pt-br'] = ""; +$text['description-volume']['pt-pt'] = ""; +$text['description-volume']['ro-ro'] = ""; +$text['description-volume']['ru-ru'] = ""; +$text['description-volume']['sv-se'] = ""; +$text['description-volume']['uk-ua'] = ""; +$text['description-volume']['tr-tr'] = ""; +$text['description-volume']['zh-cn'] = ""; +$text['description-volume']['ja-jp'] = ""; +$text['description-volume']['ko-kr'] = ""; + +$text['description-calls-per-minute']['en-us'] = "average minutes / calls per minute answered"; +$text['description-calls-per-minute']['en-gb'] = "average minutes / calls per minute answered"; +$text['description-calls-per-minute']['ar-eg'] = ""; +$text['description-calls-per-minute']['de-at'] = ""; +$text['description-calls-per-minute']['de-ch'] = ""; +$text['description-calls-per-minute']['de-de'] = ""; +$text['description-calls-per-minute']['el-gr'] = ""; +$text['description-calls-per-minute']['es-cl'] = ""; +$text['description-calls-per-minute']['es-mx'] = ""; +$text['description-calls-per-minute']['fr-ca'] = ""; +$text['description-calls-per-minute']['fr-fr'] = ""; +$text['description-calls-per-minute']['he-il'] = ""; +$text['description-calls-per-minute']['it-it'] = ""; +$text['description-calls-per-minute']['nl-nl'] = ""; +$text['description-calls-per-minute']['pl-pl'] = ""; +$text['description-calls-per-minute']['pt-br'] = ""; +$text['description-calls-per-minute']['pt-pt'] = ""; +$text['description-calls-per-minute']['ro-ro'] = ""; +$text['description-calls-per-minute']['ru-ru'] = ""; +$text['description-calls-per-minute']['sv-se'] = ""; +$text['description-calls-per-minute']['uk-ua'] = ""; +$text['description-calls-per-minute']['tr-tr'] = ""; +$text['description-calls-per-minute']['zh-cn'] = ""; +$text['description-calls-per-minute']['ja-jp'] = ""; +$text['description-calls-per-minute']['ko-kr'] = ""; + +$text['description-asr']['en-us'] = "Answer-Seizure Ratio (% of calls answered)"; +$text['description-asr']['en-gb'] = "Answer-Seizure Ratio (% of calls answered)"; +$text['description-asr']['ar-eg'] = ""; +$text['description-asr']['de-at'] = ""; +$text['description-asr']['de-ch'] = ""; +$text['description-asr']['de-de'] = ""; +$text['description-asr']['el-gr'] = ""; +$text['description-asr']['es-cl'] = ""; +$text['description-asr']['es-mx'] = ""; +$text['description-asr']['fr-ca'] = ""; +$text['description-asr']['fr-fr'] = ""; +$text['description-asr']['he-il'] = ""; +$text['description-asr']['it-it'] = ""; +$text['description-asr']['nl-nl'] = ""; +$text['description-asr']['pl-pl'] = ""; +$text['description-asr']['pt-br'] = ""; +$text['description-asr']['pt-pt'] = ""; +$text['description-asr']['ro-ro'] = ""; +$text['description-asr']['ru-ru'] = ""; +$text['description-asr']['sv-se'] = ""; +$text['description-asr']['uk-ua'] = ""; +$text['description-asr']['tr-tr'] = ""; +$text['description-asr']['zh-cn'] = ""; +$text['description-asr']['ja-jp'] = ""; +$text['description-asr']['ko-kr'] = ""; + $text['description-aloc']['en-us'] = "Average Length of Call"; $text['description-aloc']['en-gb'] = "Average Length of Call"; $text['description-aloc']['ar-eg'] = "متوسط طول المحادثة"; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index d7d2726bdd..5c14cf3bd5 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -33,10 +33,26 @@ if (!class_exists('xml_cdr')) { class xml_cdr { /** - * define variables + * Internal array structure that is populated from the database + * @var array Array of settings loaded from Default Settings */ private $settings; + + /** + * Set in the constructor. Must be a database object and cannot be null. + * @var database Database Object + */ private $database; + + /** + * Set in the constructor. This can be null. + * @var destinations Object + */ + private $destinations; + + /** + * define variables + */ public $array; public $fields; public $setting; @@ -78,12 +94,26 @@ if (!class_exists('xml_cdr')) { /** * Called when the object is created */ - public function __construct() { - //connect to the database - $this->database = new database; + public function __construct($setting_array = []) { - //get the email queue settings - $this->setting = new settings(); + //open a database connection + if (empty($setting_array['database'])) { + $this->database = database::new(); + } else { + $this->database = $setting_array['database']; + } + + //get the settings object + if (empty($setting_array['settings'])) { + $this->settings = new settings(); + } else { + $this->settings = $setting_array['settings']; + } + + //get the destinations object + if (!empty($setting_array['destinations'])) { + $this->destinations = $setting_array['destinations']; + } //assign private variables (for delete method) $this->app_name = 'xml_cdr'; @@ -100,23 +130,23 @@ if (!class_exists('xml_cdr')) { public function log($message) { //save the log if enabled is true - if ($this->setting->get('log', 'enabled', false)) { + if ($this->settings->get('log', 'enabled', false)) { //save the log to the php error log - if ($this->setting->get('log', 'type') == 'error_log') { + if ($this->settings->get('log', 'type') == 'error_log') { error_log($message); } //save the log to the syslog server - if ($this->setting->get('log', 'type') == 'syslog') { + if ($this->settings->get('log', 'type') == 'syslog') { openlog("XML CDR", LOG_PID | LOG_PERROR, LOG_LOCAL0); syslog(LOG_WARNING, $message); closelog(); } //save the log to the file system - if ($this->setting->get('log', 'text') == 'file') { - $fp = fopen($this->setting->get('server', 'temp').'/xml_cdr.log', 'a+'); + if ($this->settings->get('log', 'text') == 'file') { + $fp = fopen($this->settings->get('server', 'temp').'/xml_cdr.log', 'a+'); if (!$fp) { return; } @@ -205,8 +235,8 @@ if (!class_exists('xml_cdr')) { $this->fields[] = "hangup_cause_q850"; $this->fields[] = "sip_hangup_disposition"; - if (!empty($this->setting->get('cdr', 'field'))) { - foreach ($this->setting->get('cdr', 'field') as $field) { + if (!empty($this->settings->get('cdr', 'field'))) { + foreach ($this->settings->get('cdr', 'field') as $field) { $field_name = end(explode(',', $field)); $this->fields[] = $field_name; } @@ -226,8 +256,8 @@ if (!class_exists('xml_cdr')) { if (!empty($this->array)) { //set the directory - if (!empty($this->setting->get('switch', 'log'))) { - $xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr'; + if (!empty($this->settings->get('switch', 'log'))) { + $xml_cdr_dir = $this->settings->get('switch', 'log').'/xml_cdr'; } //add the temporary permission @@ -309,6 +339,9 @@ if (!class_exists('xml_cdr')) { //remove invalid numeric xml tags $xml_string = preg_replace('/<\/?\d+>/', '', $xml_string); + //replace xml tag name with + $xml_string = preg_replace('/(<\/?)(set )([^>]*>)/', '$1$3', $xml_string); + //disable xml entities if (PHP_VERSION_ID < 80000) { libxml_disable_entity_loader(true); } @@ -316,18 +349,18 @@ if (!class_exists('xml_cdr')) { $xml = simplexml_load_string($xml_string, 'SimpleXMLElement', LIBXML_NOCDATA); if ($xml === false) { //set the directory - if (!empty($this->setting->get('switch', 'log'))) { - $xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr'; + if (!empty($this->settings->get('switch', 'log'))) { + $xml_cdr_dir = $this->settings->get('switch', 'log').'/xml_cdr'; } //failed to load the XML, move the XML file to the failed directory if (!empty($xml_cdr_dir)) { - if (!file_exists($xml_cdr_dir.'/failed')) { - if (!mkdir($xml_cdr_dir.'/failed', 0660, true)) { + if (!file_exists($xml_cdr_dir.'/failed/invalid_xml')) { + if (!mkdir($xml_cdr_dir.'/failed/invalid_xml', 0660, true)) { die('Failed to create '.$xml_cdr_dir.'/failed'); } } - rename($xml_cdr_dir.'/'.$this->file, $xml_cdr_dir.'/failed/'.$this->file); + rename($xml_cdr_dir.'/'.$this->file, $xml_cdr_dir.'/failed/invalid_xml/'.$this->file); } //return without saving the invalid xml @@ -335,11 +368,11 @@ if (!class_exists('xml_cdr')) { } //skip call detail records for calls blocked by call block - if (isset($xml->variables->call_block) && !empty($this->setting->get('call_block', 'save_call_detail_record'))) { - if ($xml->variables->call_block == 'true' && $this->setting->get('call_block', 'save_call_detail_record') == 'false') { + if (isset($xml->variables->call_block) && !empty($this->settings->get('call_block', 'save_call_detail_record'))) { + if ($xml->variables->call_block == 'true' && $this->settings->get('call_block', 'save_call_detail_record') == 'false') { //delete the xml cdr file - if (!empty($this->setting->get('switch', 'log'))) { - $xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr'; + if (!empty($this->settings->get('switch', 'log'))) { + $xml_cdr_dir = $this->settings->get('switch', 'log').'/xml_cdr'; if (file_exists($xml_cdr_dir.'/'.$this->file)) { unlink($xml_cdr_dir.'/'.$this->file); } @@ -368,8 +401,8 @@ if (!class_exists('xml_cdr')) { $duplicate_uuid = true; //remove the file as the record already exists in the database - if (!empty($this->setting->get('switch', 'log'))) { - $xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr'; + if (!empty($this->settings->get('switch', 'log'))) { + $xml_cdr_dir = $this->settings->get('switch', 'log').'/xml_cdr'; if (file_exists($xml_cdr_dir.'/'.$this->file)) { unlink($xml_cdr_dir.'/'.$this->file); } @@ -615,8 +648,8 @@ if (!class_exists('xml_cdr')) { $domain_uuid = urldecode($xml->variables->domain_uuid); //sanitize the caller ID - $caller_id_name = preg_replace('#[^a-zA-Z 0-9\-\.]#', '', $caller_id_name); - $caller_id_number = preg_replace('#[^0-9\-]#', '', $caller_id_number); + $caller_id_name = preg_replace('#[^a-zA-Z0-9\-.\#*@ ]#', '', $caller_id_name); + $caller_id_number = preg_replace('#[^0-9\-\#\*]#', '', $caller_id_number); //misc $this->array[$key][0]['ring_group_uuid'] = urldecode($xml->variables->ring_group_uuid); @@ -794,8 +827,8 @@ if (!class_exists('xml_cdr')) { } //dynamic cdr fields - if (!empty($this->setting->get('cdr', 'field'))) { - foreach ($this->setting->get('cdr', 'field') as $field) { + if (!empty($this->settings->get('cdr', 'field'))) { + foreach ($this->settings->get('cdr', 'field') as $field) { $fields = explode(",", $field); $field_name = end($fields); $this->fields[] = $field_name; @@ -907,7 +940,7 @@ if (!class_exists('xml_cdr')) { //check to see if file exists with the default file name and path if (empty($record_name)) { - $path = $this->setting->get('switch', 'recordings').'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day; + $path = $this->settings->get('switch', 'recordings').'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day; if (file_exists($path.'/'.$uuid.'.wav')) { $record_path = $path; $record_name = $uuid.'.wav'; @@ -922,7 +955,7 @@ if (!class_exists('xml_cdr')) { //last check - check to see if file exists with the bridge_uuid for the file name and path if (empty($record_name)) { $bridge_uuid = urldecode($xml->variables->bridge_uuid) ?: $last_bridge; - $path = $this->setting->get('switch', 'recordings').'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day; + $path = $this->settings->get('switch', 'recordings').'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day; if (file_exists($path.'/'.$bridge_uuid.'.wav')) { $record_path = $path; $record_name = $bridge_uuid.'.wav'; @@ -957,7 +990,7 @@ if (!class_exists('xml_cdr')) { $this->json = json_encode($xml); //save to the database in xml format - if ($this->setting->get('cdr', 'format') == "xml" && $this->setting->get('cdr', 'storage') == "db") { + if ($this->settings->get('cdr', 'format') == "xml" && $this->settings->get('cdr', 'storage') == "db") { $this->array[$key][0]['xml'] = $xml_string; } @@ -1009,7 +1042,7 @@ if (!class_exists('xml_cdr')) { $this->array[$key][0]['call_flow'] = json_encode($this->call_flow()); //save to the database in json format - if ($this->setting->get('cdr', 'format') == "json" && $this->setting->get('cdr', 'storage') == "db") { + if ($this->settings->get('cdr', 'format') == "json" && $this->settings->get('cdr', 'storage') == "db") { $key = 'xml_cdr_json'; $this->array[$key][0]['xml_cdr_json_uuid'] = uuid(); $this->array[$key][0]['xml_cdr_uuid'] = $uuid; @@ -1018,10 +1051,10 @@ if (!class_exists('xml_cdr')) { } //save the call log to the database - if ($this->setting->get('cdr', 'call_log_enabled', false) && !empty($this->setting->get('switch', 'log')) && $this->setting->get('cdr', 'storage') == "db") { + if ($this->settings->get('cdr', 'call_log_enabled', false) && !empty($this->settings->get('switch', 'log')) && $this->settings->get('cdr', 'storage') == "db") { //get the log content $log_content = ''; - $handle = @fopen($this->setting->get('switch', 'log').'/freeswitch.log', "r"); + $handle = @fopen($this->settings->get('switch', 'log').'/freeswitch.log', "r"); if ($handle) { while (!feof($handle)) { $line = stream_get_line($handle, 0, "\n"); @@ -1044,13 +1077,13 @@ if (!class_exists('xml_cdr')) { } //store xml cdr on the file system as a file - if ($this->setting->get('cdr', 'storage') == "dir" && $error != "true") { + if ($this->settings->get('cdr', 'storage') == "dir" && $error != "true") { if (!empty($uuid)) { - $tmp_dir = $this->setting->get('switch', 'log').'/xml_cdr/archive/'.$start_year.'/'.$start_month.'/'.$start_day; + $tmp_dir = $this->settings->get('switch', 'log').'/xml_cdr/archive/'.$start_year.'/'.$start_month.'/'.$start_day; if(!file_exists($tmp_dir)) { mkdir($tmp_dir, 0770, true); } - if ($this->setting->get('cdr', 'format') == "xml") { + if ($this->settings->get('cdr', 'format') == "xml") { $tmp_file = $uuid.'.xml'; $fh = fopen($tmp_dir.'/'.$tmp_file, 'w'); fwrite($fh, $xml_string); @@ -1140,8 +1173,8 @@ if (!class_exists('xml_cdr')) { public function call_flow_summary($call_flow_array) { //set the time zone - if (!empty($this->setting->get('domain', 'time_zone'))) { - $time_zone = $this->setting->get('domain', 'time_zone'); + if (!empty($this->settings->get('domain', 'time_zone'))) { + $time_zone = $this->settings->get('domain', 'time_zone'); } else { $time_zone = date_default_timezone_get(); @@ -1151,8 +1184,9 @@ if (!class_exists('xml_cdr')) { date_default_timezone_set($time_zone); //get the destination select list - $destination = new destinations; - $destination_array = $destination->get('dialplan'); + if ($this->destinations) { + $destination_array = $this->destinations->get('dialplan'); + } //add new rows when callee_id_number exists $new_rows = 0; @@ -1278,6 +1312,15 @@ if (!class_exists('xml_cdr')) { $app['status'] = 'routed'; } + //add the source if there is a value + if (!empty($row["caller_profile"]["username"])) { + $app_source = $this->find_app($destination_array, $row["caller_profile"]["username"]); + $app['source_number'] = $row["caller_profile"]["username"]; + $app['source_uuid'] = $app_source['uuid']; + $app['source_name'] = $app_source['name']; + $app['source_label'] = $app_source['label']; + } + //outbound routes if ($this->call_direction == 'outbound') { $status = 'missed'; @@ -1288,7 +1331,6 @@ if (!class_exists('xml_cdr')) { if (!empty($row["caller_profile"]["username"])) { //add to the application array $app['application'] = 'extensions'; - $app['source'] = $row["caller_profile"]["username"]; $app['status'] = $status; $app['name'] = ''; $app['label'] = 'extensions'; @@ -1362,25 +1404,35 @@ if (!class_exists('xml_cdr')) { } //build the application urls - $destination_url = "/app/".($app['application'] ?? '')."/".$destination->singular($app['application'] ?? '')."_edit.php?id=".($app["uuid"] ?? ''); - $application_url = "/app/".($app['application'] ?? '')."/".($app['application'] ?? '').".php"; - if (!empty($app['application']) && $app['application'] == 'call_centers') { - $destination_url = "/app/".($app['application'] ?? '')."/".$destination->singular($app['application'] ?? '')."_queue_edit.php?id=".($app["uuid"] ?? ''); - $application_url = "/app/".($app['application'] ?? '')."/".$destination->singular($app['application'] ?? '')."_queues.php"; + if (!empty($app['application'])) { + //build the source url + $source_url = ''; + if (!empty($app["source_uuid"])) { + $source_url = "/app/".($app['application'] ?? '')."/".$this->singular($app['application'] ?? '')."_edit.php?id=".($app["source_uuid"] ?? ''); + } + + //build the destination url + $destination_url = ''; + $destination_url = "/app/".($app['application'] ?? '')."/".$this->singular($app['application'] ?? '')."_edit.php?id=".($app["uuid"] ?? ''); + $application_url = "/app/".($app['application'] ?? '')."/".($app['application'] ?? '').".php"; + if ($app['application'] == 'call_centers') { + $destination_url = "/app/".($app['application'] ?? '')."/".$this->singular($app['application'] ?? '')."_queue_edit.php?id=".($app["uuid"] ?? ''); + $application_url = "/app/".($app['application'] ?? '')."/".$this->singular($app['application'] ?? '')."_queues.php"; + } } //add the application and destination details $language2 = new text; - $text2 = $language2->get($this->setting->get('domain', 'language'), 'app/'.($app['application'] ?? '')); + $text2 = $language2->get($this->settings->get('domain', 'language'), 'app/'.($app['application'] ?? '')); $call_flow_summary[$x]["application_name"] = ($app['application'] ?? ''); $call_flow_summary[$x]["application_label"] = trim($text2['title-'.($app['application'] ?? '')] ?? ''); $call_flow_summary[$x]["call_direction"] = $this->call_direction; $call_flow_summary[$x]["application_url"] = $application_url; if ($this->call_direction == 'outbound') { - $call_flow_summary[$x]["source_uuid"] = ($app['uuid'] ?? ''); - $call_flow_summary[$x]["source_number"] = $app['source']; - $call_flow_summary[$x]["source_label"] = ($app['label'] ?? ''); + $call_flow_summary[$x]["source_uuid"] = ($app['source_uuid'] ?? ''); + $call_flow_summary[$x]["source_number"] = ($app['source_number'] ?? ''); + $call_flow_summary[$x]["source_label"] = ($app['source_label'] ?? ''); $call_flow_summary[$x]["source_url"] = $destination_url; $call_flow_summary[$x]["source_name"] = $app['description'] ?? ''; //$call_flow_summary[$x]["source_description"] = $app['description'] ?? ''; @@ -1391,14 +1443,14 @@ if (!class_exists('xml_cdr')) { $call_flow_summary[$x]["destination_description"] = ''; } else { - $call_flow_summary[$x]["source_uuid"] = ''; - $call_flow_summary[$x]["source_number"] = ''; - $call_flow_summary[$x]["source_label"] = ''; - $call_flow_summary[$x]["source_url"] = ''; + $call_flow_summary[$x]["source_uuid"] = ($app['source_uuid'] ?? ''); + $call_flow_summary[$x]["source_number"] = ($app['source_number'] ?? ''); + $call_flow_summary[$x]["source_label"] = ($app['source_label'] ?? ''); + $call_flow_summary[$x]["source_url"] = ($source_url ?? ''); $call_flow_summary[$x]["destination_name"] = ($app['description'] ?? ''); $call_flow_summary[$x]["destination_uuid"] = ($app['uuid'] ?? ''); $call_flow_summary[$x]["destination_label"] = ($app['label'] ?? ''); - $call_flow_summary[$x]["destination_url"] = $destination_url; + $call_flow_summary[$x]["destination_url"] = $destination_url ?? ''; //$call_flow_summary[$x]["destination_description"] = $app['description'] ?? ''; } $call_flow_summary[$x]["destination_number"] = $row["caller_profile"]["destination_number"]; @@ -1413,10 +1465,10 @@ if (!class_exists('xml_cdr')) { //add the call flow times $call_flow_summary[$x]["start_epoch"] = round($profile_created_epoch); $call_flow_summary[$x]["end_epoch"] = round($profile_end_epoch); - $call_flow_summary[$x]["start_stamp"] = date("Y-m-d H:i:s", $profile_created_epoch); - $call_flow_summary[$x]["end_stamp"] = date("Y-m-d H:i:s", $profile_end_epoch); + $call_flow_summary[$x]["start_stamp"] = date("Y-m-d H:i:s", (int)$profile_created_epoch); + $call_flow_summary[$x]["end_stamp"] = date("Y-m-d H:i:s", (int)$profile_end_epoch); $call_flow_summary[$x]["duration_seconds"] = round($profile_end_epoch - $profile_created_epoch); - $call_flow_summary[$x]["duration_formatted"] = gmdate("G:i:s",(int) $call_flow_summary[$x]["duration_seconds"]); + $call_flow_summary[$x]["duration_formatted"] = gmdate("G:i:s",(int)$call_flow_summary[$x]["duration_seconds"]); unset($app); $x++; } @@ -1497,8 +1549,8 @@ if (!class_exists('xml_cdr')) { } } - public function moved_to_failed($failed_file) { - $xml_cdr_dir = $this->setting->get('switch', 'log', '/var/log/freeswitch').'/xml_cdr'; + public function move_to_failed($failed_file) { + $xml_cdr_dir = $this->settings->get('switch', 'log', '/var/log/freeswitch').'/xml_cdr'; if (!file_exists($xml_cdr_dir.'/failed')) { if (!mkdir($xml_cdr_dir.'/failed', 0660, true)) { die('Failed to create '.$xml_cdr_dir.'/failed'); @@ -1511,7 +1563,7 @@ if (!class_exists('xml_cdr')) { * get xml from the filesystem and save it to the database */ public function read_files() { - $xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr'; + $xml_cdr_dir = $this->settings->get('switch', 'log').'/xml_cdr'; $dir_handle = opendir($xml_cdr_dir); $x = 0; while($file = readdir($dir_handle)) { @@ -1611,9 +1663,9 @@ if (!class_exists('xml_cdr')) { //authentication for xml cdr http post if (!defined('STDIN')) { - if ($this->setting->get('cdr', 'http_enabled')) { + if ($this->settings->get('cdr', 'http_enabled')) { //get the contents of xml_cdr.conf.xml - $conf_xml_string = file_get_contents($this->setting->get('switch', 'conf').'/autoload_configs/xml_cdr.conf.xml'); + $conf_xml_string = file_get_contents($this->settings->get('switch', 'conf').'/autoload_configs/xml_cdr.conf.xml'); //parse the xml to get the call detail record info try { @@ -1643,7 +1695,7 @@ if (!class_exists('xml_cdr')) { //if http enabled is set to false then deny access if (!defined('STDIN')) { - if ($this->setting->get('cdr', 'http_enabled') == "false") { + if ($this->settings->get('cdr', 'http_enabled') == "false") { openlog('FusionPBX', LOG_NDELAY, LOG_AUTH); syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR'].'] XML CDR import default setting http_enabled is not enabled. Line: '.__line__); closelog(); @@ -1655,7 +1707,7 @@ if (!class_exists('xml_cdr')) { //check for the correct username and password if (!defined('STDIN')) { - if ($this->setting->get('cdr', 'http_enabled', true)) { + if ($this->settings->get('cdr', 'http_enabled', true)) { if ($auth_array[0] == $_SERVER["PHP_AUTH_USER"] && $auth_array[1] == $_SERVER["PHP_AUTH_PW"]) { //echo "access granted\n"; $this->username = $auth_array[0]; @@ -1703,8 +1755,8 @@ if (!class_exists('xml_cdr')) { public function user_summary() { //set the time zone - if (!empty($this->setting->get('domain', 'time_zone'))) { - $time_zone = $this->setting->get('domain', 'time_zone'); + if (!empty($this->settings->get('domain', 'time_zone'))) { + $time_zone = $this->settings->get('domain', 'time_zone'); } else { $time_zone = date_default_timezone_get(); @@ -2158,6 +2210,46 @@ if (!class_exists('xml_cdr')) { unset($records); } //method + + /** + * define singular function to convert a word in english to singular + */ + public function singular($word) { + //"-es" is used for words that end in "-x", "-s", "-z", "-sh", "-ch" in which case you add + if (substr($word, -2) == "es") { + if (substr($word, -4) == "sses") { // eg. 'addresses' to 'address' + return substr($word,0,-2); + } + elseif (substr($word, -3) == "ses") { // eg. 'databases' to 'database' (necessary!) + return substr($word,0,-1); + } + elseif (substr($word, -3) == "ies") { // eg. 'countries' to 'country' + return substr($word,0,-3)."y"; + } + elseif (substr($word, -3, 1) == "x") { + return substr($word,0,-2); + } + elseif (substr($word, -3, 1) == "s") { + return substr($word,0,-2); + } + elseif (substr($word, -3, 1) == "z") { + return substr($word,0,-2); + } + elseif (substr($word, -4, 2) == "sh") { + return substr($word,0,-2); + } + elseif (substr($word, -4, 2) == "ch") { + return substr($word,0,-2); + } + else { + return rtrim($word, "s"); + } + } + else { + return rtrim($word, "s"); + } + } //method + /** * Removes old entries for in the database xml_cdr, xml_cdr_flow, xml_cdr_json, xml_cdr_logs table * see {@link https://github.com/fusionpbx/fusionpbx-app-maintenance/} FusionPBX Maintenance App diff --git a/app/xml_cdr/resources/dashboard/missed_calls.php b/app/xml_cdr/resources/dashboard/missed_calls.php index 80b3378c2d..031555195f 100644 --- a/app/xml_cdr/resources/dashboard/missed_calls.php +++ b/app/xml_cdr/resources/dashboard/missed_calls.php @@ -149,7 +149,7 @@ echo "\n"; echo "
\n"; echo " \n"; - echo " ".$num_rows."\n"; + echo " ".$num_rows."\n"; echo "
\n"; echo "
"; } diff --git a/app/xml_cdr/resources/dashboard/recent_calls.php b/app/xml_cdr/resources/dashboard/recent_calls.php index 8de16e74cb..fb787e2999 100644 --- a/app/xml_cdr/resources/dashboard/recent_calls.php +++ b/app/xml_cdr/resources/dashboard/recent_calls.php @@ -147,7 +147,7 @@ echo "
\n"; echo "
\n"; echo " \n"; - echo " ".$num_rows."\n"; + echo " ".$num_rows."\n"; echo "
\n"; echo "
"; } diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index eca4c79e62..2bc7f3115f 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -263,12 +263,13 @@ $outbound_caller_id_number = urldecode($array["variables"]["outbound_caller_id_number"] ?? ''); //set the time zone - if (isset($_SESSION['domain']['time_zone']['name'])) { - date_default_timezone_set($_SESSION['domain']['time_zone']['name']); - } + date_default_timezone_set($settings->get('domain', 'time_zone', 'GMT')); + +//create the destinations object + $destinations = new destinations(); //build the call flow summary array - $xml_cdr = new xml_cdr; + $xml_cdr = new xml_cdr(["database" => $database, "settings" => $settings, "destinations" => $destinations]); $xml_cdr->domain_uuid = $_SESSION['domain_uuid']; $xml_cdr->call_direction = $call_direction; //used to determine when the call is outbound $xml_cdr->status = $status; //used to determine when the call is outbound @@ -496,37 +497,33 @@ echo "\n"; echo "\n"; echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - if ($call_direction == 'outbound') { - echo " \n"; + echo "
".$text['label-application']."".$text['label-source']."
\n"; + echo " \n"; + echo " \n"; + if ($call_direction == 'local' || $call_direction == 'outbound') { + echo " \n"; } - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; $i = 1; foreach ($call_flow_summary as $row) { - echo "\n"; - echo " \n"; - if ($call_direction == 'outbound') { - echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + if ($call_direction == 'local' || $call_direction == 'outbound') { + echo " \n"; } - else { - echo " \n"; - echo " \n"; - } - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; //alternate $c $c = $c ? 0 : 1; @@ -534,7 +531,7 @@ //increment the row count $i++; } - echo "
".$text['label-application']."".$text['label-source']."".$text['label-destination']."".$text['label-name']."".$text['label-start']."".$text['label-end']."".$text['label-duration']."".$text['label-status']."
".$text['label-destination']."".$text['label-name']."".$text['label-start']."".$text['label-end']."".$text['label-duration']."".$text['label-status']."
".escape($row["application_label"])."".escape($row["source_number"])."".escape($row["destination_number"])."".escape($row["source_name"])."
".escape($row["application_label"])."".escape($row["source_number"])."".escape($row["destination_number"])."".escape($row["destination_name"])."".escape($row["start_stamp"])."".escape($row["end_stamp"])."".escape($row["duration_formatted"])."".escape($text['label-'.$row["destination_status"]] ?? '')."
".escape($row["destination_number"])."".escape($row["destination_label"])."".escape($row["start_stamp"])."".escape($row["end_stamp"])."".escape($row["duration_formatted"])."".escape($text['label-'.$row["destination_status"]] ?? '')."
"; + echo " "; echo "
\n"; echo "

\n"; @@ -542,14 +539,14 @@ if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($record_transcription)) { echo "".$text['label-transcription']."
\n"; echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "\n"; - echo "
".$text['label-text']."
".escape($record_transcription)."
"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['label-text']."
".escape($record_transcription)."
"; echo "
\n"; echo "

\n"; } diff --git a/app/xml_cdr/xml_cdr_statistics.php b/app/xml_cdr/xml_cdr_statistics.php index 37b7247804..c90285e111 100644 --- a/app/xml_cdr/xml_cdr_statistics.php +++ b/app/xml_cdr/xml_cdr_statistics.php @@ -281,11 +281,11 @@ echo " ".$text['label-hours']."\n"; echo " ".$text['label-date']."\n"; echo " ".$text['label-time']."\n"; - echo " Volume\n"; + echo " ".$text['label-volume']."\n"; echo " ".$text['label-minutes']."\n"; - echo " ".$text['label-calls-per-minute']."\n"; + echo " ".$text['label-calls-per-minute']."\n"; echo " ".$text['label-missed']."\n"; - echo " ASR\n"; + echo " ".$text['label-asr']."\n"; echo " ".$text['label-aloc']."\n"; echo "\n"; diff --git a/app/yealink/app_config.php b/app/yealink/app_config.php index 2f5a9f280a..28c3ff6cd7 100644 --- a/app/yealink/app_config.php +++ b/app/yealink/app_config.php @@ -272,6 +272,150 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "URL for Yealink Super Search XML configuration file"; $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "9c704e81-cbb4-4cb3-ab1c-427755008714"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t33g_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/320x240.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T33G"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "25b592b1-05f1-42dd-b248-95b8427f1c30"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t33g_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/320x240.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T33G screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "ab97779a-8d32-4ab4-a88f-4ea1433d00ba"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t46s_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T46S"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "4b663bab-bee1-4678-afc0-9a50e2a73247"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t46s_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T46S screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "50f4d28d-d4a9-493f-91e3-6294acd386d5"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t46u_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T46U"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "53bf8793-5e73-448b-9119-b1bdcc42fcb0"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t46u_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T46U screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "776c002e-7fd2-4b8e-b21e-fd699e1e7eac"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48g_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T48G"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "51e83cf5-36fa-408b-bdec-44f28caa5c5c"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48g_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T48G screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "bda0bec9-f11b-499b-80fa-08f912430a78"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48s_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T48S"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "029529dc-de3c-4723-b8f9-3940212f2c9a"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48s_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T48S screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "c11b2f46-1aef-45be-833e-3680dff9828a"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48u_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T48U"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "c6a601ba-506d-4611-b6a9-8c55ec42d74d"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t48u_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.jpg.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T48U screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "129857df-07b9-4067-a464-6d6434ad5ac9"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t54w_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T54W"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "fde79b68-2e3b-432c-8813-139d79405deb"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t54w_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/480x272.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T54W screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "ffe40f6e-fd01-4d0d-b616-cff92d1fac84"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t57w_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T57W"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "d19b69c8-272b-482e-a3d6-ed52dfc83b7a"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t57w_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/800x480.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T57W screen"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "31c524a8-f7a0-4d68-93df-e589975e4840"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t58w_wallpaper"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/1024x600.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Background Wallpaper for the T58W"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "a73904a4-f126-411b-a357-9daf7a5b6dc2"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_t58w_wallpaper_filename"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/yealink/resources/images/1024x600.png"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Wallpaper to load on to T58W screen"; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "3f903069-c0fc-4bf1-9c33-907bf238475e"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_firmware_url"; @@ -512,6 +656,14 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Filename of the T58A firmware ROM"; $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "8368b1ea-6ce8-4004-9ebe-c1a61f2800b5"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_firmware_t58w"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "t58w-150.80.0.25.rom"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Filename of the T58W firmware ROM"; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "2cdd8b87-db72-4ad1-b18b-745fc1f7e906"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_firmware_t58v"; @@ -1268,7 +1420,7 @@ $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_voice_vad"; $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "1"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set 1 = On, 0 = Off (default)"; $y++; @@ -1577,7 +1729,7 @@ $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Saving Enabled. Options: 0-Disabled, 1-Enabled"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Power Saving Enabled. Options: 0-Disabled, 1-Enabled"; $y++; ?> diff --git a/core/contacts/app_languages.php b/core/contacts/app_languages.php index e8825a4c77..0a86f3826a 100644 --- a/core/contacts/app_languages.php +++ b/core/contacts/app_languages.php @@ -1793,6 +1793,31 @@ $text['message-uploaded']['zh-cn'] = "文件已上传"; $text['message-uploaded']['ja-jp'] = "ファイルがアップロードされました"; $text['message-uploaded']['ko-kr'] = "업로드된 파일"; +$text['message-speed_dial_exists']['en-us'] = "Speed Dial Number Already Exists"; +$text['message-speed_dial_exists']['en-gb'] = "Speed Dial Number Already Exists"; +$text['message-speed_dial_exists']['ar-eg'] = "رقم الاتصال السريع موجود بالفعل"; +$text['message-speed_dial_exists']['de-at'] = "Kurzwahlnummer existiert bereits"; +$text['message-speed_dial_exists']['de-ch'] = "Kurzwahlnummer existiert bereits"; +$text['message-speed_dial_exists']['de-de'] = "Kurzwahlnummer existiert bereits"; +$text['message-speed_dial_exists']['es-cl'] = "El número de marcación rápida ya existe"; +$text['message-speed_dial_exists']['es-mx'] = "El número de marcación rápida ya existe"; +$text['message-speed_dial_exists']['fr-ca'] = "Le numéro abrégé existe déjà"; +$text['message-speed_dial_exists']['fr-fr'] = "Le numéro de numérotation rapide existe déjà"; +$text['message-speed_dial_exists']['he-il'] = "מספר חיוג מהיר כבר קיים"; +$text['message-speed_dial_exists']['it-it'] = "Il numero di selezione rapida esiste già"; +$text['message-speed_dial_exists']['ka-ge'] = "სწრაფი აკრეფის ნომერი უკვე არსებობს"; +$text['message-speed_dial_exists']['nl-nl'] = "Snelkiesnummer bestaat al"; +$text['message-speed_dial_exists']['pl-pl'] = "Numer szybkiego wybierania już istnieje"; +$text['message-speed_dial_exists']['pt-br'] = "Número de discagem rápida já existe"; +$text['message-speed_dial_exists']['pt-pt'] = "O número de marcação rápida já existe"; +$text['message-speed_dial_exists']['ro-ro'] = "Numărul de apelare rapidă există deja"; +$text['message-speed_dial_exists']['ru-ru'] = "Номер быстрого набора уже существует"; +$text['message-speed_dial_exists']['sv-se'] = "Snabbuppringningsnummer finns redan"; +$text['message-speed_dial_exists']['uk-ua'] = "Номер швидкого набору вже існує"; +$text['message-speed_dial_exists']['zh-cn'] = "快速拨号号码已存在"; +$text['message-speed_dial_exists']['ja-jp'] = "短縮ダイヤル番号は既に存在します"; +$text['message-speed_dial_exists']['ko-kr'] = "단축번호가 이미 존재합니다"; + $text['label-voice']['en-us'] = "Voice"; $text['label-voice']['en-gb'] = "Voice"; $text['label-voice']['ar-eg'] = "صوت"; diff --git a/core/contacts/contact_edit.php b/core/contacts/contact_edit.php index d8d1767eab..75e7caf809 100644 --- a/core/contacts/contact_edit.php +++ b/core/contacts/contact_edit.php @@ -367,7 +367,33 @@ if (!empty($contact_phones)) { foreach ($contact_phones as $row) { if (!empty($row['phone_number'])) { - //add the speed dial + + //if speed dial number already exists, empty before save + if (!empty($row["phone_speed_dial"])) { + $phone_speed_dial_exists = false; + if (is_numeric($row["phone_speed_dial"])) { + $sql = "select count(contact_phone_uuid) "; + $sql .= "from v_contact_phones "; + $sql .= "where phone_speed_dial = :phone_speed_dial "; + $sql .= "and domain_uuid = :domain_uuid "; + if ($action == "update" && is_uuid($row["contact_phone_uuid"])) { + $sql .= "and contact_phone_uuid <> :contact_phone_uuid "; + $parameters['contact_phone_uuid'] = $row["contact_phone_uuid"]; + } + $parameters['phone_speed_dial'] = $row["phone_speed_dial"]; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $database = new database; + if (!empty($database->execute($sql, $parameters, 'column'))) { + $phone_speed_dial_exists = true; + } + unset($sql, $parameters); + } + if (!is_numeric($row["phone_speed_dial"]) || $phone_speed_dial_exists) { + message::add($text['message-speed_dial_exists'],'negative'); + unset($row["phone_speed_dial"]); + } + } + $array['contacts'][0]['contact_phones'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_phones'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_phones'][$y]['contact_phone_uuid'] = $row["contact_phone_uuid"]; diff --git a/core/contacts/contact_phone_edit.php b/core/contacts/contact_phone_edit.php index c999eb7aec..f204491500 100644 --- a/core/contacts/contact_phone_edit.php +++ b/core/contacts/contact_phone_edit.php @@ -155,6 +155,32 @@ unset($sql, $parameters); } + //if speed dial number already exists, empty before save + if (!empty($phone_speed_dial)) { + $phone_speed_dial_exists = false; + if (is_numeric($phone_speed_dial)) { + $sql = "select count(contact_phone_uuid) "; + $sql .= "from v_contact_phones "; + $sql .= "where phone_speed_dial = :phone_speed_dial "; + $sql .= "and domain_uuid = :domain_uuid "; + if ($action == "update" && is_uuid($contact_phone_uuid)) { + $sql .= "and contact_phone_uuid <> :contact_phone_uuid "; + $parameters['contact_phone_uuid'] = $contact_phone_uuid; + } + $parameters['phone_speed_dial'] = $phone_speed_dial; + $parameters['domain_uuid'] = $domain_uuid; + $database = new database; + if (!empty($database->execute($sql, $parameters, 'column'))) { + $phone_speed_dial_exists = true; + } + unset($sql, $parameters); + } + if (!is_numeric($phone_speed_dial) || $phone_speed_dial_exists) { + message::add($text['message-speed_dial_exists'],'negative'); + unset($phone_speed_dial); + } + } + //add the phone if ($action == "add" && permission_exists('contact_phone_add')) { $contact_phone_uuid = uuid(); diff --git a/core/contacts/contact_phones_view.php b/core/contacts/contact_phones_view.php index 4f0cf25874..3a9664588c 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 "