set toll allow to a text box (#3117)

this is for ease of setting it up without making mistakes in the dialplan
This commit is contained in:
andycol 2018-06-18 18:00:54 +02:00 committed by FusionPBX
parent 742ff7a0c9
commit 7966fa6983
1 changed files with 26 additions and 29 deletions

View File

@ -25,6 +25,7 @@
James Rose <james.o.rose@gmail.com>
Riccardo Granchi <riccardo.granchi@nems.it>
Gill Abada <ga@steadfasttelecom.com>
Andrew Colin <andrewd.colin@gmail.com>
*/
//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 "</td>\n";
echo "</tr>\n";
if (permission_exists('outbound_route_toll_allow_lua')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-toll_allow']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='toll_allow_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' selected='true'>".$text['label-false']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-enable-toll_allow']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-toll_allow']."\n";
echo "</td>\n";
echo "<td colspan='4' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='toll_allow' maxlength='255' value=\"$toll_allow\">\n";
echo "<br />\n";
echo $text['description-enable-toll_allow']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";