From 076a02b41cb31a79802a38cab13f9f7c81d1ac22 Mon Sep 17 00:00:00 2001 From: jebsolutions Date: Mon, 21 Nov 2016 23:53:56 -0500 Subject: [PATCH] [master] fix bug #2017 ring groups broken until re-save (#2108) test case: Create a new ring group with one extension. Immediately dial the ring group number. expected result: Phone rings. No errors in log. actual result: Call terminates and log has "0" as ring_group_uuid and a sql error. Note: editing and re-saving the ring group works around the problem The Problem: Line 162: non-existent variable...being checked is returned as false = 0 Line 278: Xml gets generated with bogus zero... Line 298: Generate a new uuid...but too late. We already generated the xml dial plan which will be invalid until we edit and resave this ring group. fix: Generate uuid before generating xml --- app/ring_groups/ring_group_edit.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index 606f0ff56a..4ba14bd0d7 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -159,7 +159,8 @@ //get the ring group uuid if (!isset($ring_group_uuid)) { - $ring_group_uuid = is_uuid($_REQUEST["ring_group_uuid"]); + $ring_group_uuid = uuid(); + $_POST["ring_group_uuid"] = $ring_group_uuid; } //check for all required data @@ -293,12 +294,6 @@ $dialplan["dialplan_description"] = $ring_group_description; $dialplan["app_uuid"] = "1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2"; - //add the ring_group_uuid - if (strlen($_POST["ring_group_uuid"]) == 0) { - $ring_group_uuid = uuid(); - $_POST["ring_group_uuid"] = $ring_group_uuid; - } - //prepare the array $array['ring_groups'][] = $_POST; $array['dialplans'][] = $dialplan;