From 7966fa69834862b9aade4002dba896eca9611989 Mon Sep 17 00:00:00 2001 From: andycol Date: Mon, 18 Jun 2018 18:00:54 +0200 Subject: [PATCH] set toll allow to a text box (#3117) this is for ease of setting it up without making mistakes in the dialplan --- .../dialplan_outbound_add.php | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 3246d8cbb4..ce0eb7223a 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -25,6 +25,7 @@ James Rose Riccardo Granchi Gill Abada + Andrew Colin */ //includes @@ -64,10 +65,9 @@ $gateway = check_str($_POST["gateway"]); $limit = check_str($_POST["limit"]); $accountcode = check_str($_POST["accountcode"]); - $toll_allow_enable = check_str($_POST["toll_allow_enabled"]); + $toll_allow = check_str($_POST["toll_allow"]); - //set default to enabled - if (strlen($toll_allow_enable) == 0) { $toll_allow_enable = "false"; } + //set the default type $gateway_type = 'gateway'; @@ -549,17 +549,18 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; } - if ($toll_allow_enable == "true") { - $y++; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); - $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'action'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = 'lua'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'app.lua toll_allow ${uuid}'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - } + if (strlen($toll_allow) > 0) { + $y++; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); + $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'condition'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = '${toll_allow}'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $toll_allow; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; + } + if ($gateway_type == "transfer") { $dialplan_detail_type = 'transfer'; } else { $dialplan_detail_type = 'bridge'; } $y++; @@ -1005,21 +1006,17 @@ function type_onchange(dialplan_detail_type) { echo "\n"; echo "\n"; - if (permission_exists('outbound_route_toll_allow_lua')) { - echo "\n"; - echo "\n"; - echo " ".$text['label-toll_allow']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-enable-toll_allow']."\n"; - echo "\n"; - echo "\n"; - } + echo "\n"; + echo "\n"; + echo " ".$text['label-toll_allow']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-enable-toll_allow']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n";