Fix the a syntax problem and the dialplan detail order

This commit is contained in:
Mark Crane
2014-07-02 06:40:28 +00:00
parent 3000dc9f61
commit a661d714d6
+60 -41
View File
@@ -176,56 +176,49 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan["dialplan_order"] = "100"; $dialplan["dialplan_order"] = "100";
$dialplan["dialplan_enabled"] = $destination_enabled; $dialplan["dialplan_enabled"] = $destination_enabled;
$dialplan["dialplan_description"] = $destination_description; $dialplan["dialplan_description"] = $destination_description;
$dialplan_detail_order = 0;
if (strlen($dialplan_uuid) == 0) { if (strlen($dialplan_uuid) == 0) {
$y = 0; //add the public condition
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $y = 0;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition"; $dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "10"; $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public";
$y++; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $y++;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number"; //increment the dialplan detail order
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $destination_number; $dialplan_detail_order = $dialplan_detail_order + 10;
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "20";
$y++; //check the destination number
//$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
//$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
//$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
//$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "call_direction=inbound"; $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $destination_number;
//$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "20"; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
//$y++; $y++;
}
$dialplan_detail_order = 30; //increment the dialplan detail order
foreach ($dialplan_details as $row) { $dialplan_detail_order = $dialplan_detail_order + 10;
$actions = explode(":", $row["dialplan_detail_data"]);
$dialplan_detail_type = array_shift($actions); //set the call direction
$dialplan_detail_data = join(':', $actions);
if (strlen($dialplan_detail_type) > 1) {
if (isset($row["dialplan_detail_uuid"])) {
$dialplan["dialplan_details"][$y]["dialplan_detail_uuid"] = $row["dialplan_detail_uuid"];
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $dialplan_detail_type; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $dialplan_detail_data; $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "call_direction=inbound";
if (strlen($row["dialplan_detail_order"]) > 0) { $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $row["dialplan_detail_order"];
}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
}
$dialplan_detail_order = $dialplan_detail_order + 10;
$y++; $y++;
}
//increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10;
} }
//add fax detection //add fax detection
if (strlen($fax_uuid) > 0) { if (strlen($fax_uuid) > 0) {
//get the fax information //get the fax information
$sql = "select * from v_fax "; $sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '".$fax_uuid."' "; $sql .= "and fax_uuid = '".$fax_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
@@ -280,11 +273,37 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "sleep"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "sleep";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "3000"]; $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "3000";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
$y++; $y++;
} }
//add the actions
foreach ($dialplan_details as $row) {
$actions = explode(":", $row["dialplan_detail_data"]);
$dialplan_detail_type = array_shift($actions);
$dialplan_detail_data = join(':', $actions);
if (strlen($dialplan_detail_type) > 1) {
if (isset($row["dialplan_detail_uuid"])) {
$dialplan["dialplan_details"][$y]["dialplan_detail_uuid"] = $row["dialplan_detail_uuid"];
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $dialplan_detail_type;
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $dialplan_detail_data;
if (strlen($row["dialplan_detail_order"]) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $row["dialplan_detail_order"];
}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
}
$y++;
//increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10;
}
}
//save the dialplan //save the dialplan
if (strlen($dialplan_details[0][dialplan_detail_data]) > 2) { if (strlen($dialplan_details[0][dialplan_detail_data]) > 2) {
$orm = new orm; $orm = new orm;