From 5b1fef316ae757bbd159168fb5af654459a39a09 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 4 Dec 2015 21:09:25 +0300 Subject: [PATCH 01/20] Fix. send fax by user listed in fax server list --- app/fax/fax_send.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index b5491287a0..6307d28f68 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -58,13 +58,17 @@ if (!$included) { $fax_uuid = check_str($_REQUEST["id"]); if (if_group("superadmin") || if_group("admin")) { //show all fax extensions - $sql = "select * from v_fax "; + $sql = "select fax_uuid, fax_extension, fax_caller_id_name, fax_caller_id_number, "; + $sql .= "accountcode, fax_send_greeting "; + $sql .= "from v_fax "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and fax_uuid = '$fax_uuid' "; } else { //show only assigned fax extensions - $sql = "select * from v_fax as f, v_fax_users as u "; + $sql = "select f.fax_uuid, f.fax_extension, f.fax_caller_id_name, f.fax_caller_id_number, "; + $sql .= "f.accountcode, f.fax_send_greeting "; + $sql .= "from v_fax as f, v_fax_users as u "; $sql .= "where f.fax_uuid = u.fax_uuid "; $sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and f.fax_uuid = '$fax_uuid' "; @@ -101,7 +105,7 @@ if (!$included) { } //set the fax directory - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); + $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; // set fax cover font to generate pdf $fax_cover_font = $_SESSION['fax']['cover_font']['text']; @@ -703,6 +707,7 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ foreach ($fax_numbers as $fax_number) { $dial_string = $common_dial_string; + fax_split_dtmf($fax_number, $fax_dtmf); //prepare the fax command From 7e715879f853075d1836349f847d979db6d9c668 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 8 Dec 2015 16:16:54 +0300 Subject: [PATCH 02/20] Add. Web UI to monitor for fax queue. --- app/fax/app_config.php | 7 ++ app/fax/app_languages.php | 21 ++++ app/fax/fax.php | 3 + app/fax/fax_active.php | 136 +++++++++++++++++++++++ app/fax/fax_active_inc.php | 222 +++++++++++++++++++++++++++++++++++++ 5 files changed, 389 insertions(+) create mode 100644 app/fax/fax_active.php create mode 100644 app/fax/fax_active_inc.php diff --git a/app/fax/app_config.php b/app/fax/app_config.php index 83fe88019d..838ecf936f 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -146,6 +146,13 @@ $apps[$x]['permissions'][$y]['name'] = 'fax_file_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'fax_active_view'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'fax_active_all'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; //schema details $y = 0; //table array index diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php index 5ab3463d98..2cb1bbd38d 100644 --- a/app/fax/app_languages.php +++ b/app/fax/app_languages.php @@ -330,6 +330,17 @@ $text['label-log']['de-at'] = "Log"; $text['label-log']['ro'] = "Log"; $text['label-log']['he'] = ""; +$text['label-active']['en-us'] = "Active"; +$text['label-active']['es-cl'] = ""; +$text['label-active']['pt-pt'] = ""; +$text['label-active']['fr-fr'] = ""; +$text['label-active']['pt-br'] = ""; +$text['label-active']['pl'] = ""; +$text['label-active']['sv-se'] = ""; +$text['label-active']['de-at'] = ""; +$text['label-active']['ro'] = ""; +$text['label-active']['he'] = ""; + $text['label-location']['en-us'] = "Location"; $text['label-location']['es-cl'] = "Localización"; $text['label-location']['pt-pt'] = "Localização"; @@ -2068,4 +2079,14 @@ $text['button-add']['de-at'] = "Hinzufügen"; $text['button-add']['ro'] = "Adaugă"; $text['button-add']['he'] = "הוספה"; +$text['button-show_all']['en-us'] = "Show All"; +$text['button-show_all']['es-cl'] = "Mostrar Todos"; +$text['button-show_all']['pt-pt'] = "Mostrar Todos"; +$text['button-show_all']['fr-fr'] = "Montrer Tout"; +$text['button-show_all']['pt-br'] = "Mostrar Todos"; +$text['button-show_all']['pl'] = "Pokaż Wszystkie"; +$text['button-show_all']['uk'] = "Показати всі"; +$text['button-show_all']['de-at'] = "Alle anzeigen"; +$text['button-show_all']['he'] = ""; + ?> \ No newline at end of file diff --git a/app/fax/fax.php b/app/fax/fax.php index 81af0c8441..5fb50ed436 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -170,6 +170,9 @@ else { if (permission_exists('fax_log_view')) { echo " ".$text['label-log'].""; } + if (permission_exists('fax_active_view')) { + echo " ".$text['label-active'].""; + } echo " \n"; echo " ".$row['fax_description']." \n"; echo " "; diff --git a/app/fax/fax_active.php b/app/fax/fax_active.php new file mode 100644 index 0000000000..a70bcc8eb6 --- /dev/null +++ b/app/fax/fax_active.php @@ -0,0 +1,136 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('fax_active_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the HTTP values and set as variables + $show = trim($_REQUEST["show"]); + if ($show != "all") { $show = ''; } + +// + $fax_uuid = false; + if(isset($_REQUEST['id'])) { + $fax_uuid = check_str($_REQUEST["id"]); + } + +//show the header + $document['title'] = $text['title']; + require_once "resources/header.php"; + +//ajax for refresh + ?> + +\n"; +echo "\n"; +echo "


"; + +require_once "resources/footer.php"; + +/* +// deprecated functions for this page + + function get_park_cmd(uuid, context) { + cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml \"+context; + return escape(cmd); + } + + function get_record_cmd(uuid, prefix, name) { + cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\"; + return escape(cmd); + } +*/ +?> \ No newline at end of file diff --git a/app/fax/fax_active_inc.php b/app/fax/fax_active_inc.php new file mode 100644 index 0000000000..17bac8604b --- /dev/null +++ b/app/fax/fax_active_inc.php @@ -0,0 +1,222 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('fax_active_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +if ((!permission_exists('fax_active_all')) && ($show == 'all')) { + echo "access denied"; + exit; +} + +$fax_uuid = false; +if(isset($_REQUEST['id'])) { + $fax_uuid = check_str($_REQUEST["id"]); +} + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the HTTP values and set as variables + $show = trim($_REQUEST["show"]); + if ($show != "all") { $show = ''; } + +//include theme config for button images + include_once("themes/".$_SESSION['domain']['template']['name']."/config.php"); + +$where = 'where (1 = 1)'; + +if($show !== 'all'){ + $where .= 'and (t3.domain_name = \'' . check_str($_SESSION['domain_name']) . '\')'; +} +else if($fax_uuid){ + if(!permission_exists('fax_active_all')){ + $where .= 'and (t3.domain_name = \'' . check_str($_SESSION['domain_name']) . '\')'; + } + $where .= 'and (t1.fax_uuid =\'' . check_str($fax_uuid) . '\')'; +} + + $sql = <<prepare(check_sql($sql)); + if ($prep_statement) { + if($prep_statement->execute()) { + $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); + } + } + unset($prep_statement, $sql, $where); + +//if the connnection is available then run it and return the results + if ($result === false) { + var_dump($db->errorInfo()); + $msg = "
".$text['confirm-socket']."
"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
".$text['label-message']."
$msg
\n"; + echo "
\n"; + } + else { + //define js function call var + $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; + + //show buttons + echo ""; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo " \"".$text['label-refresh_pause']."\""; + echo " "; + if (permission_exists('fax_active_all')) { + if ($show == "all") { + echo " \n"; + } + else { + echo " \n"; + } + } + echo "
"; + + // show title + echo "".'Fax queue'.""; + echo "

\n"; + echo 'Current status of fax queue' . "\n"; + echo "

\n"; + + //set the alternating color for each row + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + + //show the results + echo "
\n"; + + //show headers + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + foreach ($result as &$row) { + $fax_uri = $row['uri']; + $domain_name = $row['domain_name']; + $task_enabled = ($row['interrupted'] == 'true') ? 'Disable': 'Enable'; + $task_status = 'Wait'; + $task_next_time = $row['next_time']; + + if($row['status'] > 0){ + if($row['status'] <= 3){ + $task_status = 'Execute'; + } + else if($row['status'] == 10){ + $task_status = 'Success'; + } + else{ + $task_status = 'Fail'; + } + } + + $fax_server = $row['fax_server_name']; + if ($show == 'all') { + $fax_server .= '@' . $domain_name; + } + + $task_files = ''; + if(!empty($row['fax_file'])){ + $task_files .= ' ' . basename($row['fax_file']); + } + if(!empty($row['wav_file'])){ + $task_files .= '
 ' . basename($row['wav_file']); + } else if(!empty($row['greeting'])){ + $task_files .= '
 ' . basename($row['greeting']); + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + $c = ($c) ? 0 : 1; + } + + echo "\n"; + echo "\n"; + echo "
". 'Fax' . "". 'Enabled' . "". 'Status' . "". 'Next time' . "". 'Files' . "". 'URI' . "
" . $fax_server . " " . $task_enabled . " " . $task_status . " " . $task_next_time . " " . $task_files . " " . $fax_uri . " ".$v_link_label_delete."
\n"; + } +?> \ No newline at end of file From 66d0f060cebdd1120ccdacdee817a10e6c91bdd7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 8 Dec 2015 16:42:13 +0300 Subject: [PATCH 03/20] Add. Ability to delete fax queue element --- app/fax/fax_active.php | 2 +- app/fax/fax_active_exec.php | 74 +++++++++++++++++++++++++++++++++++++ app/fax/fax_active_inc.php | 2 +- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 app/fax/fax_active_exec.php diff --git a/app/fax/fax_active.php b/app/fax/fax_active.php index a70bcc8eb6..4729e91ab8 100644 --- a/app/fax/fax_active.php +++ b/app/fax/fax_active.php @@ -95,7 +95,7 @@ else { //call controls function hangup(uuid) { if (confirm("")) { - send_cmd('fax_active_exec.php?cmd=uuid_kill%20'+uuid); + send_cmd('fax_active_exec.php?cmd=delete&id='+uuid); } } diff --git a/app/fax/fax_active_exec.php b/app/fax/fax_active_exec.php new file mode 100644 index 0000000000..24b38ac2d0 --- /dev/null +++ b/app/fax/fax_active_exec.php @@ -0,0 +1,74 @@ +0) { + $cmd = trim(check_str($_GET['cmd'])); + $fax_uuid = trim(check_str($_GET['id'])); + } + +//authorized commands + if ($cmd == 'delete') { + //authorized; + } else { + //not found. this command is not authorized + echo "access denied"; + exit; + } + +//Command + if ($cmd == 'delete') { + if($fax_uuid){ + $sql = <<exec($sql); + // if($result === false){ + // var_dump($db->errorInfo()); + // } + } + } +?> \ No newline at end of file diff --git a/app/fax/fax_active_inc.php b/app/fax/fax_active_inc.php index 17bac8604b..b8b791c5eb 100644 --- a/app/fax/fax_active_inc.php +++ b/app/fax/fax_active_inc.php @@ -210,7 +210,7 @@ HERE; echo "" . $task_files . " \n"; echo "" . $fax_uri . " \n"; - echo "".$v_link_label_delete."\n"; + echo "".$v_link_label_delete."\n"; echo "\n"; $c = ($c) ? 0 : 1; } From 7a45e14c8cb9302d42430ef804babfbdfe822da4 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 12:43:40 +0300 Subject: [PATCH 04/20] Add. mail templates for fax server responses. --- .../install/scripts/app/fax/app_languages.lua | 9 +++ .../app/fax/resources/scripts/queue/next.lua | 31 +++++--- .../app/fax/resources/scripts/queue/retry.lua | 73 ++++++++++++++----- .../app/fax/resources/scripts/queue/tasks.lua | 61 +++++++++++++++- .../templates/en/us/outbound/fail/body.tpl | 51 +++++++++++++ .../templates/en/us/outbound/fail/subject.tpl | 1 + .../templates/en/us/outbound/success/body.tpl | 51 +++++++++++++ .../en/us/outbound/success/subject.tpl | 1 + .../resources/functions/file_exists.lua | 6 +- 9 files changed, 249 insertions(+), 35 deletions(-) create mode 100644 resources/install/scripts/app/fax/app_languages.lua create mode 100644 resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/body.tpl create mode 100644 resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/subject.tpl create mode 100644 resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/body.tpl create mode 100644 resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/subject.tpl diff --git a/resources/install/scripts/app/fax/app_languages.lua b/resources/install/scripts/app/fax/app_languages.lua new file mode 100644 index 0000000000..7983512b77 --- /dev/null +++ b/resources/install/scripts/app/fax/app_languages.lua @@ -0,0 +1,9 @@ +text = text or {}; + +text['message-send_success'] = {} +text['message-send_success']['en-us'] = "We are happy to report the fax was sent successfully. It has been attached for your records." + +text['message-send_fail'] = {} +text['message-send_fail']['en-us'] = "We are sorry the fax failed to go through. It has been attached. Please check the number, and if it was correct you might consider emailing it instead." + +return text \ No newline at end of file diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/next.lua b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua index 4780867a1d..874171cca7 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/next.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua @@ -1,6 +1,7 @@ require "resources.functions.config" require "resources.functions.sleep" +require "resources.functions.file_exists" local log = require "resources.functions.log".next_fax_task local Tasks = require "app.fax.resources.scripts.queue.tasks" local Esl = require "resources.functions.esl" @@ -13,17 +14,27 @@ local FAX_OPTIONS = { "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false"; } -local function task_send_mail(task) +local function task_send_mail(task, err) local number_dialed = task.uri:match("/([^/]-)%s*$") - Tasks.send_mail_task(task, { - "Fax to: " .. number_dialed .. " FAILED", - table.concat{ - "We are sorry the fax failed to go through. ", - "It has been attached. Please check the number " .. number_dialed .. ", ", - "and if it was correct you might consider emailing it instead.", - }} - ) + local Text = require "resources.functions.text" + local text = Text.new("app.fax.app_languages") + + local env = { + destination_number = number_dialed:match("^([^@]*)"); + hangup_cause = err; + message = text['message-send_fail']; + } + + local body = Tasks.build_template(task, 'outbound/fail/body', env) + local subject = Tasks.build_template(task, 'outbound/fail/subject', env) + + if not subject then + log.warning("Can not find template for email") + subject = "Fax to: " .. number_dialed .. " FAILED" + end + + Tasks.send_mail_task(task, {subject, body}, nil, file_exists(task.fax_file)) end local function next_task() @@ -56,7 +67,7 @@ local function next_task() Tasks.wait_task(task, false, info) if task.status ~= 0 then Tasks.remove_task(task) - task_send_mail(task) + task_send_mail(task, tostring(info)) end log.noticef('Can not originate to `%s` cause: %s: %s ', task.uri, tostring(status), tostring(info)) else diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua index 1d634ea725..3cc20dbf43 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua @@ -1,8 +1,7 @@ -- include libraries require "resources.functions.config"; - require "resources.functions.explode"; require "resources.functions.split"; - require "resources.functions.count"; + require "resources.functions.file_exists"; local log = require "resources.functions.log".fax_retry local Database = require "resources.functions.database" @@ -28,6 +27,10 @@ local dbh = Database.new('system') +-- Global environment + default_language = env:getHeader("default_language") + default_dialect = env:getHeader("default_dialect") + -- Channel/FusionPBX variables local uuid = env:getHeader("uuid") local fax_queue_task_session = env:getHeader('fax_queue_task_session') @@ -312,18 +315,32 @@ --Success log.infof("RETRY STATS SUCCESS: GATEWAY[%s]", fax_options); + Tasks.remove_task(task) + + local Text = require "resources.functions.text" + local text = Text.new("app.fax.app_languages") + + local env = { + fax_options = fax_options; + destination_number = number_dialed:match("^([^@]*)"); + document_transferred_pages = fax_document_transferred_pages; + document_total_pages = fax_document_total_pages; + message = text['message-send_success']; + } + + local body = Tasks.build_template(task, 'outbound/success/body', env) + local subject = Tasks.build_template(task, 'outbound/success/subject', env) + + if not subject then + log.warning("Can not find template for email") + subject = "Fax to: " .. number_dialed .. " SENT" + end + + Tasks.send_mail_task(task, {subject, body}, uuid, file_exists(fax_file)) + if keep_local == "false" then os.remove(fax_file); end - - Tasks.remove_task(task) - Tasks.send_mail_task(task, { - "Fax to: " .. number_dialed .. " SENT", - table.concat{ - "We are happy to report the fax was sent successfully.", - "It has been attached for your records.", - }}, uuid - ) end if fax_success ~= "1" then @@ -345,14 +362,32 @@ Tasks.wait_task(task, answered, hangup_cause_q850) if task.status ~= 0 then Tasks.remove_task(task) - Tasks.send_mail_task(task, { - "Fax to: " .. number_dialed .. " FAILED", - table.concat{ - "We are sorry the fax failed to go through. ", - "It has been attached. Please check the number "..number_dialed..", ", - "and if it was correct you might consider emailing it instead.", - }}, uuid - ) + + local Text = require "resources.functions.text" + local text = Text.new("app.fax.app_languages") + + local env = { + fax_options = fax_options; + destination_number = number_dialed:match("^([^@]*)"); + document_transferred_pages = fax_document_transferred_pages; + document_total_pages = fax_document_total_pages; + hangup_cause = hangup_cause; + hangup_cause_q850 = hangup_cause_q850; + fax_result_code = fax_result_code; + fax_result_text = fax_result_text; + message = text['message-send_fail']; + } + + local body = Tasks.build_template(task, 'outbound/fail/body', env) + local subject = Tasks.build_template(task, 'outbound/fail/subject', env) + + if not subject then + log.warning("Can not find template for email") + subject = "Fax to: " .. number_dialed .. " FAILED" + end + + Tasks.send_mail_task(task, {subject, body}, uuid, file_exists(fax_file)) + end end end diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua index e6ba83835f..33cd5c0f89 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua @@ -203,8 +203,6 @@ local function wait_task(task, answered, q850) task.uuid ) - print(sql) - local ok, err = db:query( sql ) if not ok then return nil, err end @@ -245,7 +243,7 @@ local function cleanup_tasks() db:query(remove_finished_tasks_sql) end -local function send_mail_task(task, message, call_uuid) +local function send_mail_task(task, message, call_uuid, file) if not task.reply_address or #task.reply_address == 0 then return end @@ -257,7 +255,61 @@ local function send_mail_task(task, message, call_uuid) ["X-FusionPBX-Email-Type"] = 'email2fax'; } - return send_mail(mail_x_headers, task.reply_address, message) + return send_mail(mail_x_headers, task.reply_address, message, file) +end + +local function read_file(name, mode) + local f, err, code = io.open(name, mode or 'rb') + if not f then return nil, err, code end + local data = f:read("*all") + f:close() + return data +end + +local function read_template(app, name, lang) + local default_language_path = 'en/us' + + local full_path_tpl = scripts_dir .. '/app/' .. app .. '/resources/templates/{lang}/' .. name .. '.tpl' + + local path + + if lang then + path = file_exists((full_path_tpl:gsub('{lang}', lang))) + end + + if (not path) and (lang ~= default_language_path) then + path = file_exists((full_path_tpl:gsub('{lang}', default_language_path))) + end + + if path then + return read_file(path) + end +end + +local function build_template(task, templ, env) + local lang + + if default_language and default_dialect then + lang = (default_language .. '/' .. default_dialect):lower() + else + local settings = Settings.new(dbh or 'system', task.domain_name, task.domain_uuid) + lang = settings:get('domain', 'language', 'code') + if lang then lang = lang:gsub('%-', '/'):lower() end + end + + local body = read_template('fax', templ, lang) + + body = body:gsub("[^\\](${.-})", function(name) + name = name:sub(3, -2) + if type(env) == 'table' then + return env[name] or '' + end + if type(env) == 'function' then + return env(name) or '' + end + end) + + return body end return { @@ -274,4 +326,5 @@ return { release_task = release_task; cleanup_tasks = cleanup_tasks; send_mail_task = send_mail_task; + build_template = build_template; } diff --git a/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/body.tpl b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/body.tpl new file mode 100644 index 0000000000..0a74af6208 --- /dev/null +++ b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/body.tpl @@ -0,0 +1,51 @@ + + + + + + + + +
+ Send fax fail +
+ + + + + + + + + + + + + + + + + +
+ To + + ${destination_number} +
+ Pages + + ${document_transferred_pages}/${document_total_pages} +
+ Message + + ${message} +
+ Error + + ${hangup_cause}/${fax_result_code}/${fax_result_text} +
+
+ \ No newline at end of file diff --git a/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/subject.tpl b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/subject.tpl new file mode 100644 index 0000000000..0b4efa53ac --- /dev/null +++ b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/fail/subject.tpl @@ -0,0 +1 @@ +Fax to: ${destination_number} FAILED \ No newline at end of file diff --git a/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/body.tpl b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/body.tpl new file mode 100644 index 0000000000..073e4c6db6 --- /dev/null +++ b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/body.tpl @@ -0,0 +1,51 @@ + + + + + + + + +
+ Send fax successfully +
+ + + + + + + + + + + + + + + + + +
+ To + + ${destination_number} +
+ Pages + + ${document_transferred_pages} +
+ Message + + ${message} +
+ Options + + ${fax_options} +
+
+ \ No newline at end of file diff --git a/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/subject.tpl b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/subject.tpl new file mode 100644 index 0000000000..a1e835ddd1 --- /dev/null +++ b/resources/install/scripts/app/fax/resources/templates/en/us/outbound/success/subject.tpl @@ -0,0 +1 @@ +Fax to: ${destination_number} sent \ No newline at end of file diff --git a/resources/install/scripts/resources/functions/file_exists.lua b/resources/install/scripts/resources/functions/file_exists.lua index 76a31c5126..aece58bd5f 100644 --- a/resources/install/scripts/resources/functions/file_exists.lua +++ b/resources/install/scripts/resources/functions/file_exists.lua @@ -1,6 +1,8 @@ --check if a file exists function file_exists(name) - local f=io.open(name,"r") - if f~=nil then io.close(f) return true else return false end + local f = io.open(name, "r") + if not f then return end + f:close() + return name end \ No newline at end of file From df8da0f5ce324865bfd4a2d75d95855dec7b59b0 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 13:00:42 +0300 Subject: [PATCH 05/20] Change. `Send` button redirect to `Active` page. --- app/fax/fax_send.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 1d016b4171..35b17e5a2b 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -768,7 +768,12 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ if (!$included) { //redirect the browser $_SESSION["message"] = $response; - header("Location: fax_files.php?id=".$fax_uuid."&box=sent"); + if (permission_exists('fax_active_view')) { + header("Location: fax_active.php?id=".$fax_uuid); + } + else { + header("Location: fax_files.php?id=".$fax_uuid."&box=sent"); + } exit; } From ace38f5a6ace47f1ff393a31ed2ee8d2c481f0b2 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 13:21:37 +0300 Subject: [PATCH 06/20] Add. Allows select greeting. --- app/fax/fax_edit.php | 103 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 8a23a3cf4c..83fabbae3d 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -686,7 +686,108 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['label-fax_send_greeting']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (permission_exists('fax_extension_add') || permission_exists('fax_extension_edit')) { + echo "\n"; + echo "\n"; + } + echo " \n"; echo "
\n"; echo " ".$text['description-fax_send_greeting']."\n"; echo "\n"; From b638967f0157b076507a5d6a13fcb281d4fdf9df Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 13:37:32 +0300 Subject: [PATCH 07/20] Fix. Use `Test` interface to translate UI. --- app/fax/app_languages.php | 24 ++++++++++++++++++++++++ app/fax/fax_active_inc.php | 26 +++++++++++++------------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php index 2cb1bbd38d..3531c78fec 100644 --- a/app/fax/app_languages.php +++ b/app/fax/app_languages.php @@ -2089,4 +2089,28 @@ $text['button-show_all']['uk'] = "Показати всі"; $text['button-show_all']['de-at'] = "Alle anzeigen"; $text['button-show_all']['he'] = ""; +$text['fax-active_title']['en-us'] = "Fax queue"; + +$text['fax-active_description']['en-us'] = "Current status of fax queue"; + +$text['fax-active_title_fax_server']['en-us'] = "Fax"; + +$text['fax-active_title_enabled']['en-us'] = "Enabled"; + +$text['fax-active_title_status']['en-us'] = "Status"; + +$text['fax-active_title_next_time']['en-us'] = "Next time"; + +$text['fax-active_title_files']['en-us'] = "Files"; + +$text['fax-active_title_uri']['en-us'] = "URI"; + +$text['fax-active_status_wait']['en-us'] = "Wait"; + +$text['fax-active_status_execute']['en-us'] = "Execute"; + +$text['fax-active_status_success']['en-us'] = "Success"; + +$text['fax-active_status_fail']['en-us'] = "Fail"; + ?> \ No newline at end of file diff --git a/app/fax/fax_active_inc.php b/app/fax/fax_active_inc.php index b8b791c5eb..9e13e1cc6a 100644 --- a/app/fax/fax_active_inc.php +++ b/app/fax/fax_active_inc.php @@ -106,7 +106,7 @@ HERE; //if the connnection is available then run it and return the results if ($result === false) { var_dump($db->errorInfo()); - $msg = "
".$text['confirm-socket']."
"; + $msg = "
".$text['message-fail']."
"; echo "
\n"; echo "\n"; echo "\n"; @@ -142,9 +142,9 @@ HERE; echo "
"; // show title - echo "".'Fax queue'.""; + echo "".$text['fax-active_title'].""; echo "

\n"; - echo 'Current status of fax queue' . "\n"; + echo $text['fax-active_description']."\n"; echo "

\n"; //set the alternating color for each row @@ -158,12 +158,12 @@ HERE; //show headers echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -172,18 +172,18 @@ HERE; $fax_uri = $row['uri']; $domain_name = $row['domain_name']; $task_enabled = ($row['interrupted'] == 'true') ? 'Disable': 'Enable'; - $task_status = 'Wait'; + $task_status = $text['fax-active_status_wait']; $task_next_time = $row['next_time']; if($row['status'] > 0){ if($row['status'] <= 3){ - $task_status = 'Execute'; + $task_status = $text['fax-active_status_execute']; } else if($row['status'] == 10){ - $task_status = 'Success'; + $task_status = $text['fax-active_status_success']; } else{ - $task_status = 'Fail'; + $task_status = $text['fax-active_status_fail']; } } From ed781fc8c3d3323155af982a8dca4afc10eb2be9 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 13:51:25 +0300 Subject: [PATCH 08/20] Fix. forgotten images. --- app/fax/resources/images/refresh_active.gif | Bin 0 -> 1079 bytes app/fax/resources/images/refresh_paused.png | Bin 0 -> 501 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/fax/resources/images/refresh_active.gif create mode 100644 app/fax/resources/images/refresh_paused.png diff --git a/app/fax/resources/images/refresh_active.gif b/app/fax/resources/images/refresh_active.gif new file mode 100644 index 0000000000000000000000000000000000000000..305457831c3f47939d634650660e859f50f18224 GIT binary patch literal 1079 zcmZ?wbhEHb6krfw_{_lY|NsA0U~uKimGkG%KYaM`#fum3-o5+$`SYz?x4wP*cIM0( z1|*>PpWDwhB-q(8z|~04fSC~}rT9$q3n zO>tew&yZDRa$!Y@S0^yIF#{CID4C^TqZC^&!;E6k-dQ&1{8}lV<;)-2jBdSFW47#` z1vIJ`t5L{)gBT?kmRz|^`|7L}S{*99_jCT;vIy5ToB7wlqaU~5kYZS7nL_(UfrqBk z(zDj8X?3K$2`jK(z145C(S#4nG^P4aV2xolq_Ej0;4GAuT$!{|vttSOYJI8o;oR@$ zJ^Oz^L6r$xSRh*s)EXo~qSeR&uoa}AU5JbTK#mcJDN5wV2$E5AwtyYvL~c4k^4lFJ R9?wLX4uT2S8kB9p001&weI)<@ literal 0 HcmV?d00001 diff --git a/app/fax/resources/images/refresh_paused.png b/app/fax/resources/images/refresh_paused.png new file mode 100644 index 0000000000000000000000000000000000000000..38937ec1f222094efb05cd3d3c634f752f84deb2 GIT binary patch literal 501 zcmVwBx2>F4R;%NMVn_aJxg_miiOUzd`-l3gn!7VkA&I7c*+DB!%r3QpAguz80Ve)s0dLW`~5+e4hT7Q6`Q>6PhY?hE(21}udC6bM0N(*gquPL7X19qhk(2T)25%jM!% r*LBxEygxiz%}l?3`LprpRloCJ0R6KCvd?rv00000NkvXXu0mjfpda3S literal 0 HcmV?d00001 From 92ea882398d4dc01619392de2f7beae4e37d4df2 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 9 Dec 2015 14:56:02 +0300 Subject: [PATCH 09/20] Fix. Use task db connection to build template. --- .../install/scripts/app/fax/resources/scripts/queue/tasks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua index 33cd5c0f89..6e78bffccb 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua @@ -292,7 +292,7 @@ local function build_template(task, templ, env) if default_language and default_dialect then lang = (default_language .. '/' .. default_dialect):lower() else - local settings = Settings.new(dbh or 'system', task.domain_name, task.domain_uuid) + local settings = Settings.new(get_db(), task.domain_name, task.domain_uuid) lang = settings:get('domain', 'language', 'code') if lang then lang = lang:gsub('%-', '/'):lower() end end From c092ebacd2e826ae14531e9e3ab273936056570d Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 13:59:15 -0800 Subject: [PATCH 10/20] Update 010_user_exists.xml --- .../resources/switch/conf/dialplan/010_user_exists.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/010_user_exists.xml b/app/dialplan/resources/switch/conf/dialplan/010_user_exists.xml index 8353c4aafb..2e3ea279df 100644 --- a/app/dialplan/resources/switch/conf/dialplan/010_user_exists.xml +++ b/app/dialplan/resources/switch/conf/dialplan/010_user_exists.xml @@ -12,6 +12,8 @@ + + @@ -19,4 +21,4 @@ - \ No newline at end of file + From 9a1d6505329a9e5c19832b91bffb30faeda2f3ab Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 13:59:43 -0800 Subject: [PATCH 11/20] Update app_config.php --- app/extensions/app_config.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 77a68de9ea..292d76fb3a 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -366,6 +366,14 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_user_not_registered_destination"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_user_not_registered_enabled"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; From 203d868429250ea68af1287e568eb729920c8c9c Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:00:13 -0800 Subject: [PATCH 12/20] Update app_languages.php --- app/calls/app_languages.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/calls/app_languages.php b/app/calls/app_languages.php index d475fee621..555de349e7 100644 --- a/app/calls/app_languages.php +++ b/app/calls/app_languages.php @@ -122,6 +122,17 @@ $text['label-no_answer']['sv-se'] = "Inget Svar "; $text['label-no_answer']['uk'] = "Без відповіді"; $text['label-no_answer']['de-at'] = "Keine Antwort"; +$text['label-not_registered']['en-us'] = "Not Registered"; +$text['label-not_registered']['es-cl'] = ""; +$text['label-not_registered']['pt-pt'] = ""; +$text['label-not_registered']['fr-fr'] = ""; +$text['label-not_registered']['it-it'] = ""; +$text['label-not_registered']['pt-br'] = ""; +$text['label-not_registered']['pl'] = ""; +$text['label-not_registered']['sv-se'] = ""; +$text['label-not_registered']['uk'] = ""; +$text['label-not_registered']['de-at'] = ""; + $text['label-ignore-busy']['en-us'] = "Ignore Busy"; $text['label-ignore-busy']['es-cl'] = ""; $text['label-ignore-busy']['pt-pt'] = ""; @@ -335,6 +346,17 @@ $text['description-no_answer']['sv-se'] = "Om aktiverad, så tar den överhand f $text['description-no_answer']['uk'] = ""; $text['description-no_answer']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben"; +$text['description-not_registered']['en-us'] = "If endpoint is not reachable, forward to this destination before going to voicemail."; +$text['description-not_registered']['es-cl'] = ""; +$text['description-not_registered']['pt-pt'] = ""; +$text['description-not_registered']['fr-fr'] = ""; +$text['description-not_registered']['it-it'] = ""; +$text['description-not_registered']['pt-br'] = ""; +$text['description-not_registered']['pl'] = ""; +$text['description-not_registered']['sv-se'] = ""; +$text['description-not_registered']['uk'] = ""; +$text['description-not_registered']['de-at'] = ""; + $text['description-cid-number-prefix']['en-us'] = "Set the caller ID number prefix."; $text['description-cid-number-prefix']['es-cl'] = "Configure el prefijo de número de caller ID."; $text['description-cid-number-prefix']['pt-pt'] = "Defina o número do Chamador"; @@ -493,4 +515,4 @@ $text['button-back']['sv-se'] = "Tillbaka "; $text['button-back']['uk'] = "Назад"; $text['button-back']['de-at'] = "Zurück"; -?> \ No newline at end of file +?> From 0f718c8d08fd21866a5a5b92195bc1f4bde46fee Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:00:44 -0800 Subject: [PATCH 13/20] Update call_edit.php --- app/calls/call_edit.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 2834914f0c..f0ce961c96 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -102,6 +102,8 @@ else { $forward_busy_enabled = $row["forward_busy_enabled"]; $forward_no_answer_destination = $row["forward_no_answer_destination"]; $forward_no_answer_enabled = $row["forward_no_answer_enabled"]; + $forward_user_not_registered_destination = $row["forward_user_not_registered_destination"]; + $forward_user_not_registered_enabled = $row["forward_user_not_registered_enabled"]; $follow_me_uuid = $row["follow_me_uuid"]; $forward_caller_id_uuid = $row["forward_caller_id_uuid"]; break; //limit to 1 row @@ -122,6 +124,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $forward_busy_destination = check_str($_POST["forward_busy_destination"]); $forward_no_answer_enabled = check_str($_POST["forward_no_answer_enabled"]); $forward_no_answer_destination = check_str($_POST["forward_no_answer_destination"]); + $forward_user_not_registered_destination = check_str($_POST["forward_user_not_registered_destination"]); + $forward_user_not_registered_enabled = check_str($_POST["forward_user_not_registered_enabled"]); $forward_caller_id_uuid = check_str($_POST["forward_caller_id_uuid"]); $cid_name_prefix = check_str($_POST["cid_name_prefix"]); $cid_number_prefix = check_str($_POST["cid_number_prefix"]); @@ -371,6 +375,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "forward_busy_enabled = '".$forward_busy_enabled."', "; $sql .= "forward_no_answer_destination = '".$forward_no_answer_destination."', "; $sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."', "; + $sql .= "forward_user_not_registered_destination = '".$forward_user_not_registered_destination."', "; + $sql .= "forward_user_not_registered_enabled = '".$forward_user_not_registered_enabled."', "; $sql .= "forward_caller_id_uuid = ".(($forward_caller_id_uuid != '') ? "'".$forward_caller_id_uuid."' " : "null "); $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and extension_uuid = '".$extension_uuid."'"; @@ -596,6 +602,24 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; +//CJB + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +//CJB + echo "\n"; echo "\n"; @@ -833,4 +857,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> From 492ea214459436b2ae2ae12cdc2b14d60a9c4fe1 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:01:35 -0800 Subject: [PATCH 14/20] Update devices.php --- app/devices/devices.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/devices/devices.php b/app/devices/devices.php index cc466bc5b8..b119f1b06e 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -99,7 +99,11 @@ else { //prepare to page the results $rows_per_page = 150; - $param = ""; + if ($_GET['showall'] && permission_exists('device_all')) { + $param = "&showall=true"; + } else { + $param = ""; + } $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); @@ -271,4 +275,4 @@ else { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> From dca392fcc5b6cb06cb70058f1770173d4f516f4f Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:03:17 -0800 Subject: [PATCH 15/20] Update directory.lua --- .../resources/scripts/directory/directory.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 325a2685e5..88ec1808ca 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -251,6 +251,9 @@ forward_busy_destination = row.forward_busy_destination; forward_no_answer_enabled = row.forward_no_answer_enabled; forward_no_answer_destination = row.forward_no_answer_destination; + forward_user_not_registered_enabled = row.forward_user_not_registered_enabled; + forward_user_not_registered_destination = row.forward_user_not_registered_destination; + do_not_disturb = row.do_not_disturb; --set the dial_string @@ -477,6 +480,13 @@ if (string.len(forward_no_answer_destination) > 0) then table.insert(xml, [[ ]]); end + if (string.len(forward_user_not_registered_enabled) > 0) then + table.insert(xml, [[ ]]); + end + if (string.len(forward_user_not_registered_destination) > 0) then + table.insert(xml, [[ ]]); + end + if (string.len(do_not_disturb) > 0) then table.insert(xml, [[ ]]); end From 52bd6a10293ca6d416b2af25a0d55d90d8fd624f Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:04:26 -0800 Subject: [PATCH 16/20] Update extension.php --- app/extensions/resources/classes/extension.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 78f09074ed..63861d9067 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -382,6 +382,13 @@ if (strlen($row['forward_no_answer_destination']) > 0) { $xml .= " \n"; } + if (strlen($row['forward_user_not_registered_enabled']) > 0) { + $xml .= " \n"; + } + if (strlen($row['forward_user_not_registered_destination']) > 0) { + $xml .= " \n"; + } + if (strlen($row['do_not_disturb']) > 0) { $xml .= " \n"; } From 8d072ae13fb92b7d0b1a7c532fdc57e42da0f1be Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:04:59 -0800 Subject: [PATCH 17/20] Update index.lua --- .../scripts/app/failure_handler/index.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/app/failure_handler/index.lua b/resources/install/scripts/app/failure_handler/index.lua index 72410b3ddf..31883bd231 100644 --- a/resources/install/scripts/app/failure_handler/index.lua +++ b/resources/install/scripts/app/failure_handler/index.lua @@ -188,8 +188,25 @@ end elseif (originate_disposition == "USER_NOT_REGISTERED") then + + --handle USER_NOT_REGISTERED + forward_user_not_registered_enabled = session:getVariable("forward_user_not_registered_enabled"); + if (forward_user_not_registered_enabled == "true") then + forward_user_not_registered_destination = session:getVariable("forward_user_not_registered_destination"); + if (forward_user_not_registered_destination == nil) then + freeswitch.consoleLog("NOTICE", "[failure_handler] forwarding user not registered to hangup\n"); + session:hangup("NO_ANSWER"); + else + freeswitch.consoleLog("NOTICE", "[failure_handler] forwarding user not registerd to: " .. forward_user_not_registered_destination .. "\n"); + session:transfer(forward_user_not_registered_destination, "XML", context); + end + else + --send missed call notification + missed(); + end + --send missed call notification - missed(); + --missed(); --handle USER_NOT_REGISTERED if (debug["info"] ) then From de8d05bad448cda4a3267e6171db96d3412bd8c2 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:07:58 -0800 Subject: [PATCH 18/20] Update app_languages.php --- app/xml_cdr/app_languages.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/xml_cdr/app_languages.php b/app/xml_cdr/app_languages.php index 6e7dad1774..4041b12921 100644 --- a/app/xml_cdr/app_languages.php +++ b/app/xml_cdr/app_languages.php @@ -615,6 +615,17 @@ $text['label-network_addr']['uk'] = ""; $text['label-network_addr']['de-at'] = "Netzwerk Adresse"; $text['label-network_addr']['he'] = "כתובת רשת"; +$text['label-mos_score']['en-us'] = "MOS Score"; +$text['label-mos_score']['es-cl'] = ""; +$text['label-mos_score']['pt-pt'] = ""; +$text['label-mos_score']['fr-fr'] = ""; +$text['label-mos_score']['pt-br'] = ""; +$text['label-mos_score']['pl'] = ""; +$text['label-mos_score']['sv-se'] = ""; +$text['label-mos_score']['uk'] = ""; +$text['label-mos_score']['de-at'] = ""; +$text['label-mos_score']['he'] = ""; + $text['label-name']['en-us'] = "Name"; $text['label-name']['es-cl'] = "Nombre"; $text['label-name']['pt-pt'] = "Nome"; @@ -1362,4 +1373,4 @@ $text['button-advanced_search']['uk'] = ""; $text['button-advanced_search']['de-at'] = "Erweiterte Suche"; $text['button-advanced_search']['he'] = "חיפוש מתקדם"; -?> \ No newline at end of file +?> From 9d437340b6dcca8b0e47557e47cc779e5c65f0b6 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:08:33 -0800 Subject: [PATCH 19/20] Update xml_cdr_inc.php --- app/xml_cdr/xml_cdr_inc.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index 911c94f92c..2fc5daf1f8 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -74,8 +74,36 @@ else { $bridge_uuid = check_str($_REQUEST["network_addr"]); $order_by = check_str($_REQUEST["order_by"]); $order = check_str($_REQUEST["order"]); + if (strlen(check_str($_REQUEST["mos_comparison"])) > 0) { + switch(check_str($_REQUEST["mos_comparison"])) { + case 'less': + $mos_comparison = "<"; + break; + case 'greater': + $mos_comparison = ">"; + break; + case 'lessorequal': + $mos_comparison = "<="; + break; + case 'greaterorequal': + $mos_comparison = ">="; + break; + case 'equal': + $mos_comparison = "<"; + break; + case 'notequal': + $mos_comparison = "<>"; + break; + } + } else { + $mos_comparison = ''; + } + //$mos_comparison = check_str($_REQUEST["mos_comparison"]); + $mos_score = check_str($_REQUEST["mos_score"]); } + + //build the sql where string if ($missed == true) { $sql_where_ands[] = "billsec = '0'"; @@ -126,6 +154,7 @@ else { if (strlen($write_codec) > 0) { $sql_where_ands[] = "write_codec like '%".$write_codec."%'"; } if (strlen($remote_media_ip) > 0) { $sql_where_ands[] = "remote_media_ip like '%".$remote_media_ip."%'"; } if (strlen($network_addr) > 0) { $sql_where_ands[] = "network_addr like '%".$network_addr."%'"; } + if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) { $sql_where_ands[] = "rtp_audio_in_mos " . $mos_comparison . " ".$mos_score.""; } //if not admin or superadmin, only show own calls if (!permission_exists('xml_cdr_domain')) { @@ -201,6 +230,9 @@ else { $param .= "&remote_media_ip=".$remote_media_ip; $param .= "&network_addr=".$network_addr; $param .= "&bridge_uuid=".$bridge_uuid; + $param .= "&mos_comparison=".$mos_comparison; + $param .= "&mos_score=".$mos_score; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { $param .= "&showall=" . $_GET['showall']; } @@ -297,6 +329,7 @@ else { else { $sql .= " limit ".$rows_per_page." offset ".$offset." "; } + $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); From 4072e8bbfebd1aa388c6a32813a2d800c19a8946 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Wed, 9 Dec 2015 14:09:12 -0800 Subject: [PATCH 20/20] Update xml_cdr_search.php --- app/xml_cdr/xml_cdr_search.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php index e61e247ed8..50c6e809f8 100644 --- a/app/xml_cdr/xml_cdr_search.php +++ b/app/xml_cdr/xml_cdr_search.php @@ -53,7 +53,7 @@ echo " if ($('#caller_id_number').is(':visible')) { $('#caller_id_number').foc echo " }"; echo " }"; echo ""; - + echo "
\n"; echo "
". 'Fax' . "". 'Enabled' . "". 'Status' . "". 'Next time' . "". 'Files' . "". 'URI' . "" . $text['fax-active_title_fax_server'] . "" . $text['fax-active_title_enabled'] . "" . $text['fax-active_title_status'] . "" . $text['fax-active_title_next_time'] . "" . $text['fax-active_title_files'] . "" . $text['fax-active_title_uri'] . "
\n"; + echo " ".$text['label-not_registered']."\n"; + echo "\n"; + $on_click = "document.getElementById('dnd_disabled').checked=true;"; + $on_click .= "document.getElementById('forward_user_not_registered_destination').focus();"; + echo " \n"; + echo " \n"; + unset($on_click); + echo "   "; + echo " \n"; + echo "
".$text['description-not_registered'].".\n"; + echo "

\n"; @@ -203,6 +203,20 @@ echo " "; echo " "; echo " "; echo " "; +echo " "; +echo " "; +echo " "; +echo " "; echo " "; echo " "; echo "
".$text['label-network_addr']."
".$text['label-mos_score'].""; +echo " \n"; +echo "

";