diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index cb7de69110..578d0759d2 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -189,6 +189,11 @@ return; } + //get the uuid + if ($action == "update" && is_uuid($_POST["destination_uuid"])) { + $destination_uuid = $_POST["destination_uuid"]; + } + //get the destination row values if ($action == 'update' && is_uuid($destination_uuid)) { $sql = "select * from v_destinations "; @@ -199,9 +204,16 @@ unset($sql, $parameters); } - //get the dialplan_uuid from the database + //get the destination settings from the database if (is_array($row) && @sizeof($row) != 0) { + //get the dialplan_uuid from the database $dialplan_uuid = $row["dialplan_uuid"]; + + //if the destination_number is not set then get it from the database + if (!isset($destination_number)) { + $destination_prefix = $row["destination_prefix"]; + $destination_number = $row["destination_number"]; + } } //if the user doesn't have the correct permission then @@ -768,14 +780,19 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$destination_context); - if (isset($destination_number) && is_numeric($destination_number)) { - $cache->delete("dialplan:".$destination_context.":".$destination_number); + if ($_SESSION['destinations']['dialplan_mode']['text'] == 'multiple') { + $cache->delete("dialplan:".$destination_context); } - if (isset($destination_prefix) && is_numeric($destination_prefix) && isset($destination_number) && is_numeric($destination_number)) { - $cache->delete("dialplan:".$destination_context.":".$destination_prefix.$destination_number); + if ($_SESSION['destinations']['dialplan_mode']['text'] == 'single') { + if (isset($destination_number) && is_numeric($destination_number)) { + $cache->delete("dialplan:".$destination_context.":".$destination_number); + } + if (isset($destination_prefix) && is_numeric($destination_prefix) && isset($destination_number) && is_numeric($destination_number)) { + $cache->delete("dialplan:".$destination_context.":".$destination_prefix.$destination_number); + } } - } + + } //if $destination_type == inbound //save the outbound destination if ($destination_type == 'outbound') { @@ -821,7 +838,7 @@ unset($_SESSION['destinations']['array']); } - } + } //if destination_type == outbound //redirect the user if ($action == "add") {