set carrier and accountcode for incoming routes if data exists

This commit is contained in:
luis daniel lucio quiroz 2014-07-13 23:22:15 +00:00
parent bb985212dd
commit df83466a4d
2 changed files with 88 additions and 2 deletions

View File

@ -214,6 +214,32 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//increment the dialplan detail order //increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10; $dialplan_detail_order = $dialplan_detail_order + 10;
//set the call accountcode
if (strlen($destination_accountcode) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "accountcode=$destination_accountcode";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
$y++;
//increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10;
}
//set the call carrier
if (strlen($destination_carrier) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "carrier=$destination_carrier";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
$y++;
//increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10;
}
} }
//add fax detection //add fax detection

View File

@ -22,6 +22,7 @@
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/ */
include "root.php"; include "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
@ -79,6 +80,9 @@ require_once "resources/paging.php";
//$action_application_2 = check_str($_POST["action_application_2"]); //$action_application_2 = check_str($_POST["action_application_2"]);
//$action_data_2 = check_str($_POST["action_data_2"]); //$action_data_2 = check_str($_POST["action_data_2"]);
$destination_carrier = '';
$destination_accountcode = '';
//use the destination_uuid to set the condition_expression_1 //use the destination_uuid to set the condition_expression_1
if (strlen($destination_uuid) > 0) { if (strlen($destination_uuid) > 0) {
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
@ -91,13 +95,15 @@ require_once "resources/paging.php";
foreach ($result as &$row) { foreach ($result as &$row) {
$condition_expression_1 = $row["destination_number"]; $condition_expression_1 = $row["destination_number"];
$fax_uuid = $row["fax_uuid"]; $fax_uuid = $row["fax_uuid"];
$destination_carrier = $row["destination_carrier"];
$destination_accountcode = $row["destination_accountcode"];
} }
} }
unset ($prep_statement); unset ($prep_statement);
} }
if (permission_exists("inbound_route_advanced") && $action == "advanced") { if (permission_exists("inbound_route_advanced") && $action == "advanced") {
//allow users in the superadmin group advanced control //Allow users with group advanced control, not always superadmin. You may change this in group permitions
} }
else { else {
if (strlen($condition_field_1) == 0) { $condition_field_1 = "destination_number"; } if (strlen($condition_field_1) == 0) { $condition_field_1 = "destination_number"; }
@ -283,6 +289,60 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql); unset($sql);
} }
//set accountcode
if (strlen($destination_accountcode) > 0) {
$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_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$dialplan_detail_uuid', ";
$sql .= "'action', ";
$sql .= "'set', ";
$sql .= "'accountcode=$destination_accountcode', ";
$sql .= "'62' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
//set carrier
if (strlen($destination_carrier) > 0) {
$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_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$dialplan_detail_uuid', ";
$sql .= "'action', ";
$sql .= "'set', ";
$sql .= "'carrier=$destination_carrier', ";
$sql .= "'64' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
//set limit //set limit
if (strlen($limit) > 0) { if (strlen($limit) > 0) {
$dialplan_detail_uuid = uuid(); $dialplan_detail_uuid = uuid();
@ -946,4 +1006,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?> ?>