\n";
- echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$setting->get('theme','button_icon_back'),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'fax.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'=>'fax.php']);
if ($domain_enabled == true) {
echo button::create(['type'=>'submit','label'=>$text['button-preview'],'icon'=>'eye','name'=>'submit','value'=>'preview']);
echo button::create(['type'=>'submit','label'=>$text['button-send'],'icon'=>'paper-plane','id'=>'btn_save','name'=>'submit','value'=>'send','style'=>'margin-left: 15px;']);
@@ -1015,7 +1021,7 @@ if (!defined('STDIN')) {
echo "
\n";
echo $text['description-2']." ".(permission_exists('fax_extension_view_domain') ? $text['description-3'] : null)."\n";
echo "
\n";
}
@@ -1028,7 +1034,7 @@ if (!defined('STDIN')) {
echo " ".$text['label-fax-header']."\n";
echo "\n";
echo "
\n";
@@ -1096,7 +1102,7 @@ if (!defined('STDIN')) {
for ($f = 1; $f <= 3; $f++) {
echo "
\n";
if (permission_exists('fifo_add') || permission_exists('fifo_edit') || permission_exists('fifo_delete')) {
@@ -284,8 +287,8 @@
}
echo " \n";
echo " ".escape($row['fifo_extension'])." \n";
- echo " ".escape($row['fifo_agent_queue'])." \n";
echo " ".escape($row['fifo_agent_status'])." \n";
+ echo " ".escape($row['fifo_agent_queue'])." \n";
echo " ".escape($row['fifo_order'])." \n";
if (permission_exists('fifo_edit')) {
echo " \n";
@@ -319,4 +322,4 @@
//include the footer
require_once "resources/footer.php";
-?>
+?>
\ No newline at end of file
diff --git a/app/fifo/fifo_edit.php b/app/fifo/fifo_edit.php
index 0087904d74..164caebe18 100644
--- a/app/fifo/fifo_edit.php
+++ b/app/fifo/fifo_edit.php
@@ -39,9 +39,15 @@
$language = new text;
$text = $language->get();
+//connect to the database
+ $database = database::new();
+
//add the settings object
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
+//setup the event socket connection
+ $event_socket = event_socket::create();
+
//set from session variables
$button_icon_back = $settings->get('theme', 'button_icon_back', '');
$button_icon_copy = $settings->get('theme', 'button_icon_copy', '');
@@ -66,7 +72,11 @@
$fifo_extension = $_POST["fifo_extension"];
$fifo_agent_status = $_POST["fifo_agent_status"];
$fifo_agent_queue = $_POST["fifo_agent_queue"];
+ $fifo_strategy = $_POST["fifo_strategy"];
$fifo_members = $_POST["fifo_members"];
+ $fifo_timeout_seconds = $_POST["fifo_timeout_seconds"];
+ $fifo_exit_key = $_POST["fifo_exit_key"];
+ $fifo_exit_action = $_POST["fifo_exit_action"];
$fifo_music = $_POST["fifo_music"];
$domain_uuid = $_POST["domain_uuid"];
$fifo_order = $_POST["fifo_order"];
@@ -104,20 +114,17 @@
switch ($_POST['action']) {
case 'copy':
if (permission_exists('fifo_add')) {
- $obj = new database;
- $obj->copy($array);
+ $database->copy($array);
}
break;
case 'delete':
if (permission_exists('fifo_delete')) {
- $obj = new database;
- $obj->delete($array);
+ $database->delete($array);
}
break;
case 'toggle':
if (permission_exists('fifo_update')) {
- $obj = new database;
- $obj->toggle($array);
+ $database->toggle($array);
}
break;
}
@@ -129,13 +136,38 @@
}
}
+ //validate the data
+ $fifo_extension = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_extension ?? '');
+ $fifo_order = preg_replace('#[^0-9]#', '', $fifo_order ?? '');
+ $fifo_exit_key = preg_replace('#[^0-9]#', '', $fifo_exit_key ?? '');
+ $fifo_timeout_seconds = preg_replace('#[^0-9]#', '', $fifo_timeout_seconds ?? '');
+ $fifo_agent_status = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_agent_status ?? '');
+ $fifo_agent_queue = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_agent_queue ?? '');
+ if (!empty($fifo_uuid) && !is_uuid($fifo_uuid)) { throw new Exception("invalid uuid"); }
+ if (!empty($dialplan_uuid) && !is_uuid($dialplan_uuid)) { throw new Exception("invalid uuid"); }
+
+ if (is_array($fifo_members)) {
+ $i = 0;
+ foreach ($fifo_members as $row) {
+ $fifo_members[$i]['member_contact'] = preg_replace('#[^a-zA-Z0-9/@.\-\*]#', '', $row["member_contact"] ?? '');
+ $fifo_members[$i]['member_call_timeout'] = preg_replace('#[^0-9]#', '', $row["member_call_timeout"] ?? '20');
+ $fifo_members[$i]['member_wrap_up_time'] = preg_replace('#[^0-9]#', '', $row["member_wrap_up_time"] ?? '10');
+ $fifo_members[$i]['member_enabled'] = $row["member_enabled"] ?? 'false';
+ $i++;
+ }
+ }
+
//check for all required data
$msg = '';
if (strlen($fifo_name) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_name']." \n"; }
if (strlen($fifo_extension) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_extension']." \n"; }
//if (strlen($fifo_agent_status) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_agent_status']." \n"; }
//if (strlen($fifo_agent_queue) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_agent_queue']." \n"; }
+ if (strlen($fifo_strategy) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_strategy']." \n"; }
//if (strlen($fifo_members) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_members']." \n"; }
+ //if (strlen($fifo_timeout_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_timeout_seconds']." \n"; }
+ //if (strlen($fifo_exit_key) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_exit_key']." \n"; }
+ //if (strlen($fifo_exit_action) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_exit_action']." \n"; }
//if (strlen($fifo_music) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_music']." \n"; }
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; }
if (strlen($fifo_order) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_order']." \n"; }
@@ -177,52 +209,115 @@
$array['fifo'][0]['fifo_extension'] = $fifo_extension;
$array['fifo'][0]['fifo_agent_status'] = $fifo_agent_status;
$array['fifo'][0]['fifo_agent_queue'] = $fifo_agent_queue;
+ $array['fifo'][0]['fifo_strategy'] = $fifo_strategy;
+ $array['fifo'][0]['fifo_timeout_seconds'] = $fifo_timeout_seconds;
+ $array['fifo'][0]['fifo_exit_key'] = $fifo_exit_key;
+ $array['fifo'][0]['fifo_exit_action'] = $fifo_exit_action;
$array['fifo'][0]['fifo_music'] = $fifo_music;
$array['fifo'][0]['fifo_order'] = $fifo_order;
$array['fifo'][0]['fifo_enabled'] = $fifo_enabled;
$array['fifo'][0]['fifo_description'] = $fifo_description;
- $y = 0;
if (is_array($fifo_members)) {
+ $y = 0;
foreach ($fifo_members as $row) {
if (!empty($row['member_contact']) && strlen($row['member_contact']) > 0) {
$array['fifo'][0]['fifo_members'][$y]['fifo_member_uuid'] = $row["fifo_member_uuid"];
$array['fifo'][0]['fifo_members'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['fifo'][0]['fifo_members'][$y]['member_contact'] = $row["member_contact"];
- $array['fifo'][0]['fifo_members'][$y]['member_call_timeout'] = $row["member_call_timeout"];
+ $array['fifo'][0]['fifo_members'][$y]['member_call_timeout'] = $row["member_call_timeout"] ?? '20';
//$array['fifo'][0]['fifo_members'][$y]['member_simultaneous'] = $row["member_simultaneous"];
- $array['fifo'][0]['fifo_members'][$y]['member_wrap_up_time'] = $row["member_wrap_up_time"];
+ $array['fifo'][0]['fifo_members'][$y]['member_wrap_up_time'] = $row["member_wrap_up_time"] ?? '10';
$array['fifo'][0]['fifo_members'][$y]['member_enabled'] = $row["member_enabled"] ?? 'false';
$y++;
}
}
}
+ //send commands for agent login or agent logout
+ if (is_array($fifo_members)) {
+ foreach ($fifo_members as $row) {
+ //empty row skip iteration
+ if (empty($row["member_contact"])) {
+ continue;
+ }
+
+ //build the command to add or remove the agent from the FIFO queue
+ if ($row["member_enabled"] == 'true') {
+ $command = "fifo_member add ".$fifo_extension."@".$_SESSION['domain_name']." {fifo_member_wait=nowait}".$row["member_contact"]." 5 ".$row['member_call_timeout']." ".$row['member_wrap_up_time'];
+ }
+ else {
+ $command = "fifo_member del ".$fifo_extension."@".$_SESSION['domain_name']." {fifo_member_wait=nowait}".$row["member_contact"];
+ }
+
+ if ($event_socket->is_connected()) {
+ $response = $event_socket->command('api '.$command);
+ }
+ }
+ }
+
+ //get the action destination number
+ if (!empty($fifo_exit_action)) {
+ $fifo_exit_destination = explode(':', $fifo_exit_action)[1];
+ $fifo_exit_destination = explode(' ', $fifo_exit_destination)[0];
+ }
+
//add the fifo dialplan
if (!empty($fifo_extension)) {
//escape the * symbol
$fifo_agent_status_xml = str_replace("*", "\*", $fifo_agent_status);
$fifo_agent_queue_xml = str_replace("*", "\*", $fifo_agent_queue);
+ //prepare the fifo orbit extension
+ if (!empty($fifo_exit_destination) && $fifo_timeout_seconds == 0) {
+ $fifo_orbit_exten = $fifo_exit_destination;
+ }
+ else {
+ $fifo_orbit_exten = $fifo_exit_destination.":".$fifo_timeout_seconds;
+ }
+
//build the xml dialplan
$dialplan_xml = "\n";
$dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ if ($fifo_strategy == 'longest_idle_agent') {
+ $dialplan_xml .= " \n";
+ }
+ if ($fifo_strategy == 'simultaneous') {
+ $dialplan_xml .= " \n";
+ }
+ /*
+
+
+
+
+
+ */
+ if (!empty($fifo_exit_key)) {
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+
+ }
+ if (!empty($fifo_orbit_exten)) {
+ $dialplan_xml .= " \n";
+ }
$dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
$dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
$dialplan_xml .= " \n";
$dialplan_xml .= " \n";
$dialplan_xml .= " \n";
$dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
$dialplan_xml .= " \n";
- $dialplan_xml .= " \n";
+ $dialplan_xml .= " \n";
$dialplan_xml .= " \n";
$dialplan_xml .= " \n";
@@ -247,7 +342,6 @@
$p->add("dialplan_edit", "temp");
//save the data
- $database = new database;
$database->app_name = 'fifo';
$database->app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7';
$result = $database->save($array);
@@ -296,6 +390,10 @@
$sql .= " fifo_extension, ";
$sql .= " fifo_agent_status, ";
$sql .= " fifo_agent_queue, ";
+ $sql .= " fifo_strategy, ";
+ $sql .= " fifo_timeout_seconds, ";
+ $sql .= " fifo_exit_key, ";
+ $sql .= " fifo_exit_action, ";
$sql .= " fifo_music, ";
$sql .= " domain_uuid, ";
$sql .= " fifo_order, ";
@@ -306,7 +404,6 @@
//$sql .= "and domain_uuid = :domain_uuid ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['fifo_uuid'] = $fifo_uuid;
- $database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$dialplan_uuid = $row["dialplan_uuid"];
@@ -314,6 +411,10 @@
$fifo_extension = $row["fifo_extension"];
$fifo_agent_status = $row["fifo_agent_status"];
$fifo_agent_queue = $row["fifo_agent_queue"];
+ $fifo_strategy = $row["fifo_strategy"];
+ $fifo_timeout_seconds = $row["fifo_timeout_seconds"];
+ $fifo_exit_key = $row["fifo_exit_key"];
+ $fifo_exit_action = $row["fifo_exit_action"];
$fifo_music = $row["fifo_music"];
$domain_uuid = $row["domain_uuid"];
$fifo_order = $row["fifo_order"];
@@ -339,7 +440,6 @@
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['fifo_uuid'] = $fifo_uuid;
- $database = new database;
$fifo_members = $database->select($sql, $parameters, 'all');
unset ($sql, $parameters);
}
@@ -358,16 +458,28 @@
$fifo_member_uuid = uuid();
}
-//add an empty row
- $x = isset($fifo_members) && is_array($fifo_members) ? sizeof($fifo_members) : 0;
- $fifo_members[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
- $fifo_members[$x]['fifo_uuid'] = $fifo_uuid;
- $fifo_members[$x]['fifo_member_uuid'] = uuid();
- $fifo_members[$x]['member_contact'] = '';
- $fifo_members[$x]['member_call_timeout'] = '';
- //$fifo_members[$x]['member_simultaneous'] = '';
- $fifo_members[$x]['member_wrap_up_time'] = '';
- $fifo_members[$x]['member_enabled'] = '';
+//add an empty row to the members array
+ if (count($fifo_members) == 0) {
+ $rows = $settings->get('fifo', 'option_add_rows', '5');
+ $id = 0;
+ $show_option_delete = false;
+ }
+ if (count($fifo_members) > 0) {
+ $rows = $settings->get('fifo', 'option_edit_rows', '1');
+ $id = count($fifo_members)+1;
+ $show_option_delete = true;
+ }
+ for ($x = 0; $x < $rows; $x++) {
+ $fifo_members[$id]['domain_uuid'] = $_SESSION['domain_uuid'];
+ $fifo_members[$id]['fifo_uuid'] = $fifo_uuid;
+ $fifo_members[$id]['fifo_member_uuid'] = uuid();
+ $fifo_members[$id]['member_contact'] = '';
+ $fifo_members[$id]['member_call_timeout'] = '';
+ //$fifo_members[$id]['member_simultaneous'] = '';
+ $fifo_members[$id]['member_wrap_up_time'] = '';
+ $fifo_members[$id]['member_enabled'] = '';
+ $id++;
+ }
//create token
$object = new token;
@@ -377,11 +489,14 @@
$destination = new destinations;
//set the defaults
+ if (empty($fifo_timeout_seconds)) {
+ $fifo_timeout_seconds = 0;
+ }
if (empty($fifo_order)) {
$fifo_order = 50;
}
- if (!isset($fifo_enabled)) {
- // $fifo_enabled = true;
+ if (empty($fifo_enabled)) {
+ $fifo_enabled = true;
}
//show the header
@@ -396,14 +511,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";
@@ -425,7 +537,7 @@
echo "\n";
echo "\n";
- echo "\n";
+ echo " \n";
echo " ".$text['label-fifo_name']."\n";
echo " \n";
echo "\n";
@@ -468,6 +580,20 @@
echo " \n";
echo " \n";
+ echo "\n";
+ echo "\n";
+ echo " ".$text['label-strategy']."\n";
+ echo " \n";
+ echo "\n";
+ echo " \n";
+ echo " ".$text['option-longest_idle_agent']." \n";
+ echo " ".$text['option-simultaneous']." \n";
+ echo " \n";
+ echo " \n";
+ echo $text['description-strategy']."\n";
+ echo " \n";
+ echo " \n";
+
echo "\n";
echo "\n";
echo " ".$text['label-fifo_members']."\n";
@@ -480,9 +606,9 @@
//echo " ".$text['label-member_simultaneous']." \n";
echo " ".$text['label-member_wrap_up_time']." \n";
echo " ".$text['label-member_enabled']." \n";
- if (is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) {
+ if ($show_option_delete && 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 +623,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";
@@ -526,7 +652,7 @@
echo " \n";
}
echo " \n";
- if (is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) {
+ if ($show_option_delete && is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) {
if (is_uuid($row['fifo_member_uuid'])) {
echo " \n";
echo " \n";
@@ -546,16 +672,47 @@
echo " \n";
echo " \n";
+ echo "\n";
+ echo "\n";
+ echo " ".$text['label-fifo_timeout_seconds']."\n";
+ echo " \n";
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo $text['description-fifo_timeout_seconds']."\n";
+ echo " \n";
+ echo " \n";
+
+ echo "\n";
+ echo "\n";
+ echo " ".$text['label-fifo_exit_key']."\n";
+ echo " \n";
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo $text['description-fifo_exit_key']."\n";
+ echo " \n";
+ echo " \n";
+
+ echo "\n";
+ echo "\n";
+ echo " ".$text['label-fifo_exit_action']."\n";
+ echo " \n";
+ echo "\n";
+ $destination = new destinations;
+ echo $destination->select('dialplan', 'fifo_exit_action', $fifo_exit_action);
+ echo " \n";
+ echo $text['description-fifo_exit_action']."\n";
+ echo " \n";
+ echo " \n";
+
echo "\n";
echo "\n";
echo " ".$text['label-fifo_music']."\n";
echo " \n";
echo "\n";
- //echo " \n";
-
$ringbacks = new ringbacks;
echo $ringbacks->select('fifo_music', $fifo_music ?? null);
-
echo " \n";
echo $text['description-fifo_music']."\n";
echo " \n";
diff --git a/app/fifo/resources/classes/fifo.php b/app/fifo/resources/classes/fifo.php
index 4338f3f48e..450f5cd4c3 100644
--- a/app/fifo/resources/classes/fifo.php
+++ b/app/fifo/resources/classes/fifo.php
@@ -2,12 +2,7 @@
/**
* fifo class
- *
- * @method null delete
- * @method null toggle
- * @method null copy
*/
-if (!class_exists('fifo')) {
class fifo {
/**
@@ -283,6 +278,3 @@ if (!class_exists('fifo')) {
}
}
-}
-
-?>
\ No newline at end of file
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/gateways/gateways.php b/app/gateways/gateways.php
index cd6299c25f..1f0bd727c3 100644
--- a/app/gateways/gateways.php
+++ b/app/gateways/gateways.php
@@ -118,7 +118,7 @@
$show = !empty($_GET["show"]) ? $_GET["show"] : '';
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//get total gateway count from the database
$sql = "select count(*) from v_gateways where true ";
@@ -278,7 +278,7 @@
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order, null, "class='hide-sm-dn'");
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
- if (permission_exists('gateway_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('gateway_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -286,8 +286,12 @@
if (!empty($gateways)) {
$x = 0;
foreach($gateways as $row) {
+ $list_row_url = '';
if (permission_exists('gateway_edit')) {
$list_row_url = "gateway_edit.php?id=".urlencode($row['gateway_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('gateway_add') || permission_exists('gateway_edit') || permission_exists('gateway_delete')) {
@@ -367,9 +371,9 @@
}
echo " \n";
echo " ".escape($row["description"])." \n";
- if (permission_exists('gateway_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('gateway_edit') && $list_row_edit_button) {
echo " ";
- echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$list_row_edit_button,'link'=>$list_row_url]);
+ echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
}
echo " \n";
@@ -391,3 +395,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php
index cbfba52633..83ab122ad9 100644
--- a/app/gateways/resources/classes/gateways.php
+++ b/app/gateways/resources/classes/gateways.php
@@ -25,7 +25,6 @@
*/
//define the gateways class
-if (!class_exists('gateways')) {
class gateways {
/**
@@ -583,6 +582,3 @@ if (!class_exists('gateways')) {
}
}
-}
-
-?>
\ No newline at end of file
diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php
index 80f658a42f..b6fd64cf61 100644
--- a/app/ivr_menus/ivr_menu_edit.php
+++ b/app/ivr_menus/ivr_menu_edit.php
@@ -349,7 +349,7 @@
$dialplan_xml = "\n";
$dialplan_xml .= " \n";
$dialplan_xml .= " \n";
- if ($_SESSION['ivr_menu']['answer']['boolean'] == 'true') {
+ if (filter_var($_SESSION['ivr_menu']['answer']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
$dialplan_xml .= " \n";
}
$dialplan_xml .= " \n";
diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php
index e85eab669a..edb964215d 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 = '';
@@ -91,7 +94,7 @@
$show = $_GET["show"] ?? '';
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//prepare to page the results
$sql = "select count(*) from v_ivr_menus ";
@@ -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);
@@ -227,7 +228,7 @@
echo th_order_by('ivr_menu_extension', $text['label-extension'], $order_by, $order);
echo th_order_by('ivr_menu_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('ivr_menu_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
- if (permission_exists('ivr_menu_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('ivr_menu_edit') && $list_row_edit_button) {
echo " \n";
}
echo "\n";
@@ -235,8 +236,12 @@
if (!empty($ivr_menus)) {
$x = 0;
foreach($ivr_menus as $row) {
+ $list_row_url = '';
if (permission_exists('ivr_menu_edit')) {
$list_row_url = "ivr_menu_edit.php?id=".urlencode($row['ivr_menu_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('ivr_menu_add') || permission_exists('ivr_menu_edit') || permission_exists('ivr_menu_delete')) {
@@ -273,7 +278,7 @@
}
echo " \n";
echo " ".escape($row['ivr_menu_description'])." \n";
- if (permission_exists('ivr_menu_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('ivr_menu_edit') && $list_row_edit_button) {
echo " ";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -297,3 +302,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php
index 50a0fde239..2d91d84c15 100644
--- a/app/ivr_menus/resources/classes/ivr_menu.php
+++ b/app/ivr_menus/resources/classes/ivr_menu.php
@@ -25,7 +25,6 @@
*/
//define the ivr_menu class
-if (!class_exists('ivr_menu')) {
class ivr_menu {
/**
@@ -489,6 +488,3 @@ if (!class_exists('ivr_menu')) {
}
}
-}
-
-?>
diff --git a/app/ivr_menus/waveform.php b/app/ivr_menus/waveform.php
index 3408037311..8b760cd949 100644
--- a/app/ivr_menus/waveform.php
+++ b/app/ivr_menus/waveform.php
@@ -27,7 +27,6 @@
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
- require_once "resources/classes/waveform.php";
use maximal\audio\Waveform;
@@ -96,8 +95,8 @@
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
- Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom
- Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis
+ Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
+ Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
}
diff --git a/app/modules/module_edit.php b/app/modules/module_edit.php
index eb482483b9..296432c1f8 100644
--- a/app/modules/module_edit.php
+++ b/app/modules/module_edit.php
@@ -205,6 +205,7 @@
echo "
\n";
echo "\n";
+ echo "\n";
echo "
\n";
echo "\n";
@@ -297,6 +298,7 @@
echo " \n";
echo "
";
+ echo "
";
echo " ";
if ($action == "update") {
diff --git a/app/modules/modules.php b/app/modules/modules.php
index f2ec07b185..cdc8b56f06 100644
--- a/app/modules/modules.php
+++ b/app/modules/modules.php
@@ -60,7 +60,7 @@
}
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//process the http post data by action
if ($action != '' && is_array($modules) && @sizeof($modules) != 0) {
@@ -185,7 +185,7 @@
}
echo "".$text['label-enabled']." \n";
echo "".$text['label-description']." \n";
- if (permission_exists('module_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('module_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -202,8 +202,12 @@
echo "\n";
write_header($row["module_category"]);
}
+ $list_row_url = '';
if (permission_exists('module_edit')) {
$list_row_url = "module_edit.php?id=".urlencode($row['module_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('module_edit') || permission_exists('module_delete')) {
@@ -257,7 +261,7 @@
}
echo " \n";
echo " ".escape($row["module_description"])." \n";
- if (permission_exists('module_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('module_edit') && $list_row_edit_button) {
echo " ";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -283,3 +287,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php
index 28b83949e0..8559b657b4 100644
--- a/app/modules/resources/classes/modules.php
+++ b/app/modules/resources/classes/modules.php
@@ -25,7 +25,6 @@
*/
//define the modules class
-if (!class_exists('modules')) {
class modules {
/**
@@ -1101,10 +1100,8 @@ if (!class_exists('modules')) {
} //class
-}
/*
-require_once "resources/classes/modules.php";
$mod = new modules;
$mod->dir = $_SESSION['switch']['mod']['dir'];
echo $mod->dir."\n";
@@ -1138,5 +1135,3 @@ echo $mod->dir."\n";
//print_r($result);
//echo "\n";
*/
-
-?>
diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php
index 95c4443a81..ae92335afb 100644
--- a/app/music_on_hold/music_on_hold.php
+++ b/app/music_on_hold/music_on_hold.php
@@ -308,7 +308,6 @@
$cache = new cache;
$cache->delete("configuration:local_stream.conf");
- //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
$music = new switch_music_on_hold;
$music->reload();
diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php
index 71d628eca2..55d90e86b1 100644
--- a/app/music_on_hold/resources/classes/switch_music_on_hold.php
+++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php
@@ -27,7 +27,6 @@
*/
//define the switch_music_on_hold class
-if (!class_exists('switch_music_on_hold')) {
class switch_music_on_hold {
/**
@@ -85,7 +84,6 @@ if (!class_exists('switch_music_on_hold')) {
}
//recordings
if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) {
- require_once "app/recordings/resources/classes/switch_recordings.php";
$recordings_c = new switch_recordings;
$recordings = $recordings_c->list_recordings();
if (is_array($recordings) && sizeof($recordings) > 0) {
@@ -447,12 +445,9 @@ if (!class_exists('switch_music_on_hold')) {
} //method
} //class
-}
+
//build and save the XML
- //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
//$moh = new switch_music_on_hold;
//$moh->xml();
//$moh->save();
-
-?>
\ No newline at end of file
diff --git a/app/music_on_hold/waveform.php b/app/music_on_hold/waveform.php
index ee56d2e5ac..47fafbd10c 100644
--- a/app/music_on_hold/waveform.php
+++ b/app/music_on_hold/waveform.php
@@ -27,7 +27,6 @@
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
- require_once "resources/classes/waveform.php";
use maximal\audio\Waveform;
@@ -87,8 +86,8 @@
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
- Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom
- Waveform::$singleAxis = Waveform::$singlePhase === true ? false : (empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false); // combine channels into single axis
+ Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
+ Waveform::$singleAxis = Waveform::$singlePhase === true ? false : (filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'); // combine channels into single axis
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
}
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/number_translations/number_translations.php b/app/number_translations/number_translations.php
index bc02e4fef8..073c1b2c65 100644
--- a/app/number_translations/number_translations.php
+++ b/app/number_translations/number_translations.php
@@ -46,7 +46,7 @@
$search = $_GET["search"] ?? '';
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//get the http post data
if (!empty($_POST['number_translations'])) {
@@ -217,7 +217,7 @@
echo th_order_by('number_translation_name', $text['label-number_translation_name'], $order_by, $order);
echo th_order_by('number_translation_enabled', $text['label-number_translation_enabled'], $order_by, $order, null, "class='center'");
echo " ".$text['label-number_translation_description']." \n";
- if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('number_translation_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -225,8 +225,12 @@
if (!empty($number_translations)) {
$x = 0;
foreach ($number_translations as $row) {
+ $list_row_url = '';
if (permission_exists('number_translation_edit')) {
$list_row_url = "number_translation_edit.php?id=".urlencode($row['number_translation_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('number_translation_add') || permission_exists('number_translation_edit') || permission_exists('number_translation_delete')) {
@@ -254,7 +258,7 @@
}
echo " \n";
echo " ".escape($row['number_translation_description'])." \n";
- if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('number_translation_edit') && $list_row_edit_button) {
echo " \n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -276,3 +280,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php
index 22a2836401..c0abf97057 100644
--- a/app/number_translations/resources/classes/number_translations.php
+++ b/app/number_translations/resources/classes/number_translations.php
@@ -25,7 +25,6 @@
*/
//define the number translations class
-if (!class_exists('number_translations')) {
class number_translations {
/**
@@ -414,11 +413,8 @@ if (!class_exists('number_translations')) {
} //method
} //class
-}
/*
$obj = new number_translations;
$obj->delete();
*/
-
-?>
\ No newline at end of file
diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php
index e8b5bd16ab..df01fbf03f 100644
--- a/app/phrases/phrases.php
+++ b/app/phrases/phrases.php
@@ -203,7 +203,7 @@
echo th_order_by('phrase_language', $text['label-language'], $order_by, $order);
echo th_order_by('phrase_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('phrase_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn' style='min-width: 40%;'");
- if (permission_exists('phrase_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('phrase_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " \n";
}
echo " \n";
@@ -211,8 +211,12 @@
if (is_array($phrases) && @sizeof($phrases) != 0) {
$x = 0;
foreach($phrases as $row) {
+ $list_row_url = '';
if (permission_exists('phrase_edit')) {
$list_row_url = "phrase_edit.php?id=".urlencode($row['phrase_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('phrase_add') || permission_exists('phrase_edit') || permission_exists('phrase_delete')) {
@@ -249,7 +253,7 @@
}
echo " \n";
echo " ".escape($row['phrase_description'])." \n";
- if (permission_exists('phrase_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('phrase_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " ";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -273,3 +277,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php
index 61d1a974a8..408d11eaa6 100644
--- a/app/phrases/resources/classes/phrases.php
+++ b/app/phrases/resources/classes/phrases.php
@@ -25,7 +25,6 @@
*/
//define the phrases class
-if (!class_exists('phrases')) {
class phrases {
/**
@@ -76,7 +75,7 @@ if (!class_exists('phrases')) {
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
- header('Location: '.$this->list_page);
+ header('Location: '.$this->list_page);$is_uuid
exit;
}
@@ -496,3 +495,4 @@ if (!class_exists('phrases')) {
}
}
}
+
diff --git a/app/pin_numbers/pin_download.php b/app/pin_numbers/pin_download.php
index d16c4b11d3..a0bd83ce91 100644
--- a/app/pin_numbers/pin_download.php
+++ b/app/pin_numbers/pin_download.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-2019
+ Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -133,6 +133,7 @@
echo "
\n";
echo "\n";
+ echo "\n";
echo " \n";
echo " \n";
@@ -165,4 +167,4 @@
//include the footer
require_once "resources/footer.php";
-?>
\ No newline at end of file
+?>
diff --git a/app/pin_numbers/pin_number_edit.php b/app/pin_numbers/pin_number_edit.php
index d6a9455ca4..386b0c5dcc 100644
--- a/app/pin_numbers/pin_number_edit.php
+++ b/app/pin_numbers/pin_number_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) 2016-2023
+ Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -168,6 +168,7 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
echo "
\n";
echo "\n";
+ echo "\n";
echo "
\n";
echo "\n";
@@ -217,17 +218,18 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
echo "\n";
echo " \n";
- echo "
";
- echo "
";
+ echo "
\n";
+ echo "\n";
+ echo " \n";
if ($action == "update") {
echo " \n";
}
echo " \n";
- echo "";
+ echo "\n";
//include the footer
require_once "resources/footer.php";
-?>
\ No newline at end of file
+?>
diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php
index 1740c631a2..a2aaba0af9 100644
--- a/app/pin_numbers/pin_numbers.php
+++ b/app/pin_numbers/pin_numbers.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) 2016-2020
+ Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -170,6 +170,7 @@
echo " \n";
echo " \n";
+ echo "\n";
echo "
\n";
echo "\n";
@@ -189,8 +190,12 @@
if (is_array($pin_numbers) && @sizeof($pin_numbers) != 0) {
$x = 0;
foreach ($pin_numbers as $row) {
+ $list_row_url = '';
if (permission_exists('pin_number_edit')) {
$list_row_url = "pin_number_edit.php?id=".urlencode($row['pin_number_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('pin_number_add') || permission_exists('pin_number_edit') || permission_exists('pin_number_delete')) {
@@ -218,7 +223,7 @@
}
echo " \n";
echo " ".escape($row['description'])." \n";
- if (permission_exists('pin_number_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('pin_number_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " ";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -230,6 +235,7 @@
unset($pin_numbers);
echo "
\n";
+ echo "
\n";
echo " \n";
echo "".$paging_controls."
\n";
diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php
index c0be87493e..817f21caab 100644
--- a/app/pin_numbers/resources/classes/pin_numbers.php
+++ b/app/pin_numbers/resources/classes/pin_numbers.php
@@ -25,7 +25,6 @@
*/
//define the pin numbers class
-if (!class_exists('pin_numbers')) {
class pin_numbers {
/**
@@ -245,6 +244,3 @@ if (!class_exists('pin_numbers')) {
}
}
-}
-
-?>
\ No newline at end of file
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/recordings/recordings.php b/app/recordings/recordings.php
index b429120270..0a8f68b13b 100644
--- a/app/recordings/recordings.php
+++ b/app/recordings/recordings.php
@@ -529,8 +529,12 @@
echo " \n";
echo " \n"; // dummy row to maintain alternating background color
}
+ $list_row_url = '';
if (permission_exists('recording_edit')) {
$list_row_url = "recording_edit.php?id=".urlencode($row['recording_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('recording_delete')) {
@@ -710,3 +714,4 @@
}
?>
+
diff --git a/app/recordings/resources/classes/switch_recordings.php b/app/recordings/resources/classes/switch_recordings.php
index dc3988ef67..f50fa1e80e 100644
--- a/app/recordings/resources/classes/switch_recordings.php
+++ b/app/recordings/resources/classes/switch_recordings.php
@@ -26,7 +26,6 @@
*/
//define the switch_recordings class
-if (!class_exists('switch_recordings')) {
class switch_recordings {
/**
@@ -158,6 +157,3 @@ if (!class_exists('switch_recordings')) {
} //method
} //class
-}
-
-?>
diff --git a/app/recordings/waveform.php b/app/recordings/waveform.php
index 57b8fbef96..07a15a5555 100644
--- a/app/recordings/waveform.php
+++ b/app/recordings/waveform.php
@@ -27,7 +27,6 @@
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
- require_once "resources/classes/waveform.php";
use maximal\audio\Waveform;
@@ -94,8 +93,8 @@
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
- Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom
- Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis
+ Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
+ Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
}
diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php
index 9c9fafef6e..18720eb38d 100644
--- a/app/registrations/registrations.php
+++ b/app/registrations/registrations.php
@@ -88,7 +88,6 @@
$registrations = $obj->get($profile ?? null);
//order the array
- require_once "resources/classes/array_order.php";
$order = new array_order();
$registrations = $order->sort($registrations, 'sip-auth-realm', 'user');
@@ -234,13 +233,13 @@
echo " ".escape($row['ping-time'])." \n";
echo " ".escape($row['sip_profile_name'])." \n";
echo " \n";
- if (!empty($_SESSION['registrations']['list_row_button_unregister']['boolean']) && $_SESSION['registrations']['list_row_button_unregister']['boolean'] == 'true') {
+ if (filter_var($_SESSION['registrations']['list_row_button_unregister']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo button::create(['type'=>'submit','title'=>$text['button-unregister'],'icon'=>'user-slash fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('unregister'); list_form_submit('form_list')"]);
}
- if (!empty($_SESSION['registrations']['list_row_button_provision']['boolean']) && $_SESSION['registrations']['list_row_button_provision']['boolean'] == 'true') {
+ if (filter_var($_SESSION['registrations']['list_row_button_provision']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo button::create(['type'=>'submit','title'=>$text['button-provision'],'icon'=>'fax fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('provision'); list_form_submit('form_list')"]);
}
- if (!empty($_SESSION['registrations']['list_row_button_reboot']['boolean']) && $_SESSION['registrations']['list_row_button_reboot']['boolean'] == 'true') {
+ if (filter_var($_SESSION['registrations']['list_row_button_reboot']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo button::create(['type'=>'submit','title'=>$text['button-reboot'],'icon'=>'power-off fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('reboot'); list_form_submit('form_list')"]);
}
echo " \n";
diff --git a/app/registrations/resources/classes/registrations.php b/app/registrations/resources/classes/registrations.php
index 9ae9d71c7b..8a66543289 100644
--- a/app/registrations/resources/classes/registrations.php
+++ b/app/registrations/resources/classes/registrations.php
@@ -24,8 +24,6 @@
Mark J Crane
*/
-//define the registrations class
-if (!class_exists('registrations')) {
class registrations {
/**
@@ -44,6 +42,12 @@ if (!class_exists('registrations')) {
*/
private $database;
+ /**
+ * Set in the constructor. Must be an event_socket object and cannot be null.
+ * @var event_socket Event Socket Connection Object
+ */
+ private $event_socket;
+
/**
* called when the object is created
*/
@@ -59,8 +63,21 @@ if (!class_exists('registrations')) {
//trap passing a PDO object instead of the required database object
if (!($this->database instanceof database)) {
- //should never happen but will trap it here just-in-case
- throw new \InvalidArgumentException("Database object passed in settings class constructor is not a valid database object");
+ //should never happen but will trap it here just in case
+ throw new \InvalidArgumentException("Database object passed in the constructor is not a valid database object");
+ }
+
+ if (!empty($setting_array['event_socket'])) {
+ $this->event_socket = $setting_array['event_socket'];
+ }
+ else {
+ $this->event_socket = event_socket::create();
+ }
+
+ //trap passing an invalid connection object for communicating to the switch
+ if (!($this->event_socket instanceof event_socket)) {
+ //should never happen but will trap it here just in case
+ throw new \InvalidArgumentException('Event socket object passed in the constructor is not a valid event_socket object');
}
//assign private variables
@@ -89,7 +106,21 @@ if (!class_exists('registrations')) {
$id = 0;
//create the event socket connection
- $esl = event_socket::create();
+ $event_socket = $this->event_socket;
+
+ //make sure the event socket is connected
+ if (!$event_socket->is_connected()) {
+ //connect to event socket
+ $event_socket->connect();
+
+ //check again and throw an error if it can't connect
+ if (!$event_socket->is_connected()) {
+ message::add($text['error-event-socket'], 'negative', 5000);
+ return null;
+ }
+ }
+
+
//get the default settings
$sql = "select sip_profile_name from v_sip_profiles ";
@@ -100,12 +131,18 @@ if (!class_exists('registrations')) {
}
$sql .= "and sip_profile_enabled = 'true' ";
$sip_profiles = $this->database->select($sql, $parameters ?? null, 'all');
- if (!empty($sip_profiles) && @sizeof($sip_profiles) != 0) {
- foreach ($sip_profiles as $field) {
+
+ if (!empty($sip_profiles)) {
+
+ //use a while loop to ensure the event socket stays connected while communicating
+ $count = count($sip_profiles);
+ $i = 0;
+ while ($event_socket->is_connected() && $i < $count) {
+ $field = $sip_profiles[$i++];
//get sofia status profile information including registrations
$cmd = "api sofia xmlstatus profile '".$field['sip_profile_name']."' reg";
- $xml_response = trim(event_socket::command($cmd));
+ $xml_response = trim($event_socket->request($cmd));
//show an error message
if ($xml_response == "Invalid Profile!") {
@@ -117,7 +154,7 @@ if (!class_exists('registrations')) {
$xml_response = "".escape($text['label-message'])." ";
}
- //santize the XML
+ //sanitize the XML
if (function_exists('iconv')) { $xml_response = iconv("utf-8", "utf-8//IGNORE", $xml_response); }
$xml_response = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u', '', $xml_response);
$xml_response = str_replace("", "", $xml_response);
@@ -301,10 +338,10 @@ if (!class_exists('registrations')) {
unset($sql);
//create the event socket connection
- $esl = event_socket::create();
+ $event_socket = $this->event_socket;
//loop through registrations
- if ($esl->is_connected()) {
+ if ($event_socket->is_connected()) {
//check if registrations exist
if (is_array($registrations)) {
foreach ($registrations as $registration) {
@@ -364,11 +401,10 @@ if (!class_exists('registrations')) {
}
//send the api command
- if (!empty($command) && $esl->is_connected()) {
- $response_api[$registration['user']]['command'] = event_socket::api($command);
- $response_api[$registration['user']]['log'] = event_socket::api("log notice $command");
+ if (!empty($command) && $event_socket->is_connected()) {
+ $response_api[$registration['user']]['command'] = $event_socket->request('api ' . $command);
+ $response_api[$registration['user']]['log'] = $event_socket->request("log notice $command");
}
-
}
}
@@ -394,6 +430,3 @@ if (!class_exists('registrations')) {
} //method
} //class
-}
-
-?>
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/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php
index ceab17b711..5a9786e256 100644
--- a/app/ring_groups/resources/classes/ring_groups.php
+++ b/app/ring_groups/resources/classes/ring_groups.php
@@ -25,7 +25,6 @@
*/
//define the ring groups class
-if (!class_exists('ring_groups')) {
class ring_groups {
/**
@@ -512,6 +511,3 @@ if (!class_exists('ring_groups')) {
}
}
-}
-
-?>
diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php
index 59473180d1..d46f228159 100644
--- a/app/ring_groups/ring_groups.php
+++ b/app/ring_groups/ring_groups.php
@@ -249,7 +249,7 @@
echo th_order_by('ring_group_forward_enabled', $text['label-forwarding'], $order_by, $order);
echo th_order_by('ring_group_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('ring_group_description', $text['header-description'], $order_by, $order, null, "class='hide-sm-dn'");
- if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('ring_group_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " \n";
}
echo " \n";
@@ -257,8 +257,12 @@
if (is_array($ring_groups) && @sizeof($ring_groups) != 0) {
$x = 0;
foreach ($ring_groups as $row) {
+ $list_row_url = '';
if (permission_exists('ring_group_edit')) {
$list_row_url = "ring_group_edit.php?id=".urlencode($row['ring_group_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_delete')) {
@@ -291,7 +295,7 @@
}
echo " \n";
echo " ".escape($row['ring_group_description'])." \n";
- if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('ring_group_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " ";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -315,3 +319,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/ring_groups/waveform.php b/app/ring_groups/waveform.php
index 3408037311..8b760cd949 100644
--- a/app/ring_groups/waveform.php
+++ b/app/ring_groups/waveform.php
@@ -27,7 +27,6 @@
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
- require_once "resources/classes/waveform.php";
use maximal\audio\Waveform;
@@ -96,8 +95,8 @@
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
- Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom
- Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis
+ Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
+ Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
}
diff --git a/app/sip_profiles/resources/classes/sip_profiles.php b/app/sip_profiles/resources/classes/sip_profiles.php
index 5d90bb5de8..2ab414a2c3 100644
--- a/app/sip_profiles/resources/classes/sip_profiles.php
+++ b/app/sip_profiles/resources/classes/sip_profiles.php
@@ -25,7 +25,6 @@
*/
//define the sip profiles class
-if (!class_exists('sip_profiles')) {
class sip_profiles {
/**
@@ -434,6 +433,3 @@ if (!class_exists('sip_profiles')) {
}
}
-}
-
-?>
\ No newline at end of file
diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php
index a18b92c5e5..565f227eae 100644
--- a/app/sip_profiles/sip_profiles.php
+++ b/app/sip_profiles/sip_profiles.php
@@ -76,7 +76,7 @@
}
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//get order and order by
if (isset($_GET["order_by"])) {
@@ -180,7 +180,7 @@
echo th_order_by('sip_profile_hostname', $text['label-sip_profile_hostname'], $order_by, $order);
echo th_order_by('sip_profile_enabled', $text['label-sip_profile_enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('sip_profile_description', $text['label-sip_profile_description'], $order_by, $order, null, "class='hide-sm-dn pct-70'");
- if (permission_exists('sip_profile_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('sip_profile_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -188,8 +188,12 @@
if (!empty($sip_profiles) && @sizeof($sip_profiles) != 0) {
$x = 0;
foreach ($sip_profiles as $row) {
+ $list_row_url = '';
if (permission_exists('sip_profile_edit')) {
$list_row_url = "sip_profile_edit.php?id=".urlencode($row['sip_profile_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('sip_profile_add') || permission_exists('sip_profile_edit') || permission_exists('sip_profile_delete')) {
@@ -217,7 +221,7 @@
}
echo " \n";
echo " ".escape($row['sip_profile_description'])." \n";
- if (permission_exists('sip_profile_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('sip_profile_edit') && $list_row_edit_button) {
echo " \n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -239,3 +243,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/sofia_global_settings/app_defaults.php b/app/sofia_global_settings/app_defaults.php
index 00b44a05b8..0d3e03c55a 100644
--- a/app/sofia_global_settings/app_defaults.php
+++ b/app/sofia_global_settings/app_defaults.php
@@ -4,53 +4,53 @@ if ($domains_processed == 1) {
//get all of the sofia global default settings
$sql = "select * from v_sofia_global_settings \n";
- $sofia_global_settings = $database->select($sql, null, 'all');
+ $database_settings = $database->select($sql, null, 'all');
//build array
$x = 0;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = '9a0e83b3-e71c-4a9a-9f1c-680d32f756f8';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'log-level';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = '0';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = '9a0e83b3-e71c-4a9a-9f1c-680d32f756f8';
+ $global_settings[$x]['global_setting_name'] = 'log-level';
+ $global_settings[$x]['global_setting_value'] = '0';
+ $global_settings[$x]['global_setting_enabled'] = 'true';
+ $global_settings[$x]['global_setting_description'] = '';
$x++;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'c2aa551a-b6d2-49a6-b633-21b5b1ddd5df';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'auto-restart';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = 'c2aa551a-b6d2-49a6-b633-21b5b1ddd5df';
+ $global_settings[$x]['global_setting_name'] = 'auto-restart';
+ $global_settings[$x]['global_setting_value'] = 'true';
+ $global_settings[$x]['global_setting_enabled'] = 'true';
+ $global_settings[$x]['global_setting_description'] = '';
$x++;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'a9901c0c-efd8-4e66-9648-239566af576e';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'debug-presence';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = '0';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = 'a9901c0c-efd8-4e66-9648-239566af576e';
+ $global_settings[$x]['global_setting_name'] = 'debug-presence';
+ $global_settings[$x]['global_setting_value'] = '0';
+ $global_settings[$x]['global_setting_enabled'] = 'true';
+ $global_settings[$x]['global_setting_description'] = '';
$x++;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = '31054912-3b07-422d-a109-b995fd8d67f7';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'capture-server';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = 'udp:127.0.0.1:9060';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'false';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = '31054912-3b07-422d-a109-b995fd8d67f7';
+ $global_settings[$x]['global_setting_name'] = 'capture-server';
+ $global_settings[$x]['global_setting_value'] = 'udp:127.0.0.1:9060';
+ $global_settings[$x]['global_setting_enabled'] = 'false';
+ $global_settings[$x]['global_setting_description'] = '';
$x++;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'b27af7db-4ba5-452b-a5ed-a922c8f201aa';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'inbound-reg-in-new-thread';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = 'b27af7db-4ba5-452b-a5ed-a922c8f201aa';
+ $global_settings[$x]['global_setting_name'] = 'inbound-reg-in-new-thread';
+ $global_settings[$x]['global_setting_value'] = 'true';
+ $global_settings[$x]['global_setting_enabled'] = 'true';
+ $global_settings[$x]['global_setting_description'] = '';
$x++;
- $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'cd33b89f-55ef-4b47-833a-538dba70e27e';
- $settings['sofia_global_settings'][$x]['global_setting_name'] = 'max-reg-threads';
- $settings['sofia_global_settings'][$x]['global_setting_value'] = '8';
- $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true';
- $settings['sofia_global_settings'][$x]['global_setting_description'] = '';
+ $global_settings[$x]['sofia_global_setting_uuid'] = 'cd33b89f-55ef-4b47-833a-538dba70e27e';
+ $global_settings[$x]['global_setting_name'] = 'max-reg-threads';
+ $global_settings[$x]['global_setting_value'] = '8';
+ $global_settings[$x]['global_setting_enabled'] = 'true';
+ $global_settings[$x]['global_setting_description'] = '';
//build an array of missing global settings
$x = 0;
- foreach($settings['sofia_global_settings'] as $row) {
+ foreach($global_settings as $row) {
$y = 0;
$setting_found = false;
- if (is_array($sofia_global_settings) && @sizeof($sofia_global_settings) != 0) {
- foreach($sofia_global_settings as $field) {
+ if (is_array($database_settings) && @sizeof($database_settings) != 0) {
+ foreach($database_settings as $field) {
if ($row['sofia_global_setting_uuid'] == $field['sofia_global_setting_uuid']) {
$setting_found = true;
break;
diff --git a/app/sofia_global_settings/resources/classes/sofia_global_settings.php b/app/sofia_global_settings/resources/classes/sofia_global_settings.php
index 289efda183..f9a1c838b3 100644
--- a/app/sofia_global_settings/resources/classes/sofia_global_settings.php
+++ b/app/sofia_global_settings/resources/classes/sofia_global_settings.php
@@ -26,12 +26,7 @@
/**
* sofia_global_settings class
- *
- * @method null delete
- * @method null toggle
- * @method null copy
*/
-if (!class_exists('sofia_global_settings')) {
class sofia_global_settings {
/**
@@ -247,6 +242,3 @@ if (!class_exists('sofia_global_settings')) {
}
}
-}
-
-?>
\ No newline at end of file
diff --git a/app/sofia_global_settings/sofia_global_settings.php b/app/sofia_global_settings/sofia_global_settings.php
index deb31716d5..537b15be04 100644
--- a/app/sofia_global_settings/sofia_global_settings.php
+++ b/app/sofia_global_settings/sofia_global_settings.php
@@ -44,7 +44,7 @@
$search = '';
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//get the http post data
if (!empty($_POST['sofia_global_settings'])) {
@@ -201,7 +201,7 @@
echo th_order_by('global_setting_value', $text['label-global_setting_value'], $order_by, $order);
echo th_order_by('global_setting_enabled', $text['label-global_setting_enabled'], $order_by, $order, null, "class='center'");
echo " ".$text['label-global_setting_description']." \n";
- if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -209,8 +209,12 @@
if (!empty($sofia_global_settings) && @sizeof($sofia_global_settings) != 0) {
$x = 0;
foreach ($sofia_global_settings as $row) {
+ $list_row_url = '';
if (permission_exists('sofia_global_setting_edit')) {
$list_row_url = "sofia_global_setting_edit.php?id=".urlencode($row['sofia_global_setting_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('sofia_global_setting_add') || permission_exists('sofia_global_setting_edit') || permission_exists('sofia_global_setting_delete')) {
@@ -239,7 +243,7 @@
}
echo " \n";
echo " ".escape($row['global_setting_description'])." \n";
- if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button) {
echo " \n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -261,3 +265,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/streams/resources/classes/streams.php b/app/streams/resources/classes/streams.php
index 05340cdfee..2256892d8f 100644
--- a/app/streams/resources/classes/streams.php
+++ b/app/streams/resources/classes/streams.php
@@ -25,7 +25,6 @@
*/
//define the streams class
-if (!class_exists('streams')) {
class streams {
/**
@@ -244,6 +243,3 @@ if (!class_exists('streams')) {
}
}
-}
-
-?>
\ No newline at end of file
diff --git a/app/streams/streams.php b/app/streams/streams.php
index 5b872b764a..af41905082 100644
--- a/app/streams/streams.php
+++ b/app/streams/streams.php
@@ -240,7 +240,7 @@
echo " ".$text['label-play']." \n";
echo th_order_by('stream_enabled', $text['label-stream_enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('stream_description', $text['label-stream_description'], $order_by, $order, null, "class='hide-sm-dn'");
- if (permission_exists('stream_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('stream_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " \n";
}
echo " \n";
@@ -248,8 +248,12 @@
if (!empty($streams)) {
$x = 0;
foreach ($streams as $row) {
+ $list_row_url = '';
if (permission_exists('stream_edit')) {
$list_row_url = "stream_edit.php?id=".urlencode($row['stream_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('stream_add') || permission_exists('stream_edit') || permission_exists('stream_delete')) {
@@ -293,7 +297,7 @@
}
echo " \n";
echo " ".escape($row['stream_description'])." \n";
- if (permission_exists('stream_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('stream_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " \n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -315,3 +319,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/switch/resources/classes/presence.php b/app/switch/resources/classes/presence.php
index b455c24a6d..c645f8eac4 100644
--- a/app/switch/resources/classes/presence.php
+++ b/app/switch/resources/classes/presence.php
@@ -23,12 +23,7 @@
/**
* presence class
- *
- * @method boolean active
- * @method array show
*/
-
-if (!class_exists('presence')) {
class presence {
/**
@@ -84,7 +79,6 @@ if (!class_exists('presence')) {
return $array;
}
}
-}
//examples
/*
@@ -97,11 +91,9 @@ if (!class_exists('presence')) {
echo "active: true\n";
}
else {
- echo "active: false\n";
+ echo "active: false\n";
}
//show active the presence
$presence = new presence;
$array = $presence->show();
*/
-
-?>
diff --git a/app/switch/resources/classes/ringbacks.php b/app/switch/resources/classes/ringbacks.php
index db05aeb98a..d206eac70b 100644
--- a/app/switch/resources/classes/ringbacks.php
+++ b/app/switch/resources/classes/ringbacks.php
@@ -25,7 +25,6 @@
Matthew Vale
*/
-if (!class_exists('ringbacks')) {
class ringbacks {
//define variables
@@ -85,18 +84,15 @@ if (!class_exists('ringbacks')) {
*/
//get the tones
- require_once "resources/classes/tones.php";
$tones = new tones;
$this->tones_list = $tones->tones_list();
//get music on hold and recordings
if (is_dir($_SERVER["PROJECT_ROOT"].'/app/music_on_hold')) {
- require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
$music = new switch_music_on_hold;
$this->music_list = $music->get();
}
if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) {
- require_once "app/recordings/resources/classes/switch_recordings.php";
$recordings = new switch_recordings;
$this->recordings_list = $recordings->list_recordings();
}
@@ -232,6 +228,3 @@ if (!class_exists('ringbacks')) {
return $select;
}
}
-}
-
-?>
diff --git a/app/switch/resources/classes/switch_files.php b/app/switch/resources/classes/switch_files.php
index 80b1b24436..c98091a624 100644
--- a/app/switch/resources/classes/switch_files.php
+++ b/app/switch/resources/classes/switch_files.php
@@ -26,12 +26,7 @@
/**
* switch class provides methods for copying switch_files
- *
- * @method string correct_path
- * @method string copy_scripts
- * @method string copy_languages
*/
-if (!class_exists('switch_files')) {
class switch_files {
/**
@@ -158,7 +153,6 @@ if (!class_exists('switch_files')) {
}
}
-}
/*
//example use
@@ -168,5 +162,3 @@ if (!class_exists('switch_files')) {
$obj->copy_scripts();
$obj->copy_languages();
*/
-
-?>
diff --git a/app/switch/resources/conf/autoload_configs/abstraction.conf.xml b/app/switch/resources/conf/autoload_configs/abstraction.conf.xml
index d4b1dfd274..b527ac233d 100644
--- a/app/switch/resources/conf/autoload_configs/abstraction.conf.xml
+++ b/app/switch/resources/conf/autoload_configs/abstraction.conf.xml
@@ -1,5 +1,5 @@
-
+
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 250cb96e1d..00ba8ac144 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/en/vm/voicemail.xml b/app/switch/resources/conf/languages/en/vm/voicemail.xml
index 0daec58637..3218186ccc 100644
--- a/app/switch/resources/conf/languages/en/vm/voicemail.xml
+++ b/app/switch/resources/conf/languages/en/vm/voicemail.xml
@@ -65,6 +65,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -96,6 +121,17 @@
+
+
+
+
+
+
+
+
+
+
+
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/conf/sip_profiles/internal-ipv6.xml.noload b/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload
index 2c376ce0d0..f7bf02d931 100644
--- a/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload
+++ b/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload
@@ -11,6 +11,8 @@
+
+
diff --git a/app/switch/resources/conf/sip_profiles/internal.xml.noload b/app/switch/resources/conf/sip_profiles/internal.xml.noload
index 872de9f47c..951af3f741 100644
--- a/app/switch/resources/conf/sip_profiles/internal.xml.noload
+++ b/app/switch/resources/conf/sip_profiles/internal.xml.noload
@@ -83,6 +83,8 @@
+
+
diff --git a/app/switch/resources/scripts/app/emergency/index.lua b/app/switch/resources/scripts/app/emergency/index.lua
index f3dc40fde8..53c945a435 100644
--- a/app/switch/resources/scripts/app/emergency/index.lua
+++ b/app/switch/resources/scripts/app/emergency/index.lua
@@ -56,6 +56,9 @@ delete = argv[1];
--prepare the api object
api = freeswitch.API();
+--prepare the email to address
+to = {}
+
--get sessions info
if (session and session:ready()) then
domain_uuid = session:getVariable("domain_uuid");
@@ -71,21 +74,6 @@ else
headers = {}
end
-function escape_csv(s)
- if string.find(s, '[,"]') then
- s = '"' .. string.gsub(s, '"', '""') .. '"'
- end
- return s
-end
-
-function to_csv(tt)
- local s = ""
- for _,p in ipairs(tt) do
- s = s .. "," .. escape_csv(p)
- end
- return string.sub(s, 2)
-end
-
--connect to the database
local dbh = Database.new('system');
@@ -94,7 +82,7 @@ local sql = "SELECT * FROM v_email_templates ";
sql = sql .. "WHERE template_category = :category ";
sql = sql .. "AND template_subcategory = :subcategory ";
sql = sql .. "AND template_enabled = :status ";
- local params = {category = 'plugins', subcategory = 'emergency', status = 'true'}
+ local params = {category = 'plugin', subcategory = 'emergency', status = 'true'}
dbh:query(sql, params, function(row)
subject = row.template_subject;
body = row.template_body;
@@ -130,71 +118,61 @@ if (session and session:ready()) then
sip_from_user = session:getVariable("sip_from_user");
emergency_caller_id_name = session:getVariable("emergency_caller_id_name");
emergency_caller_id_number = session:getVariable("emergency_caller_id_number");
- call_duration = session:getVariable("call_duration");
+ outbound_caller_id_name = session:getVariable("outbound_caller_id_name");
+ outbound_caller_id_number = session:getVariable("outbound_caller_id_number");
destination_number = session:getVariable("destination_number");
end
---domain level check
-result = {}
-local sql = "SELECT count(domain_setting_value) ";
-sql = sql .. "AS total ";
-sql = sql .. "FROM v_domain_settings ";
-sql = sql .. "WHERE domain_uuid = :domain_uuid ";
-sql = sql .. "AND domain_setting_category = :category ";
-sql = sql .. "AND domain_setting_subcategory = :email_address ";
-sql = sql .. "AND domain_setting_enabled = :status ";
-
-local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'}
+--set the defaults
+if (not emergency_caller_id_name or emergency_caller_id_name == '') then
+ emergency_caller_id_name = outbound_caller_id_name
+end
+if (not emergency_caller_id_number or emergency_caller_id_number == '') then
+ emergency_caller_id_number = outbound_caller_id_number
+end
+--no emergency emails found under domain, using default
+local sql = "SELECT default_setting_value ";
+ sql = sql .. "FROM v_default_settings ";
+ sql = sql .. "WHERE default_setting_category = :category ";
+ sql = sql .. "AND default_setting_subcategory = :email_address ";
+ sql = sql .. "AND default_setting_enabled = :status ";
+ sql = sql .. "LIMIT 5 ";
+local params = {category = 'emergency', email_address = 'email_address', status = 't'}
dbh:query(sql, params, function(result)
- total = result.total;
- --no emergency emails found under domain, using default
- if (total == 0 or total == nil) then
- to = {}
- local sql = "SELECT default_setting_value ";
- sql = sql .. "FROM v_default_settings ";
- sql = sql .. "WHERE default_setting_category = :category ";
- sql = sql .. "AND default_setting_subcategory = :email_address ";
- sql = sql .. "AND default_setting_enabled = :status ";
- sql = sql .. "LIMIT 5 ";
- local params = {category = 'emergency', email_address = 'email_address', status = 't'}
- dbh:query(sql, params, function(result)
- for key,row in pairs(result) do
- table.insert(to, row);
- freeswitch.consoleLog("info", "[emergency] Inserted into table from default settings " .. row .. "\n");
- end
- --add some details
- if (debug["sql"]) then
- freeswitch.consoleLog("notice", "[emergency] SQL: " .. sql .. " result " .. result .. "\n");
- end
- end);
- --domain level emails max 5
- else if (tonumber(total) <= 5) then
- to = {}
- local sql = "SELECT domain_setting_value ";
- sql = sql .. "FROM v_domain_settings ";
- sql = sql .. "WHERE domain_uuid = :domain_uuid ";
- sql = sql .. "AND domain_setting_category = :category ";
- sql = sql .. "AND domain_setting_subcategory = :email_address ";
- sql = sql .. "AND domain_setting_enabled = :status ";
- local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'}
- dbh:query(sql, params, function(result)
- for key,row in pairs(result) do
- table.insert(to, row);
- freeswitch.consoleLog("info", "[template] Inserted into table " .. row .. "\n");
- end
- end);
- end
+ for key,row in pairs(result) do
+ table.insert(to, row);
+ freeswitch.consoleLog("info", "[emergency] Inserted into table from default settings " .. row .. "\n");
end
+ --add some details
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[emergency] SQL: " .. sql .. " result " .. result .. "\n");
+ end
+end);
+--domain level emails max 5
+local sql = "SELECT domain_setting_value ";
+ sql = sql .. "FROM v_domain_settings ";
+ sql = sql .. "WHERE domain_uuid = :domain_uuid ";
+ sql = sql .. "AND domain_setting_category = :category ";
+ sql = sql .. "AND domain_setting_subcategory = :email_address ";
+ sql = sql .. "AND domain_setting_enabled = :status ";
+ sql = sql .. "LIMIT 5 ";
+local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'}
+dbh:query(sql, params, function(result)
+ for key,row in pairs(result) do
+ table.insert(to, row);
+ freeswitch.consoleLog("info", "[template] Inserted into table " .. row .. "\n");
+ end
end);
--set event
if (tonumber(destination_number) == 933) then
event = '933 Emergency Address Validation Service';
-else if (tonumber(destination_number) == 911) then
+elseif (tonumber(destination_number) == 922) then
+ event = '922 Emergency Address Validation Service';
+elseif (tonumber(destination_number) == 911) then
event = '911 Emergency Call';
- end
end
--connect to the database
@@ -208,6 +186,9 @@ end
local t = dbh:first_row(sql);
call_date = t.call_date;
+-- replace the hardcoded template subject with the event
+subject = event;
+
--send the email
if (#to > 0) then
--prepare the body
@@ -217,7 +198,6 @@ if (#to > 0) then
body = body:gsub("${emergency_caller_id_name}", emergency_caller_id_name);
body = body:gsub("${emergency_caller_id_number}", emergency_caller_id_number);
body = body:gsub("${sip_from_user}", sip_from_user);
- body = body:gsub("${caller_id_number}", caller_id_number);
body = body:gsub("${message_date}", call_date);
body = body:gsub("${event}", event);
body = trim(body);
@@ -261,4 +241,3 @@ end
dbh:query(sql, params);
dbh:release();
-
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/index.lua b/app/switch/resources/scripts/app/voicemail/index.lua
index ebbe781fef..253bfcb43b 100644
--- a/app/switch/resources/scripts/app/voicemail/index.lua
+++ b/app/switch/resources/scripts/app/voicemail/index.lua
@@ -246,6 +246,22 @@
end
end
+ use_deletion_queue = 'false';
+ if (settings['voicemail']['use_deletion_queue'] ~= nil) then
+ if (settings['voicemail']['use_deletion_queue']['boolean'] ~= nil) then
+ use_deletion_queue = settings['voicemail']['use_deletion_queue']['boolean'];
+ end
+ end
+
+ deletion_queue_retention_hours = "24";
+ if (settings['voicemail'] ~= nil) then
+ if (settings['voicemail']['deletion_queue_retention_hours'] ~= nil) then
+ if (settings['voicemail']['deletion_queue_retention_hours']['numeric'] ~= nil) then
+ deletion_queue_retention_hours = settings['voicemail']['deletion_queue_retention_hours']['numeric'];
+ end
+ end
+ end
+
end
if (settings['voicemail']) then
@@ -363,6 +379,7 @@
require "app.voicemail.resources.functions.mwi_notify";
require "app.voicemail.resources.functions.blf_notify";
require "app.voicemail.resources.functions.tutorial";
+ require "app.voicemail.resources.functions.remove_deleted_messages";
--send a message waiting event
if (voicemail_action == "mwi") then
diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/listen_to_recording.lua
index 635e160b10..3fc0cfd5f5 100644
--- a/app/switch/resources/scripts/app/voicemail/resources/functions/listen_to_recording.lua
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/listen_to_recording.lua
@@ -233,7 +233,11 @@
--post listen options
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
- dtmf_digits = session:playAndGetDigits(1, 1, max_tries, digit_timeout, "#", "phrase:voicemail_listen_file_options:1:2:3:5:7:8:9:0", "", "^[\\d\\*#]$");
+ if (use_deletion_queue == "true" and message_status == "deleted") then
+ dtmf_digits = session:playAndGetDigits(1, 1, max_tries, digit_timeout, "#", "phrase:voicemail_listen_file_options:deleted:1:2:3:5:7:8:9:0", "", "^[\\d\\*#]$");
+ else
+ dtmf_digits = session:playAndGetDigits(1, 1, max_tries, digit_timeout, "#", "phrase:voicemail_listen_file_options:1:2:3:5:7:8:9:0", "", "^[\\d\\*#]$");
+ end
end
end
@@ -264,7 +268,12 @@
message_saved(voicemail_id, uuid);
return_call(caller_id_number);
elseif (dtmf_digits == "7") then
- delete_recording(voicemail_id, uuid);
+ if (use_deletion_queue == "true" and message_status ~= "deleted") then
+ message_saved(voicemail_id, uuid, "deleted");
+ session:execute("playback", "phrase:voicemail_ack:deleted");
+ else
+ delete_recording(voicemail_id, uuid);
+ end
message_waiting(voicemail_id, domain_uuid);
--fix for extensions that start with 0 (Ex: 0712)
if (voicemail_id_copy ~= voicemail_id and voicemail_id_copy ~= nil) then
diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/main_menu.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/main_menu.lua
index c69593b248..ea289054f1 100644
--- a/app/switch/resources/scripts/app/voicemail/resources/functions/main_menu.lua
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/main_menu.lua
@@ -38,6 +38,11 @@
session:execute("sleep", "1000");
end
+ --remove deleted messages in queue
+ if (use_deletion_queue == "true") then
+ remove_deleted_messages(voicemail_id);
+ end
+
--new voicemail count
if (session:ready()) then
local sql = [[SELECT count(*) as new_messages FROM v_voicemail_messages
@@ -70,6 +75,24 @@
dtmf_digits = session:playAndGetDigits(0, 1, 1, 300, "#", "phrase:voicemail_saved_message_count:" .. saved_messages .. ":saved", "", "\\d+");
end
end
+ --deleted messages
+ if (session:ready()) then
+ deleted_messages = 0;
+ if (string.len(dtmf_digits) == 0 and use_deletion_queue == "true") then
+ sql = [[SELECT count(*) as deleted_messages FROM v_voicemail_messages
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_uuid = :voicemail_uuid
+ AND message_status = 'deleted' ]];
+ local params = {domain_uuid = domain_uuid, voicemail_uuid = voicemail_uuid};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params, function(row)
+ deleted_messages = row["deleted_messages"];
+ end);
+ dtmf_digits = session:playAndGetDigits(0, 1, 1, 300, "#", "phrase:voicemail_deleted_message_count:" .. deleted_messages .. ":deleted", "", "\\d+");
+ end
+ end
--to listen to new message
if (session:ready() and new_messages ~= '0') then
@@ -83,6 +106,12 @@
dtmf_digits = session:playAndGetDigits(0, 1, 1, 100, "#", "phrase:voicemail_main_menu:saved:2", "", "\\d+");
end
end
+ --deleted messages
+ if (session:ready() and deleted_messages ~= '0') then
+ if (string.len(dtmf_digits) == 0) then
+ dtmf_digits = session:playAndGetDigits(0, 1, 1, 100, "#", "phrase:voicemail_main_menu:deleted:3", "", "\\d+");
+ end
+ end
--for advanced options
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
@@ -101,6 +130,8 @@
menu_messages("new");
elseif (dtmf_digits == "2") then
menu_messages("saved");
+ elseif (dtmf_digits == "3" and use_deletion_queue == "true") then
+ menu_messages("deleted");
elseif (dtmf_digits == "5") then
timeouts = 0;
advanced();
diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/menu_messages.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/menu_messages.lua
index c106823065..e17990a8aa 100644
--- a/app/switch/resources/scripts/app/voicemail/resources/functions/menu_messages.lua
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/menu_messages.lua
@@ -38,7 +38,7 @@
--session:flushDigits();
--set the message number
message_number = 0;
- --message_status new,saved
+ --message_status new,any
if (session:ready()) then
if (voicemail_id ~= nil) then
--get the voicemail_id
@@ -58,8 +58,8 @@
AND voicemail_uuid = :voicemail_uuid ]]
if (message_status == "new") then
sql = sql .. [[AND (message_status is null or message_status = '') ]];
- elseif (message_status == "saved") then
- sql = sql .. [[AND message_status = 'saved' ]];
+ else
+ sql = sql .. "AND message_status = '" .. message_status .. "' ";
end
sql = sql .. [[ORDER BY created_epoch ]]..message_order;
local params = {domain_uuid = domain_uuid, voicemail_uuid = voicemail_uuid};
diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/message_saved.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/message_saved.lua
index 15bec62635..d48ad0f472 100644
--- a/app/switch/resources/scripts/app/voicemail/resources/functions/message_saved.lua
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/message_saved.lua
@@ -24,11 +24,15 @@
-- POSSIBILITY OF SUCH DAMAGE.
--save the message
- function message_saved(voicemail_id, uuid)
+ function message_saved(voicemail_id, uuid, status)
--clear the dtmf
dtmf_digits = '';
--flush dtmf digits from the input buffer
session:flushDigits();
+ --set default status
+ if (status == nil) then
+ status = 'saved';
+ end
--get the voicemail_uuid
local sql = [[SELECT * FROM v_voicemails
WHERE domain_uuid = :domain_uuid
@@ -38,18 +42,20 @@
db_voicemail_uuid = row["voicemail_uuid"];
end);
--delete from the database
- sql = [[UPDATE v_voicemail_messages SET message_status = 'saved'
+ sql = [[UPDATE v_voicemail_messages
+ SET message_status = :status,
+ update_date = now()
WHERE domain_uuid = :domain_uuid
AND voicemail_uuid = :voicemail_uuid
AND voicemail_message_uuid = :uuid]];
- params = {domain_uuid = domain_uuid, voicemail_uuid = db_voicemail_uuid, uuid = uuid};
+ params = {status = status, domain_uuid = domain_uuid, voicemail_uuid = db_voicemail_uuid, uuid = uuid};
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
end
dbh:query(sql, params);
--log to console
if (debug["info"]) then
- freeswitch.consoleLog("notice", "[voicemail][saved] id: " .. voicemail_id .. " message: "..uuid.."\n");
+ freeswitch.consoleLog("notice", "[voicemail]["..status.."] id: " .. voicemail_id .. " message: "..uuid.."\n");
end
--check the message waiting status
message_waiting(voicemail_id, domain_uuid);
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
new file mode 100644
index 0000000000..1e8a94bc27
--- /dev/null
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/remove_deleted_messages.lua
@@ -0,0 +1,92 @@
+-- Part of FusionPBX
+-- Copyright (C) 2013-2025
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions are met:
+--
+-- 1. Redistributions of source code must retain the above copyright notice,
+-- this list of conditions and the following disclaimer.
+--
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+-- POSSIBILITY OF SUCH DAMAGE.
+
+--delete all deleted messages for a single mailbox
+ function remove_deleted_messages(voicemail_id)
+ --get the voicemail_uuid
+ local sql = [[SELECT * FROM v_voicemails
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_id = :voicemail_id]];
+ local params = {domain_uuid = domain_uuid, voicemail_id = voicemail_id};
+ dbh:query(sql, params, function(row)
+ db_voicemail_uuid = row["voicemail_uuid"];
+ end);
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+
+ --get messages
+ local sql = [[SELECT * FROM v_voicemail_messages
+ WHERE message_status = 'deleted' ]]
+ sql = sql .. "AND (update_date + interval '" .. deletion_queue_retention_hours .. " hours') < now() "
+ sql = sql .. [[AND voicemail_uuid = :voicemail_uuid
+ AND domain_uuid = :domain_uuid]];
+ local params = {voicemail_uuid = db_voicemail_uuid, domain_uuid = domain_uuid}
+ messages_to_delete = {};
+ dbh:query(sql, params, function(row)
+ table.insert(messages_to_delete, row);
+ end);
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+
+ --flush dtmf digits from the input buffer
+ session:flushDigits();
+
+ total_messages = #messages_to_delete;
+ message_number = 1;
+ while message_number <= total_messages do
+ local message_row = messages_to_delete[message_number];
+ local uuid = message_row["voicemail_message_uuid"];
+
+ --delete the file
+ os.remove(voicemail_dir.."/"..voicemail_id.."/intro_msg_"..uuid.."."..vm_message_ext);
+ os.remove(voicemail_dir.."/"..voicemail_id.."/intro_"..uuid.."."..vm_message_ext);
+ os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext);
+ --delete from the database
+ sql = [[DELETE FROM v_voicemail_messages
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_uuid = :voicemail_uuid
+ AND voicemail_message_uuid = :uuid]];
+ params = {domain_uuid = domain_uuid, voicemail_uuid = db_voicemail_uuid, uuid = uuid};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params);
+ --log to console
+ if (debug["info"]) then
+ freeswitch.consoleLog("notice", "[voicemail][deleted] message: " .. uuid .. "\n");
+ end
+ end
+
+
+ --clear the variable
+ db_voicemail_uuid = '';
+ messages_to_delete = {};
+
+ --flush dtmf digits from the input buffer
+ session:flushDigits();
+
+end
diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua
index eaaa53dbb2..05ed42cb48 100644
--- a/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua
+++ b/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua
@@ -25,364 +25,361 @@
-- POSSIBILITY OF SUCH DAMAGE.
--load libraries
- local send_mail = require 'resources.functions.send_mail'
- local Database = require "resources.functions.database"
- local Settings = require "resources.functions.lazy_settings"
+local send_mail = require 'resources.functions.send_mail'
+local Database = require "resources.functions.database"
+local Settings = require "resources.functions.lazy_settings"
--define a function to send email
- function send_email(id, uuid)
+function send_email(id, uuid)
+ --prepare the database, settings and variables
local db = dbh or Database.new('system');
local settings = Settings.new(db, domain_name, domain_uuid);
local http_protocol = settings:get('domain', 'http_protocol', 'text') or "https";
local email_queue_enabled = "true";
- --get voicemail message details
- local sql = [[SELECT * FROM v_voicemails
- WHERE domain_uuid = :domain_uuid
- AND voicemail_id = :voicemail_id]]
- local params = {domain_uuid = domain_uuid, voicemail_id = id};
- if (debug["sql"]) then
- freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
- end
- dbh:query(sql, params, function(row)
- db_voicemail_uuid = string.lower(row["voicemail_uuid"]);
- --voicemail_password = row["voicemail_password"];
- --greeting_id = row["greeting_id"];
- voicemail_mail_to = row["voicemail_mail_to"];
- voicemail_transcription_enabled = row["voicemail_transcription_enabled"];
- voicemail_file = row["voicemail_file"];
- voicemail_local_after_email = row["voicemail_local_after_email"];
- voicemail_local_after_forward = row["voicemail_local_after_forward"];
- voicemail_description = row["voicemail_description"];
- end);
+ --get voicemail message details
+ local sql = [[SELECT * FROM v_voicemails
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_id = :voicemail_id]]
+ local params = {domain_uuid = domain_uuid, voicemail_id = id};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params, function(row)
+ db_voicemail_uuid = string.lower(row["voicemail_uuid"]);
+ --voicemail_password = row["voicemail_password"];
+ --greeting_id = row["greeting_id"];
+ voicemail_mail_to = row["voicemail_mail_to"];
+ voicemail_transcription_enabled = row["voicemail_transcription_enabled"];
+ voicemail_file = row["voicemail_file"];
+ voicemail_local_after_email = row["voicemail_local_after_email"];
+ voicemail_description = row["voicemail_description"];
+ end);
- --set default values
- if (voicemail_file == nil) then
- voicemail_file = "listen";
- end
- if (voicemail_local_after_email == nil) then
- voicemail_local_after_email = "true";
- end
- if (voicemail_local_after_forward == nil) then
- voicemail_local_after_forward = "true";
- end
+ --set default values
+ if (voicemail_file == nil or voicemail_file == '') then
+ voicemail_file = "listen";
+ end
+ if (voicemail_local_after_email == nil or voicemail_local_after_email == '') then
+ voicemail_local_after_email = "true";
+ end
- --require the email address to send the email
- if (string.len(voicemail_mail_to) > 2) then
- --include languages file
- local Text = require "resources.functions.text"
- local text = Text.new("app.voicemail.app_languages")
- local dbh = dbh
+ --require the email address to send the email
+ if (string.len(voicemail_mail_to) > 2) then
+ --include languages file
+ local Text = require "resources.functions.text"
+ local text = Text.new("app.voicemail.app_languages")
+ local dbh = dbh
- --user setting time zone, if set
- local sql = [[
- select
- us.user_setting_value as time_zone
- from
- v_user_settings as us,
- v_extension_users as eu,
- v_extensions as e,
- v_voicemails as v
- where
- v.voicemail_id = :voicemail_id and
- v.domain_uuid = :domain_uuid and
- v.voicemail_id = e.extension and
- e.domain_uuid = :domain_uuid and
- e.extension_uuid = eu.extension_uuid and
- eu.domain_uuid = :domain_uuid and
- eu.user_uuid = us.user_uuid and
- us.domain_uuid = :domain_uuid and
- us.user_setting_category = 'domain' and
- us.user_setting_subcategory = 'time_zone' and
- us.user_setting_name = 'name' and
- us.user_setting_enabled = 'true'
- order by
- eu.insert_date asc
- limit 1
- ]]
- local params = {domain_uuid = domain_uuid, voicemail_id = id};
- if (debug["sql"]) then
- freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
- end
- dbh:query(sql, params, function(row)
- time_zone = row["time_zone"];
- end);
+ --user setting time zone, if set
+ local sql = [[
+ select
+ us.user_setting_value as time_zone
+ from
+ v_user_settings as us,
+ v_extension_users as eu,
+ v_extensions as e,
+ v_voicemails as v
+ where
+ v.voicemail_id = :voicemail_id and
+ v.domain_uuid = :domain_uuid and
+ v.voicemail_id = e.extension and
+ e.domain_uuid = :domain_uuid and
+ e.extension_uuid = eu.extension_uuid and
+ eu.domain_uuid = :domain_uuid and
+ eu.user_uuid = us.user_uuid and
+ us.domain_uuid = :domain_uuid and
+ us.user_setting_category = 'domain' and
+ us.user_setting_subcategory = 'time_zone' and
+ us.user_setting_name = 'name' and
+ us.user_setting_enabled = 'true'
+ order by
+ eu.insert_date asc
+ limit 1
+ ]]
+ local params = {domain_uuid = domain_uuid, voicemail_id = id};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params, function(row)
+ time_zone = row["time_zone"];
+ end);
- --default/domain setting time zone
- if (time_zone == nil or time_zone == '') then
- time_zone = settings:get('domain', 'time_zone', 'name');
- end
-
- --default time zone
- if (time_zone == nil or time_zone == '') then
- time_zone = 'UTC';
- end
-
- --connect using other backend if needed
- if storage_type == "base64" then
- dbh = Database.new('system', 'base64/read')
- end
-
- --get voicemail message details
- local sql = [[SELECT to_char(timezone(:time_zone, to_timestamp(created_epoch)), 'Day DD Mon YYYY HH:MI:SS PM') as message_date, *
- FROM v_voicemail_messages
- WHERE domain_uuid = :domain_uuid
- AND voicemail_message_uuid = :uuid]]
- local params = {domain_uuid = domain_uuid, uuid = uuid, time_zone = time_zone};
- if (debug["sql"]) then
- freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
- end
- dbh:query(sql, params, function(row)
- --get the values from the database
- --uuid = row["voicemail_message_uuid"];
- created_epoch = row["created_epoch"];
- caller_id_name = row["caller_id_name"];
- caller_id_number = row["caller_id_number"];
- message_date = row["message_date"];
- message_length = row["message_length"];
- --message_status = row["message_status"];
- --message_priority = row["message_priority"];
- --get the recordings from the database
- if (storage_type == "base64") then
- --set the voicemail intro and message paths
- message_location = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
- intro_location = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext;
-
- --save the recordings to the file system
- if (string.len(row["message_base64"]) > 32) then
- --save the value to a variable
- voicemail_base64 = row["message_base64"];
-
- --include the file io
- local file = require "resources.functions.file"
-
- --write decoded message string to file
- file.write_base64(message_location, row["message_base64"]);
-
- --write decoded intro string to file, if any
- if (string.len(row["message_intro_base64"]) > 32) then
- file.write_base64(intro_location, row["message_intro_base64"]);
- end
- end
- end
- end);
-
- --close temporary connection
- if storage_type == "base64" then
- dbh:release()
- end
-
- --format the message length and date
- message_length_formatted = format_seconds(message_length);
- if (debug["info"]) then
- freeswitch.consoleLog("notice", "[voicemail] message date: " .. message_date .. "\n");
- freeswitch.consoleLog("notice", "[voicemail] message length: " .. message_length .. "\n");
- end
- --local message_date = os.date("%A, %d %b %Y %I:%M %p", created_epoch);
-
- --connect to the database
- local dbh = Database.new('system');
-
- --get the templates
- 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 = 'voicemail' "
- if (voicemail_transcription_enabled == 'true') then
- sql = sql .. "AND template_subcategory = 'transcription' "
- else
- sql = sql .. "AND template_subcategory = 'default' "
- end
- 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");
- end
- dbh:query(sql, params, function(row)
- subject = row["template_subject"];
- body = row["template_body"];
- end);
-
- --get the link_address
- link_address = http_protocol.."://"..domain_name..project_path;
-
- --set proper delete status
- local local_after_email = '';
- if (voicemail_local_after_email == "false" or voicemail_local_after_forward == "false") then
- local_after_email = "false";
- else
- local_after_email = "true";
- end
-
- --prepare the headers
- local headers = {
- ["X-FusionPBX-Domain-UUID"] = domain_uuid;
- ["X-FusionPBX-Domain-Name"] = domain_name;
- ["X-FusionPBX-Call-UUID"] = uuid;
- ["X-FusionPBX-Email-Type"] = 'voicemail';
- ["X-FusionPBX-local_after_email"] = local_after_email;
- }
-
- --prepare the voicemail_name_formatted
- voicemail_name_formatted = id;
- local display_domain_name = settings:get('voicemail', 'display_domain_name', 'boolean');
-
- if (display_domain_name == 'true') then
- voicemail_name_formatted = id.."@"..domain_name;
- end
- if (voicemail_description ~= nil and voicemail_description ~= "" and voicemail_description ~= id) then
- voicemail_name_formatted = voicemail_name_formatted.." ("..voicemail_description..")";
- end
-
- --prepare file
- file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
-
- --combine intro, if exists, with message for emailing (only)
- intro = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext;
- combined = voicemail_dir.."/"..id.."/intro_msg_"..uuid.."."..vm_message_ext;
- if (file_exists(intro) and file_exists(file)) then
- os.execute("sox "..intro.." "..file.." "..combined);
- end
-
- --prepare the subject
- if (subject ~= nil) then
- subject = subject:gsub("${caller_id_name}", caller_id_name);
- subject = subject:gsub("${caller_id_number}", caller_id_number);
- subject = subject:gsub("${message_date}", message_date);
- subject = subject:gsub("${message_duration}", message_length_formatted);
- subject = subject:gsub("${account}", voicemail_name_formatted);
- subject = subject:gsub("${voicemail_id}", id);
- subject = subject:gsub("${voicemail_description}", voicemail_description);
- subject = subject:gsub("${voicemail_name_formatted}", voicemail_name_formatted);
- subject = subject:gsub("${domain_name}", domain_name);
- subject = subject:gsub("${new_messages}", new_messages);
- subject = trim(subject);
- else
- subject = text['label-voicemail'] .. ' ' .. caller_id_name .. ' <' .. caller_id_number .. '> ' .. message_length_formatted;
- end
- subject = '=?utf-8?B?'..base64.encode(subject)..'?=';
-
- --prepare the body
- if (body ~= nil) then
- body = body:gsub("${caller_id_name}", caller_id_name);
- body = body:gsub("${caller_id_number}", caller_id_number);
- body = body:gsub("${message_date}", message_date);
- if (transcription ~= nil) then
- transcription = transcription:gsub("%%", "*");
- body = body:gsub("${message_text}", transcription);
- end
- body = body:gsub("${message_duration}", message_length_formatted);
- body = body:gsub("${account}", voicemail_name_formatted);
- body = body:gsub("${voicemail_id}", id);
- body = body:gsub("${voicemail_description}", voicemail_description);
- body = body:gsub("${voicemail_name_formatted}", voicemail_name_formatted);
- body = body:gsub("${domain_name}", domain_name);
- body = body:gsub("${sip_to_user}", id);
- if (origination_callee_id_name ~= nil) then
- body = body:gsub("${origination_callee_id_name}", origination_callee_id_name);
- end
- body = body:gsub("${dialed_user}", id);
- if (voicemail_file == "attach" and file) then
- body = body:gsub("${message}", text['label-attached']);
- elseif (voicemail_file == "link") then
- body = body:gsub("${message}", ""..text['label-download'].." ");
- else
- body = body:gsub("${message}", ""..text['label-listen'].." ");
- end
- --body = body:gsub(" ", " ");
- --body = body:gsub("%s+", "");
- --body = body:gsub(" ", " ");
- body = trim(body);
- else
- body = '';
- if (caller_id_name ~= nil and caller_id_name ~= caller_id_number) then
- body = body .. caller_id_name .. ' ';
- end
- body = body .. caller_id_number .. ' ';
- body = body .. message_date .. ' ';
- if (voicemail_file == "attach" and file) then
- body = body .. ' ' .. text['label-attached'];
- elseif (voicemail_file == "link") then
- body = body .. ""..text['label-download'].." ";
- else
- body = body .. ""..text['label-listen'].." ";
- end
- body = body .. '';
- end
-
- --get the smtp from address and name
- smtp_from = settings:get('voicemail', 'smtp_from', 'text');
- smtp_from_name = settings:get('voicemail', 'smtp_from_name', 'text');
- if (smtp_from == nil or smtp_from == '') then
- smtp_from = settings:get('email', 'smtp_from', 'text');
- end
- if (smtp_from_name == nil or smtp_from_name == '') then
- smtp_from_name = settings:get('email', 'smtp_from_name', 'text');
- end
- if (smtp_from_name and string.len(smtp_from_name) > 0 and smtp_from and string.len(smtp_from) > 2) then
- smtp_from = smtp_from_name.."<"..smtp_from..">";
- end
-
- --send the email with, or without, including the intro
- if (file_exists(combined)) then
- voicemail_path = combined
- else
- voicemail_path = file
- end
-
- --send the email
- send_mail(headers,
- smtp_from,
- voicemail_mail_to,
- {subject, body},
- (voicemail_file == "attach") and voicemail_path,
- voicemail_base64
- );
-
- end
-
- --whether to keep the voicemail message and details local after email
- if (string.len(voicemail_mail_to) > 2 and email_queue_enabled == 'false') then
- if (voicemail_local_after_email == "false" and voicemail_local_after_forward == "false") then
- --delete the voicemail message details
- local sql = [[DELETE FROM v_voicemail_messages
- WHERE domain_uuid = :domain_uuid
- AND voicemail_uuid = :voicemail_uuid
- AND voicemail_message_uuid = :uuid]]
- local params = {domain_uuid = domain_uuid,
- voicemail_uuid = db_voicemail_uuid, uuid = uuid};
- if (debug["sql"]) then
- freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
- end
- dbh:query(sql, params);
- --delete voicemail recording files
- if (file_exists(file)) then
- os.remove(file);
- end
- if (file_exists(intro)) then
- os.remove(intro);
- end
- if (file_exists(combined)) then
- os.remove(combined);
- end
- --set message waiting indicator
- message_waiting(id, domain_uuid);
- --clear the variable
- db_voicemail_uuid = '';
- elseif (storage_type == "base64") then
- --delete voicemail recording files
- if (file_exists(file)) then
- os.remove(file);
- end
- if (file_exists(intro)) then
- os.remove(intro);
- end
- if (file_exists(combined)) then
- os.remove(combined);
- end
+ --default/domain setting time zone
+ if (time_zone == nil or time_zone == '') then
+ time_zone = settings:get('domain', 'time_zone', 'name');
end
+ --default time zone
+ if (time_zone == nil or time_zone == '') then
+ time_zone = 'UTC';
+ end
+
+ --connect using other backend if needed
+ if storage_type == "base64" then
+ dbh = Database.new('system', 'base64/read')
+ end
+
+ --get voicemail message details
+ local sql = [[SELECT to_char(timezone(:time_zone, to_timestamp(created_epoch)), 'Day DD Mon YYYY HH:MI:SS PM') as message_date, *
+ FROM v_voicemail_messages
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_message_uuid = :uuid]]
+ local params = {domain_uuid = domain_uuid, uuid = uuid, time_zone = time_zone};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params, function(row)
+ --get the values from the database
+ --uuid = row["voicemail_message_uuid"];
+ created_epoch = row["created_epoch"];
+ caller_id_name = row["caller_id_name"];
+ caller_id_number = row["caller_id_number"];
+ message_date = row["message_date"];
+ message_length = row["message_length"];
+ --message_status = row["message_status"];
+ --message_priority = row["message_priority"];
+ --get the recordings from the database
+ if (storage_type == "base64") then
+ --set the voicemail intro and message paths
+ message_location = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
+ intro_location = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext;
+
+ --save the recordings to the file system
+ if (string.len(row["message_base64"]) > 32) then
+ --save the value to a variable
+ voicemail_base64 = row["message_base64"];
+
+ --include the file io
+ local file = require "resources.functions.file"
+
+ --write decoded message string to file
+ file.write_base64(message_location, row["message_base64"]);
+
+ --write decoded intro string to file, if any
+ if (string.len(row["message_intro_base64"]) > 32) then
+ file.write_base64(intro_location, row["message_intro_base64"]);
+ end
+ end
+ end
+ end);
+
+ --close temporary connection
+ if storage_type == "base64" then
+ dbh:release()
+ end
+
+ --format the message length and date
+ message_length_formatted = format_seconds(message_length);
+ if (debug["info"]) then
+ freeswitch.consoleLog("notice", "[voicemail] message date: " .. message_date .. "\n");
+ freeswitch.consoleLog("notice", "[voicemail] message length: " .. message_length .. "\n");
+ end
+ --local message_date = os.date("%A, %d %b %Y %I:%M %p", created_epoch);
+
+ --connect to the database
+ local dbh = Database.new('system');
+
+ --get the templates
+ 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 = 'voicemail' "
+ if (voicemail_transcription_enabled == 'true') then
+ sql = sql .. "AND template_subcategory = 'transcription' "
+ else
+ sql = sql .. "AND template_subcategory = 'default' "
+ end
+ 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");
+ end
+ dbh:query(sql, params, function(row)
+ subject = row["template_subject"];
+ body = row["template_body"];
+ end);
+
+ --get the link_address
+ link_address = http_protocol.."://"..domain_name..project_path;
+
+ --set proper delete status
+ local local_after_email = '';
+ if (voicemail_local_after_email == "false") then
+ local_after_email = "false";
+ else
+ local_after_email = "true";
+ end
+
+ --prepare the headers
+ local headers = {
+ ["X-FusionPBX-Domain-UUID"] = domain_uuid;
+ ["X-FusionPBX-Domain-Name"] = domain_name;
+ ["X-FusionPBX-Call-UUID"] = uuid;
+ ["X-FusionPBX-Email-Type"] = 'voicemail';
+ ["X-FusionPBX-local_after_email"] = local_after_email;
+ }
+
+ --prepare the voicemail_name_formatted
+ voicemail_name_formatted = id;
+ local display_domain_name = settings:get('voicemail', 'display_domain_name', 'boolean');
+
+ if (display_domain_name == 'true') then
+ voicemail_name_formatted = id.."@"..domain_name;
+ end
+ if (voicemail_description ~= nil and voicemail_description ~= "" and voicemail_description ~= id) then
+ voicemail_name_formatted = voicemail_name_formatted.." ("..voicemail_description..")";
+ end
+
+ --prepare file
+ file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
+
+ --combine intro, if exists, with message for emailing (only)
+ intro = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext;
+ combined = voicemail_dir.."/"..id.."/intro_msg_"..uuid.."."..vm_message_ext;
+ if (file_exists(intro) and file_exists(file)) then
+ os.execute("sox "..intro.." "..file.." "..combined);
+ end
+
+ --prepare the subject
+ if (subject ~= nil) then
+ subject = subject:gsub("${caller_id_name}", caller_id_name);
+ subject = subject:gsub("${caller_id_number}", caller_id_number);
+ subject = subject:gsub("${message_date}", message_date);
+ subject = subject:gsub("${message_duration}", message_length_formatted);
+ subject = subject:gsub("${account}", voicemail_name_formatted);
+ subject = subject:gsub("${voicemail_id}", id);
+ subject = subject:gsub("${voicemail_description}", voicemail_description);
+ subject = subject:gsub("${voicemail_name_formatted}", voicemail_name_formatted);
+ subject = subject:gsub("${domain_name}", domain_name);
+ subject = subject:gsub("${new_messages}", new_messages);
+ subject = trim(subject);
+ else
+ subject = text['label-voicemail'] .. ' ' .. caller_id_name .. ' <' .. caller_id_number .. '> ' .. message_length_formatted;
+ end
+ subject = '=?utf-8?B?'..base64.encode(subject)..'?=';
+
+ --prepare the body
+ if (body ~= nil) then
+ body = body:gsub("${caller_id_name}", caller_id_name);
+ body = body:gsub("${caller_id_number}", caller_id_number);
+ body = body:gsub("${message_date}", message_date);
+ if (transcription ~= nil) then
+ transcription = transcription:gsub("%%", "*");
+ body = body:gsub("${message_text}", transcription);
+ end
+ body = body:gsub("${message_duration}", message_length_formatted);
+ body = body:gsub("${account}", voicemail_name_formatted);
+ body = body:gsub("${voicemail_id}", id);
+ body = body:gsub("${voicemail_description}", voicemail_description);
+ body = body:gsub("${voicemail_name_formatted}", voicemail_name_formatted);
+ body = body:gsub("${domain_name}", domain_name);
+ body = body:gsub("${sip_to_user}", id);
+ if (origination_callee_id_name ~= nil) then
+ body = body:gsub("${origination_callee_id_name}", origination_callee_id_name);
+ end
+ body = body:gsub("${dialed_user}", id);
+ if (voicemail_file == "attach" and file) then
+ body = body:gsub("${message}", text['label-attached']);
+ elseif (voicemail_file == "link") then
+ body = body:gsub("${message}", ""..text['label-download'].." ");
+ else
+ body = body:gsub("${message}", ""..text['label-listen'].." ");
+ end
+ --body = body:gsub(" ", " ");
+ --body = body:gsub("%s+", "");
+ --body = body:gsub(" ", " ");
+ body = trim(body);
+ else
+ body = '';
+ if (caller_id_name ~= nil and caller_id_name ~= caller_id_number) then
+ body = body .. caller_id_name .. ' ';
+ end
+ body = body .. caller_id_number .. ' ';
+ body = body .. message_date .. ' ';
+ if (voicemail_file == "attach" and file) then
+ body = body .. ' ' .. text['label-attached'];
+ elseif (voicemail_file == "link") then
+ body = body .. ""..text['label-download'].." ";
+ else
+ body = body .. ""..text['label-listen'].." ";
+ end
+ body = body .. '';
+ end
+
+ --get the smtp from address and name
+ smtp_from = settings:get('voicemail', 'smtp_from', 'text');
+ smtp_from_name = settings:get('voicemail', 'smtp_from_name', 'text');
+ if (smtp_from == nil or smtp_from == '') then
+ smtp_from = settings:get('email', 'smtp_from', 'text');
+ end
+ if (smtp_from_name == nil or smtp_from_name == '') then
+ smtp_from_name = settings:get('email', 'smtp_from_name', 'text');
+ end
+ if (smtp_from_name and string.len(smtp_from_name) > 0 and smtp_from and string.len(smtp_from) > 2) then
+ smtp_from = smtp_from_name.."<"..smtp_from..">";
+ end
+
+ --send the email with, or without, including the intro
+ if (file_exists(combined)) then
+ voicemail_path = combined
+ else
+ voicemail_path = file
+ end
+
+ --send the email
+ send_mail(headers,
+ smtp_from,
+ voicemail_mail_to,
+ {subject, body},
+ (voicemail_file == "attach") and voicemail_path,
+ voicemail_base64
+ );
+
+ end
+
+ --whether to keep the voicemail message and details local after email
+ if (string.len(voicemail_mail_to) > 2 and email_queue_enabled == 'false') then
+ if (voicemail_local_after_email == "false") then
+ --delete the voicemail message details
+ local sql = [[DELETE FROM v_voicemail_messages
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_uuid = :voicemail_uuid
+ AND voicemail_message_uuid = :uuid]]
+ local params = {domain_uuid = domain_uuid,
+ voicemail_uuid = db_voicemail_uuid, uuid = uuid};
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params);
+ --delete voicemail recording files
+ if (file_exists(file)) then
+ os.remove(file);
+ end
+ if (file_exists(intro)) then
+ os.remove(intro);
+ end
+ if (file_exists(combined)) then
+ os.remove(combined);
+ end
+ --set message waiting indicator
+ message_waiting(id, domain_uuid);
+ --clear the variable
+ db_voicemail_uuid = '';
+ elseif (storage_type == "base64") then
+ --delete voicemail recording files
+ if (file_exists(file)) then
+ os.remove(file);
+ end
+ if (file_exists(intro)) then
+ os.remove(intro);
+ end
+ if (file_exists(combined)) then
+ os.remove(combined);
+ end
end
- end
+ end
+
+end
diff --git a/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua b/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua
new file mode 100644
index 0000000000..4deef47da6
--- /dev/null
+++ b/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua
@@ -0,0 +1,120 @@
+-- Part of FusionPBX
+-- Copyright (C) 2013-2025 Mark J Crane
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions are met:
+--
+-- 1. Redistributions of source code must retain the above copyright notice,
+-- this list of conditions and the following disclaimer.
+--
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+-- POSSIBILITY OF SUCH DAMAGE.
+
+--connect to the database
+ Database = require "resources.functions.database";
+ dbh = Database.new('system');
+
+--get settings
+ require "resources.functions.settings";
+ settings = settings();
+
+--set deletion_queue_retention_hours
+ if (settings['voicemail'] ~= nil) then
+ if (settings['voicemail']['deletion_queue_retention_hours'] ~= nil) then
+ if (settings['voicemail']['deletion_queue_retention_hours']['numeric'] ~= nil) then
+ retention_hours = settings['voicemail']['deletion_queue_retention_hours']['numeric'];
+ else
+ retention_hours = "24";
+ end
+ end
+ end
+
+--set the voicemail_dir
+ if (settings['switch'] ~= nil) then
+ if (settings['switch']['voicemail'] ~= nil) then
+ if (settings['switch']['voicemail']['dir'] ~= nil) then
+ voicemail_dir = settings['switch']['voicemail']['dir'].."/default";
+ end
+ end
+ end
+
+--get the voicemail extension
+ sql = "SELECT * FROM v_vars WHERE var_category = 'Defaults' AND var_name = 'vm_message_ext' AND var_enabled = 'true'";
+ dbh:query(sql, function(row)
+ vm_message_ext = row["var_value"];
+ end);
+ if (vm_message_ext == nil) then
+ vm_message_ext = "wav";
+ end
+
+--get messages
+ sql = "SELECT * FROM v_voicemail_messages WHERE message_status = 'deleted' AND (update_date + interval '" .. retention_hours .. " hours') < now()";
+ messages_to_delete = {};
+ dbh:query(sql, function(row)
+ table.insert(messages_to_delete, row);
+ end);
+
+--delete the messages
+ total_messages = #messages_to_delete;
+ message_number = 1;
+ while message_number <= total_messages do
+ local message_row = messages_to_delete[message_number];
+ local uuid = message_row["voicemail_message_uuid"];
+
+ --get domain_name
+ sql = [[SELECT * from v_domains
+ WHERE domain_uuid = :domain_uuid
+ ]];
+ local params = {domain_uuid = message_row["domain_uuid"]};
+ dbh:query(sql, params, function(row)
+ domain_name = row["domain_name"];
+ end);
+
+ --get voicemail_id
+ sql = [[SELECT * from v_voicemails
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_uuid = :voicemail_uuid
+ ]];
+ local params = {domain_uuid = message_row["domain_uuid"], voicemail_uuid = message_row["voicemail_uuid"]};
+ dbh:query(sql, params, function(row)
+ voicemail_id = row["voicemail_id"];
+ end);
+
+ --delete the file
+ os.remove(voicemail_dir.."/"..domain_name.."/"..voicemail_id.."/intro_msg_"..uuid.."."..vm_message_ext);
+ os.remove(voicemail_dir.."/"..domain_name.."/"..voicemail_id.."/intro_"..uuid.."."..vm_message_ext);
+ os.remove(voicemail_dir.."/"..domain_name.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext);
+
+ --delete from the database
+ sql = [[DELETE FROM v_voicemail_messages
+ WHERE domain_uuid = :domain_uuid
+ AND voicemail_uuid = :voicemail_uuid
+ AND voicemail_message_uuid = :uuid]];
+ local params = {
+ domain_uuid = message_row["domain_uuid"],
+ voicemail_uuid = message_row["voicemail_uuid"],
+ uuid = uuid
+ };
+ if (debug["sql"]) then
+ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
+ end
+ dbh:query(sql, params);
+ --log to console
+ if (debug["info"]) then
+ freeswitch.consoleLog("notice", "[voicemail][deleted] message: " .. uuid .. "\n");
+ end
+
+ end
\ No newline at end of file
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_counts.php b/app/system/resources/dashboard/system_counts.php
index 323e71dedb..c143d18433 100644
--- a/app/system/resources/dashboard/system_counts.php
+++ b/app/system/resources/dashboard/system_counts.php
@@ -260,8 +260,8 @@
//get the domain active and inactive counts
$sql = "select ";
- $sql .= "(select count(*) from v_domains where domain_enabled = 'true') as active, ";
- $sql .= "(select count(*) from v_domains where domain_enabled = 'false') as inactive; ";
+ $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = 'true') as active, ";
+ $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = 'false') as inactive; ";
$row = $database->select($sql, null, 'row');
$domain_active = $row['active'];
$domain_inactive = $row['inactive'];
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 " ".($text['label-service'] ?? 'Service')." \n";
+echo " ".($text['label-running'] ?? 'Running')." \n";
+echo " \n";
+ $row_style[false] = "row_style0";
+ $row_style[true] = "row_style1";
+ $c = true;
+ foreach ($services as $name => $enabled) {
+ echo " \n";
+ echo " $name \n";
+ echo " " . ($enabled ? $text['label-yes'] ?? 'Yes' : $text['label-no'] ?? 'No') . " \n";
+ echo " \n";
+ $c = !$c;
+ }
+echo "
\n";
+echo "
\n";
+}
+echo "
\n";
diff --git a/app/system/system.php b/app/system/system.php
index 38b14c0e69..ce51b6b116 100644
--- a/app/system/system.php
+++ b/app/system/system.php
@@ -49,9 +49,9 @@
if (permission_exists("system_view_support")) {
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
- $setting_invisibles = !empty($_SESSION["editor"]["invisibles"]["boolean"]) ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
- $setting_indenting = !empty($_SESSION["editor"]["indent_guides"]["boolean"]) ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
- $setting_numbering = !empty($_SESSION["editor"]["line_numbers"]["boolean"]) ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
+ $setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false';
+ $setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false';
+ $setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true';
}
//additional includes
diff --git a/app/time_conditions/resources/classes/time_conditions.php b/app/time_conditions/resources/classes/time_conditions.php
index 98a5e757df..c4be826b78 100644
--- a/app/time_conditions/resources/classes/time_conditions.php
+++ b/app/time_conditions/resources/classes/time_conditions.php
@@ -25,7 +25,6 @@
*/
//define the time conditions class
- if (!class_exists('time_conditions')) {
class time_conditions {
/**
@@ -346,6 +345,3 @@
} //class
- }
-
-?>
diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php
index 63c826305e..23eb0b57ee 100644
--- a/app/time_conditions/time_conditions.php
+++ b/app/time_conditions/time_conditions.php
@@ -210,7 +210,7 @@
echo th_order_by('dialplan_order', $text['label-order'], $order_by, $order, null, "class='center'", ($search != '' ? "search=".$search : null));
echo th_order_by('dialplan_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'", ($search != '' ? "search=".$search : null));
echo th_order_by('dialplan_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'", ($search != '' ? "search=".$search : null));
- if (permission_exists('time_condition_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('time_condition_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo "
\n";
}
echo "
\n";
@@ -218,8 +218,12 @@
if (is_array($dialplans) && @sizeof($dialplans) != 0) {
$x = 0;
foreach ($dialplans as $row) {
+ $list_row_url = '';
if (permission_exists('time_condition_edit')) {
$list_row_url = "time_condition_edit.php?id=".urlencode($row['dialplan_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "\n";
if (permission_exists('time_condition_add') || permission_exists('time_condition_edit') || permission_exists('time_condition_delete')) {
@@ -260,7 +264,7 @@
}
echo " \n";
echo " ".$row['dialplan_description']." \n";
- if (permission_exists('time_condition_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+ if (permission_exists('time_condition_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
echo " \n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " \n";
@@ -282,3 +286,4 @@
require_once "resources/footer.php";
?>
+
diff --git a/app/vars/resources/classes/vars.php b/app/vars/resources/classes/vars.php
index 3f137327d5..7018b3da36 100644
--- a/app/vars/resources/classes/vars.php
+++ b/app/vars/resources/classes/vars.php
@@ -25,7 +25,6 @@
*/
//define the vars class
-if (!class_exists('vars')) {
class vars {
/**
@@ -258,6 +257,3 @@ if (!class_exists('vars')) {
}
}
-}
-
-?>
\ No newline at end of file
diff --git a/app/vars/vars.php b/app/vars/vars.php
index d954ff394d..cc97607fa8 100644
--- a/app/vars/vars.php
+++ b/app/vars/vars.php
@@ -85,7 +85,7 @@
$order = $_GET["order"] ?? '';
//set from session variables
- $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+ $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
//get the count
$sql = "select count(var_uuid) from v_vars ";
@@ -207,7 +207,7 @@
echo th_order_by('var_hostname', $text['label-hostname'], $order_by, $order, null, "class='hide-sm-dn'");
echo th_order_by('var_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo "".$text['label-description']." \n";
- if (permission_exists('var_edit') && $list_row_edit_button == 'true') {
+ if (permission_exists('var_edit') && $list_row_edit_button) {
echo " \n";
}
echo " \n";
@@ -224,8 +224,12 @@
echo " \n";
write_header($row["var_category"]);
}
+ $list_row_url = '';
if (permission_exists('var_edit')) {
$list_row_url = "var_edit.php?id=".urlencode($row['var_uuid']);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "
\n"; // dummy row to maintain alternating background color
}
+ $list_row_url = '';
if (permission_exists('voicemail_greeting_edit')) {
$list_row_url = "voicemail_greeting_edit.php?id=".urlencode($row['voicemail_greeting_uuid'])."&voicemail_id=".urlencode($voicemail_id);
+ if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
+ }
}
echo "