Add an inbound route when adding a dialplan destination.
This commit is contained in:
parent
2b2d46a408
commit
ab89e180a9
|
|
@ -196,9 +196,73 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
$orm->save($_POST);
|
||||
$response = $orm->message;
|
||||
//print_r($_POST);
|
||||
//print_r($response);
|
||||
//unset($orm);
|
||||
|
||||
//build the dialplan array
|
||||
if (isset($dialplan_uuid)) {
|
||||
$dialplan["dialplan_uuid"] = $dialplan_uuid;
|
||||
}
|
||||
$dialplan["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||
$dialplan["dialplan_name"] = $destination_number;
|
||||
$dialplan["dialplan_number"] = $destination_number;
|
||||
$dialplan["destination_context"] = $destination_context;
|
||||
$dialplan["dialplan_continue"] = "true";
|
||||
$dialplan["dialplan_order"] = "100";
|
||||
$dialplan["dialplan_enabled"] = $destination_enabled;
|
||||
$dialplan["dialplan_description"] = $destination_description;
|
||||
if (!isset($dialplan_uuid)) {
|
||||
$y = 0;
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "10";
|
||||
$y++;
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $destination_number;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "20";
|
||||
$y++;
|
||||
$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"] = "call_direction=inbound";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = "30";
|
||||
$y++;
|
||||
}
|
||||
$dialplan_detail_order = 40;
|
||||
foreach ($dialplan_details as $row) {
|
||||
if (isset($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_uuid"] = $row["dialplan_detail_uuid"];
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $row["dialplan_detail_type"];
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $row["dialplan_detail_data"];
|
||||
if (isset($row["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++;
|
||||
}
|
||||
|
||||
//save the dialplan
|
||||
$orm = new orm;
|
||||
$orm->name('dialplans');
|
||||
if (isset($dialplan["dialplan_uuid"])) {
|
||||
$orm->uuid($dialplan["dialplan_uuid"]);
|
||||
}
|
||||
$orm->save($dialplan);
|
||||
$response = $orm->message;
|
||||
print_r($dialplan_details);
|
||||
print_r($response);
|
||||
|
||||
//save the dialplan details
|
||||
/*
|
||||
foreach ($dialplan_details as $row) {
|
||||
$orm = new orm;
|
||||
$orm->name('dialplan_details');
|
||||
|
|
@ -210,11 +274,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
print_r($dialplan_details);
|
||||
print_r($response);
|
||||
}
|
||||
*/
|
||||
|
||||
//get the destination_uuid
|
||||
if (strlen($response['uuid']) > 0) {
|
||||
$destination_uuid = $response['uuid'];
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: destination_edit.php?id=".$destination_uuid);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue