From 22e99a26c37e8fec49f04f7815b568b42714a196 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 31 Oct 2025 14:58:10 -0600 Subject: [PATCH] Define the maximum dialplan order number Maximum order set to 300 to prevent loops with call-forward-all --- .../dialplan_outbound_add.php | 10 +++--- app/dialplans/dialplan_edit.php | 31 ++++++++++++------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 6645ed9827..781ac6fc2b 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -435,7 +435,7 @@ } if (empty($dialplan_order)) { - $dialplan_order ='333'; + $dialplan_order ='300'; } $dialplan_context = $_SESSION['domain_name']; $dialplan_continue = false; @@ -895,6 +895,9 @@ unset($sql, $parameters); } +//define the maximum dialplan order number - maximum order set to 300 to prevent loops with call-forward-all + $dialplan_order_max = 300; + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -1311,16 +1314,13 @@ function type_onchange(dialplan_detail_type) { echo "\n"; echo "\n"; echo " \n"; echo "
\n"; diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index ecaf4e15c6..9b5c9f5abb 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -382,6 +382,17 @@ unset($sql, $parameters, $row); } +//get the dialplan details in an array + $sql = "select "; + $sql .= "domain_uuid, dialplan_uuid, dialplan_detail_uuid, dialplan_detail_tag, dialplan_detail_type, dialplan_detail_data, "; + $sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, dialplan_detail_enabled "; + $sql .= "from v_dialplan_details "; + $sql .= "where dialplan_uuid = :dialplan_uuid "; + $sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc"; + $parameters['dialplan_uuid'] = $dialplan_uuid; + $result = $database->select($sql, $parameters, 'all'); + unset($sql, $parameters); + //set the defaults if (empty($dialplan_context)) { $dialplan_context = $_SESSION['domain_name']; @@ -393,16 +404,13 @@ $dialplan_destination = false; } -//get the dialplan details in an array - $sql = "select "; - $sql .= "domain_uuid, dialplan_uuid, dialplan_detail_uuid, dialplan_detail_tag, dialplan_detail_type, dialplan_detail_data, "; - $sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, dialplan_detail_enabled "; - $sql .= "from v_dialplan_details "; - $sql .= "where dialplan_uuid = :dialplan_uuid "; - $sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc"; - $parameters['dialplan_uuid'] = $dialplan_uuid; - $result = $database->select($sql, $parameters, 'all'); - unset($sql, $parameters); +//define the maximum dialplan order number + $dialplan_order_max = 999; + +//outbound routes - limit the dialplan order no more than 300 to prevent loop with call-forward-all + if ($app_uuid == '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3') { + $dialplan_order_max = 300; + } //create a new array that is sorted into groups and put the tags in order conditions, actions, anti-actions //set the array index @@ -673,8 +681,7 @@ echo " \n"; echo " \n"; echo "