From ebb61f955c38a0de48a558e3fa06ba02a08c9351 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 10 Sep 2015 14:23:11 +0400 Subject: [PATCH 01/14] Add. database class ```Lua local Database = require "resources.functions.database" local dbh = Database.new('system') --get the domain_uuid if (domain_uuid == nil) and (domain_name ~= nil) then local sql = "SELECT domain_uuid FROM v_domains " sql = sql .. "WHERE domain_name='" .. domain_name .. "';" domain_uuid = dbh:first_value(sql) end local dbh_switch = Database.new('switch') -- check also SQLite file. local row = dbh_switch:first_row(sql) if row then ... end ``` --- .../scripts/resources/functions/database.lua | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 resources/install/scripts/resources/functions/database.lua diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua new file mode 100644 index 0000000000..a8f7f662c6 --- /dev/null +++ b/resources/install/scripts/resources/functions/database.lua @@ -0,0 +1,107 @@ +require 'resources.config' +require 'resources.functions.database_handle' + +local unpack = unpack or table.unpack + +local Database = {} do + +Database.__index = Database + +function Database.new(name) + local dbh = assert(name) + if type(name) == 'string' then + if name == 'switch' and file_exists(database_dir.."/core.db") then + dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db") + else + dbh = database_handle(name) + end + end + assert(dbh:connected()) + + local self = setmetatable({ + _dbh = dbh; + }, Database) + + return self +end + +function Database:query(sql, fn) + return self._dbh:query(sql, fn) +end + +function Database:first_row(sql) + local result + local ok, err = self:query(sql, function(row) + result = row + return 1 + end) + if not ok then return nil, err end + return result +end + +function Database:first_value(sql) + local result, err = self:first_row(sql) + if not result then return nil, err end + local k, v = next(result) + return v +end + +function Database:first(sql, ...) + local result, err = self:first_row(sql) + if not result then return nil, err end + local t, n = {}, select('#', ...) + for i = 1, n do + t[i] = result[(select(i, ...))] + end + return unpack(t, 1, n) +end + +function Database:fetch_all(sql) + local result = {} + local ok, err = self:query(sql, function(row) + result[#result + 1] = row + end) + if not ok then return nil, err end + return result +end + +function Database:release(sql) + if self._dbh then + self._dbh:release() + self._dbh = nil + end +end + +function Database:connected(sql) + return self._dbh and self._dbh:connected() +end + +function Database.__self_test__() + local db = Database.new('system') + assert(db:connected()) + + assert("1" == db:first_value("select 1 as v")) + + local t = assert(db:first_row("select 1 as v")) + assert(t.v == "1") + + t = assert(db:fetch_all("select 1 as v union all select 2 as v")) + assert(#t == 2) + assert(t[1].v == "1") + assert(t[2].v == "2") + + local a, b = assert(db:first("select 1 as b, 2 as a", 'a', 'b')) + assert(a == "2") + assert(b == "1") + + -- assert(nil == db:first_value("some non sql query")) + + db:release() + assert(not db:connected()) +end + +end + +-- Database.__self_test__() + +return Database \ No newline at end of file From 6304c470cfdfe39c8eb5a693fcb44e70c805c348 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 10 Sep 2015 14:36:30 +0400 Subject: [PATCH 02/14] Fix. load `file_exists` function --- resources/install/scripts/resources/functions/database.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua index a8f7f662c6..50349b1b14 100644 --- a/resources/install/scripts/resources/functions/database.lua +++ b/resources/install/scripts/resources/functions/database.lua @@ -1,4 +1,5 @@ require 'resources.config' +require 'resources.functions.file_exists' require 'resources.functions.database_handle' local unpack = unpack or table.unpack @@ -76,8 +77,8 @@ function Database:connected(sql) return self._dbh and self._dbh:connected() end -function Database.__self_test__() - local db = Database.new('system') +function Database.__self_test__(name) + local db = Database.new(name or 'system') assert(db:connected()) assert("1" == db:first_value("select 1 as v")) From 665f65642c8c4d9559964cbb33562f2ce702f705 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 20 Oct 2015 13:20:35 -0600 Subject: [PATCH 03/14] Fix the variable syntax for the yealink templates. --- resources/templates/provision/yealink/cp860/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t21p/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t23g/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t23p/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t27p/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t29g/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t41p/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t42g/{$mac}.cfg | 4 ++-- resources/templates/provision/yealink/t46g/{$mac}.cfg | 8 ++++---- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/resources/templates/provision/yealink/cp860/{$mac}.cfg b/resources/templates/provision/yealink/cp860/{$mac}.cfg index 6c2e6b83fd..fc799d7c1a 100644 --- a/resources/templates/provision/yealink/cp860/{$mac}.cfg +++ b/resources/templates/provision/yealink/cp860/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t21p/{$mac}.cfg b/resources/templates/provision/yealink/t21p/{$mac}.cfg index d07ef9cbee..8641aa3259 100644 --- a/resources/templates/provision/yealink/t21p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t21p/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t23g/{$mac}.cfg b/resources/templates/provision/yealink/t23g/{$mac}.cfg index 968318b4d8..e09d088c44 100644 --- a/resources/templates/provision/yealink/t23g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t23g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t23p/{$mac}.cfg b/resources/templates/provision/yealink/t23p/{$mac}.cfg index 968318b4d8..e09d088c44 100644 --- a/resources/templates/provision/yealink/t23p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t23p/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t27p/{$mac}.cfg b/resources/templates/provision/yealink/t27p/{$mac}.cfg index 968318b4d8..e09d088c44 100644 --- a/resources/templates/provision/yealink/t27p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t27p/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t29g/{$mac}.cfg b/resources/templates/provision/yealink/t29g/{$mac}.cfg index 968318b4d8..e09d088c44 100644 --- a/resources/templates/provision/yealink/t29g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t29g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t41p/{$mac}.cfg b/resources/templates/provision/yealink/t41p/{$mac}.cfg index 968318b4d8..e09d088c44 100644 --- a/resources/templates/provision/yealink/t41p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t41p/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t42g/{$mac}.cfg b/resources/templates/provision/yealink/t42g/{$mac}.cfg index 39e50b45ba..94d6cc28a1 100644 --- a/resources/templates/provision/yealink/t42g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t42g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t46g/{$mac}.cfg b/resources/templates/provision/yealink/t46g/{$mac}.cfg index a34ab6f3a8..d822ba5bad 100644 --- a/resources/templates/provision/yealink/t46g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t46g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### @@ -2399,8 +2399,8 @@ account.5.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### From d90b080913dce02601e8e9c4332e673a5682695d Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:45:57 +0200 Subject: [PATCH 04/14] Ability to order the time conditions --- app/time_conditions/time_condition_edit.php | 40 ++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 42d7b79a62..87187997f4 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -70,6 +70,8 @@ require_once "resources/header.php"; $dialplan_enabled = check_str($_POST["dialplan_enabled"]); $dialplan_description = check_str($_POST["dialplan_description"]); + + } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -248,7 +250,17 @@ require_once "resources/header.php"; $is_preset = (in_array($group_id, $_REQUEST['preset'])) ? true : false; //set group and order number - $dialplan_detail_group = $group_id; + + $dialplan_detail_group_user = check_str($_POST["group_$group_id"]); + + if($dialplan_detail_group_user!='') { + $dialplan_detail_group = $dialplan_detail_group_user; + } else { + $dialplan_detail_group = $group_id; + } + + + $dialplan_detail_order = 0; foreach ($conditions as $cond_num => $cond_var) { @@ -291,6 +303,7 @@ require_once "resources/header.php"; } //add condition to query string + $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -332,7 +345,7 @@ require_once "resources/header.php"; if ($is_preset) { foreach ($_REQUEST['preset'] as $preset_number => $preset_group_id) { if ($group_id == $preset_group_id) { - foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { + foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -361,6 +374,11 @@ require_once "resources/header.php"; $dialplan_action_app = $dialplan_action; $dialplan_action_data = ''; } + + + + + //add group action to query $dialplan_detail_order += 10; @@ -423,11 +441,11 @@ require_once "resources/header.php"; } //execute query - if ($conditions_exist) { + if ($conditions_exist) { $db->exec(check_sql($sql)); unset($sql); } - + //commit the atomic transaction $count = $db->exec("COMMIT;"); //returns affected rows @@ -505,6 +523,7 @@ require_once "resources/header.php"; $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); + unset ($prep_statement, $sql); //load current conditions into array (combined by group), and retrieve action and anti-action @@ -833,7 +852,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo "\n"; echo " \n"; @@ -846,12 +865,23 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; + echo " "; + echo " \n"; + echo " "; echo " "; echo " "; echo " "; + echo " \n"; + echo " "; + + echo " "; + echo " \n"; + echo " "; + + echo "
".$text['label-destination']."
"; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo "
".$text['label-group']."
"; echo "
"; echo " ".$text['description-settings']; From a4e64efa7f3f06404c6cbec26dcec2c7222bceaf Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:54:19 +0200 Subject: [PATCH 05/14] Formatting --- app/time_conditions/time_condition_edit.php | 22 +++++---------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 87187997f4..4a653791f3 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -70,8 +70,6 @@ require_once "resources/header.php"; $dialplan_enabled = check_str($_POST["dialplan_enabled"]); $dialplan_description = check_str($_POST["dialplan_description"]); - - } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -252,15 +250,12 @@ require_once "resources/header.php"; //set group and order number $dialplan_detail_group_user = check_str($_POST["group_$group_id"]); - if($dialplan_detail_group_user!='') { $dialplan_detail_group = $dialplan_detail_group_user; } else { $dialplan_detail_group = $group_id; - } - - - + } + $dialplan_detail_order = 0; foreach ($conditions as $cond_num => $cond_var) { @@ -303,7 +298,6 @@ require_once "resources/header.php"; } //add condition to query string - $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -374,11 +368,6 @@ require_once "resources/header.php"; $dialplan_action_app = $dialplan_action; $dialplan_action_data = ''; } - - - - - //add group action to query $dialplan_detail_order += 10; @@ -441,11 +430,11 @@ require_once "resources/header.php"; } //execute query - if ($conditions_exist) { + if ($conditions_exist) { $db->exec(check_sql($sql)); unset($sql); } - + //commit the atomic transaction $count = $db->exec("COMMIT;"); //returns affected rows @@ -523,7 +512,6 @@ require_once "resources/header.php"; $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); - unset ($prep_statement, $sql); //load current conditions into array (combined by group), and retrieve action and anti-action @@ -852,7 +840,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo "\n"; echo " \n"; From bfbe3abdc3596c4b3b0599a1896b7baf82a3bd00 Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:58:45 +0200 Subject: [PATCH 06/14] More Formatting --- app/time_conditions/time_condition_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 4a653791f3..d7292e775c 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -339,7 +339,7 @@ require_once "resources/header.php"; if ($is_preset) { foreach ($_REQUEST['preset'] as $preset_number => $preset_group_id) { if ($group_id == $preset_group_id) { - foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { + foreach ($available_presets[$preset_number] as $available_preset_name => $meh) { $dialplan_detail_order += 10; $sql .= ", ( "; $sql .= "'".$domain_uuid."', "; @@ -840,7 +840,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { global $text, $v_link_label_add; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; - echo " ".$text['label-settings']; + echo " ".$text['label-settings']; echo "\n"; echo " \n"; From e519a4fd94e32f4e5fff10ca832631d6240238f5 Mon Sep 17 00:00:00 2001 From: koldoa Date: Thu, 22 Oct 2015 10:59:50 +0200 Subject: [PATCH 07/14] Languages updates --- app/time_conditions/app_languages.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/time_conditions/app_languages.php b/app/time_conditions/app_languages.php index 402e6a4027..91dbe32ace 100644 --- a/app/time_conditions/app_languages.php +++ b/app/time_conditions/app_languages.php @@ -583,6 +583,28 @@ $text['label-alternate-destination']['uk'] = ""; $text['label-alternate-destination']['de-at'] = "Alternatives Ziel"; $text['label-alternate-destination']['he'] = ""; +$text['label-group']['en-us'] = "Group"; +$text['label-group']['es-cl'] = "Grupo"; +$text['label-group']['pt-pt'] = ""; +$text['label-group']['fr-fr'] = ""; +$text['label-group']['pt-br'] = ""; +$text['label-group']['pl'] = ""; +$text['label-group']['sv-se'] = ""; +$text['label-group']['uk'] = ""; +$text['label-group']['de-at'] = ""; +$text['label-group']['he'] = ""; + +$text['label-destination']['en-us'] = "Destination"; +$text['label-destination']['es-cl'] = "Destino"; +$text['label-destination']['pt-pt'] = "Destino"; +$text['label-destination']['fr-fr'] = "Destination"; +$text['label-destination']['pt-br'] = ""; +$text['label-destination']['pl'] = "Destynacja"; +$text['label-destination']['sv-se'] = "Destination"; +$text['label-destination']['uk'] = ""; +$text['label-destination']['de-at'] = "Ziel"; +$text['label-destination']['he'] = ""; + $text['header-time_conditions']['en-us'] = "Time Conditions"; $text['header-time_conditions']['es-cl'] = "Condiciones de Tiempo"; $text['header-time_conditions']['pt-pt'] = "Condições Temporais"; From 43cabfc255635d50200e49296ccfd79346ef4890 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 22 Oct 2015 16:26:41 +0300 Subject: [PATCH 08/14] Fix. Extension link on contact edit page. --- app/contacts/contact_extensions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/contacts/contact_extensions.php b/app/contacts/contact_extensions.php index 232a7aef5e..95148688ff 100644 --- a/app/contacts/contact_extensions.php +++ b/app/contacts/contact_extensions.php @@ -82,7 +82,7 @@ else { echo "\n"; echo "\n"; echo "\n"; @@ -92,7 +92,7 @@ else { echo "\n"; echo " \n"; echo " \n"; echo "\n"; @@ -116,4 +116,4 @@ else { echo "
".$text['label-description'].""; if (permission_exists('extension_add')) { - echo "$v_link_label_add\n"; + echo "$v_link_label_add\n"; } echo "
"; if (permission_exists('extension_edit')) { - echo "".$row['extension'].""; + echo "".$row['extension'].""; } else { echo $row['extension']; @@ -102,10 +102,10 @@ else { echo " ".$row['description']." "; if (permission_exists('extension_edit')) { - echo "$v_link_label_edit"; + echo "$v_link_label_edit"; } if (permission_exists('extension_delete')) { - echo "$v_link_label_delete"; + echo "$v_link_label_delete"; } echo "
"; -?> +?> \ No newline at end of file From 4ff5835cbcf17438bad0d83d331acf0d24d5a029 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 23 Oct 2015 15:23:55 -0600 Subject: [PATCH 09/14] Change the paging extension_list to destinations. --- app/dialplan/resources/switch/conf/dialplan/240_page.xml | 2 +- .../resources/switch/conf/dialplan/250_page-extension.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/240_page.xml b/app/dialplan/resources/switch/conf/dialplan/240_page.xml index 35b75b6470..6a48aa368f 100644 --- a/app/dialplan/resources/switch/conf/dialplan/240_page.xml +++ b/app/dialplan/resources/switch/conf/dialplan/240_page.xml @@ -4,7 +4,7 @@ - + diff --git a/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml b/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml index ef0ee75364..f604b2632a 100644 --- a/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml @@ -1,7 +1,7 @@ - + From ed0e78ace29f870b500e25b19f4393d83c1ce50a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 24 Oct 2015 16:39:22 -0600 Subject: [PATCH 10/14] Remove the redundant public condition from the inbound route. --- app/destinations/destination_edit.php | 9 ------- app/dialplan_inbound/dialplan_inbound_add.php | 27 ------------------- 2 files changed, 36 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index b8298e2f04..f2f446510a 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -214,15 +214,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $dialplan["dialplan_description"] = ($dialplan_description != '') ? $dialplan_description : $destination_description; $dialplan_detail_order = 10; - //add the public condition - $y = 0; - $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; - $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition"; - $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context"; - $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public"; - $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; - $y++; - //increment the dialplan detail order $dialplan_detail_order = $dialplan_detail_order + 10; diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index 77b8100e8a..25dbfb37fd 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -184,33 +184,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - //add condition public context - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_group, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'context', "; - $sql .= "'public', "; - $sql .= "'0', "; - $sql .= "'10' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - //add condition 1 $dialplan_detail_uuid = uuid(); $sql = "insert into v_dialplan_details "; From e393ea821a4e3a8a57aff56a32af1598faf09177 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 24 Oct 2015 18:55:24 -0600 Subject: [PATCH 11/14] Move the time condition group to a location to make better use of the vertical space. --- app/time_conditions/time_condition_edit.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index d7292e775c..1be14bd414 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -843,7 +843,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " ".$text['label-settings']; echo "
\n"; - echo " \n"; + echo "
\n"; echo " \n"; echo " \n"; echo " \n"; @@ -854,22 +854,16 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; - echo " \n"; + echo " \n"; + echo " \n"; echo " "; echo " "; - echo " "; + echo " \n"; echo " "; - echo " \n"; - echo " "; - - echo " "; - echo " \n"; - echo " "; - - echo "
".$text['label-condition']."".$text['label-condition_value']."
".$text['label-destination']."".$text['label-destination']."".$text['label-group']."
"; + echo " "; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo "
".$text['label-group']."
"; echo "
"; echo " ".$text['description-settings']; @@ -1110,4 +1104,4 @@ echo "
"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file From 128bb6d857915a4f0c0dcb34d02424baf5dd85df Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 24 Oct 2015 20:09:36 -0600 Subject: [PATCH 12/14] Add voicemail caller id number announce as iterated. --- .../voicemail/resources/functions/listen_to_recording.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua index 26f7f8f11d..3ce7fb9196 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua @@ -40,6 +40,10 @@ if (session:ready()) then reply = api:executeString("uuid_display "..session:get_uuid().." "..caller_id_number); end + --say the caller id number + if (session:ready() and caller_id_number ~= nil) then + session:say(caller_id_number, default_language, "name_spelled", "iterated"); + end --say the message number if (session:ready()) then if (string.len(dtmf_digits) == 0) then @@ -49,7 +53,7 @@ --say the number if (session:ready()) then if (string.len(dtmf_digits) == 0) then - session:say(message_number, default_language, "NUMBER", "pronounced"); + session:say(message_number, default_language, "number", "pronounced"); end end --say the message date @@ -58,7 +62,7 @@ if (current_time_zone ~= nil) then session:execute("set", "timezone="..current_time_zone..""); end - session:say(created_epoch, default_language, "CURRENT_DATE_TIME", "pronounced"); + session:say(created_epoch, default_language, "current_date_time", "pronounced"); end end From 8f67f2c4c1ff7cb7848dc9a668ee5c1c771f16df Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 24 Oct 2015 21:00:22 -0600 Subject: [PATCH 13/14] Add vm_say_caller_id_number option for true or false. --- .../install/scripts/app/voicemail/index.lua | 1 + .../resources/functions/listen_to_recording.lua | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/resources/install/scripts/app/voicemail/index.lua b/resources/install/scripts/app/voicemail/index.lua index 056127af3b..ee9e79e5cd 100644 --- a/resources/install/scripts/app/voicemail/index.lua +++ b/resources/install/scripts/app/voicemail/index.lua @@ -73,6 +73,7 @@ skip_instructions = session:getVariable("skip_instructions"); skip_greeting = session:getVariable("skip_greeting"); vm_message_ext = session:getVariable("vm_message_ext"); + vm_say_caller_id_number = session:getVariable("vm_say_caller_id_number"); vm_disk_quota = session:getVariable("vm-disk-quota"); if (not vm_disk_quota) then vm_disk_quota = session:getVariable("vm_disk_quota"); diff --git a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua index 3ce7fb9196..f798f63c40 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua @@ -40,16 +40,21 @@ if (session:ready()) then reply = api:executeString("uuid_display "..session:get_uuid().." "..caller_id_number); end - --say the caller id number - if (session:ready() and caller_id_number ~= nil) then - session:say(caller_id_number, default_language, "name_spelled", "iterated"); - end --say the message number if (session:ready()) then - if (string.len(dtmf_digits) == 0) then + if (string.len(dtmf_digits) == 0) then dtmf_digits = macro(session, "message_number", 1, 100, ''); end end + --say the caller id number + if (session:ready() and caller_id_number ~= nil) then + if (vm_say_caller_id_number ~= nil) then + if (vm_say_caller_id_number == "true") then + session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-message_from.wav"); + session:say(caller_id_number, default_language, "name_spelled", "iterated"); + end + end + end --say the number if (session:ready()) then if (string.len(dtmf_digits) == 0) then @@ -65,7 +70,6 @@ session:say(created_epoch, default_language, "current_date_time", "pronounced"); end end - --get the recordings from the database if (storage_type == "base64") then sql = [[SELECT * FROM v_voicemail_messages From bf3c374e137ba8a169325a5664a43acd03795741 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 24 Oct 2015 21:12:43 -0600 Subject: [PATCH 14/14] Play the message number first then the caller id number. --- .../resources/functions/listen_to_recording.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua index f798f63c40..81b763f044 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua @@ -46,6 +46,12 @@ dtmf_digits = macro(session, "message_number", 1, 100, ''); end end + --say the number + if (session:ready()) then + if (string.len(dtmf_digits) == 0) then + session:say(message_number, default_language, "number", "pronounced"); + end + end --say the caller id number if (session:ready() and caller_id_number ~= nil) then if (vm_say_caller_id_number ~= nil) then @@ -55,12 +61,6 @@ end end end - --say the number - if (session:ready()) then - if (string.len(dtmf_digits) == 0) then - session:say(message_number, default_language, "number", "pronounced"); - end - end --say the message date if (session:ready()) then if (string.len(dtmf_digits) == 0) then