Merge pull request #1098 from moteus/toll_allow_forward

Set Toll Allow for call forward/follow me
This commit is contained in:
FusionPBX
2015-08-14 08:34:17 -06:00
3 changed files with 12 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ include "root.php";
public $forward_all_destination;
public $forward_all_enabled;
private $dial_string;
private $toll_allow;
public $accountcode;
public $forward_caller_id_uuid;
public $outbound_caller_id_name;
@@ -58,6 +59,7 @@ include "root.php";
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
@@ -73,6 +75,7 @@ include "root.php";
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
$dial_string .= ",domain=".$_SESSION['domain_name'];
$dial_string .= ",extension_uuid=".$this->extension_uuid;
$dial_string .= ",toll_allow='".$this->toll_allow."'";
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
$dial_string .= ",accountcode=".$this->accountcode;
@@ -140,7 +143,7 @@ include "root.php";
}
else {
$sql .= "forward_all_destination = '$this->forward_all_destination', ";
$sql .= "dial_string = '".$this->dial_string."', ";
$sql .= "dial_string = '".check_str($this->dial_string)."', ";
$sql .= "forward_all_enabled = 'true' ";
}
$sql .= "where domain_uuid = '$this->domain_uuid' ";

View File

@@ -43,6 +43,7 @@ include "root.php";
public $outbound_caller_id_name;
public $outbound_caller_id_number;
private $extension;
private $toll_allow;
public $destination_data_1;
public $destination_type_1;
@@ -247,6 +248,7 @@ include "root.php";
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
@@ -330,6 +332,7 @@ include "root.php";
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
$dial_string .= ",accountcode=".$this->accountcode;
}
$dial_string .= ",toll_allow='".$this->toll_allow."'";
$dial_string .= "}";
$x = 0;
foreach ($result as &$row) {
@@ -419,7 +422,7 @@ include "root.php";
}
$sql = "update v_extensions set ";
$sql .= "dial_string = '".$dial_string."', ";
$sql .= "dial_string = '".check_str($dial_string)."', ";
$sql .= "dial_domain = '".$_SESSION['domain_name']."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";

View File

@@ -133,6 +133,7 @@
forward_all_enabled = row.forward_all_enabled;
forward_all_destination = row.forward_all_destination;
follow_me_uuid = row.follow_me_uuid;
toll_allow = row.toll_allow or '';
--freeswitch.consoleLog("NOTICE", "[call forward] extension "..row.extension.."\n");
--freeswitch.consoleLog("NOTICE", "[call forward] accountcode "..row.accountcode.."\n");
end);
@@ -148,7 +149,7 @@
end
--get the forward destination
if (session:ready() and enabled == "true" or enabled == "toggle") then
if (session:ready() and (enabled == "true" or enabled == "toggle") ) then
if (string.len(forward_all_destination) == 0) then
forward_all_destination = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+");
end
@@ -171,6 +172,7 @@
dial_string = dial_string .. ",sip_invite_domain="..domain_name;
dial_string = dial_string .. ",domain_name="..domain_name;
dial_string = dial_string .. ",domain="..domain_name;
dial_string = dial_string .. ",toll_allow='"..toll_allow.."'";
if (accountcode ~= nil) then
dial_string = dial_string .. ",accountcode="..accountcode;
end
@@ -241,7 +243,7 @@
sql = "update v_extensions set ";
if (enabled == "true") then
sql = sql .. "forward_all_destination = '"..forward_all_destination.."', ";
sql = sql .. "dial_string = '"..dial_string.."', ";
sql = sql .. "dial_string = '"..dial_string:gsub("'", "''").."', ";
sql = sql .. "do_not_disturb = 'false', ";
else
sql = sql .. "forward_all_destination = null, ";