Only write the dialplan for dialplan -> destinations if the destination_number is set

This commit is contained in:
Mark Crane 2014-08-05 23:57:48 +00:00
parent dc03a9c201
commit 068e8e1b99
1 changed files with 219 additions and 217 deletions

View File

@ -128,16 +128,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//add the domain_uuid
$_POST["domain_uuid"] = $_SESSION['domain_uuid'];
//add or update the dialplan if the destination number is set
if (strlen($destination_number) > 0) {
//get the array
$dialplan_details = $_POST["dialplan_details"];
//remove the array from the HTTP POST
unset($_POST["dialplan_details"]);
//add the domain_uuid
$_POST["domain_uuid"] = $_SESSION['domain_uuid'];
//array cleanup
$x = 0;
foreach ($dialplan_details as $row) {
@ -345,6 +346,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$orm->save($dialplan);
$dialplan_response = $orm->message;
//synchronize the xml config
save_dialplan_xml();
//clear memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = "memcache delete dialplan:".$destination_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} //add or update the dialplan if the destination number is set
//get the destination_uuid
if (strlen($dialplan_response['uuid']) > 0) {
$_POST["dialplan_uuid"] = $dialplan_response['uuid'];
@ -365,16 +378,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$destination_uuid = $destination_response['uuid'];
}
//synchronize the xml config
save_dialplan_xml();
//clear memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = "memcache delete dialplan:".$destination_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
@ -411,7 +414,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
header("Location: destination_edit.php?id=".$destination_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)