From 48ebd1378a1dac3f9adcc27e96ba48e99420acca Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 2 Oct 2012 20:49:18 +0000 Subject: [PATCH] Fix xml problems with time conditions, break, and dialplan groups. --- includes/install/scripts/xml_handler.lua | 46 ++++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/includes/install/scripts/xml_handler.lua b/includes/install/scripts/xml_handler.lua index dfd70545e9..7f8fb1aa34 100644 --- a/includes/install/scripts/xml_handler.lua +++ b/includes/install/scripts/xml_handler.lua @@ -198,15 +198,15 @@ table.insert(xml, [[ ]]); if (number_alias) then if (cidr) then - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); else - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); end else if (cidr) then - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); else - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); end end table.insert(xml, [[ ]]); @@ -339,6 +339,8 @@ previous_dialplan_uuid = ""; previous_dialplan_detail_group = ""; previous_dialplan_detail_tag = ""; + previous_dialplan_detail_type = ""; + previous_dialplan_detail_data = ""; dialplan_tag_status = "closed"; condition_tag_status = "closed"; @@ -386,7 +388,7 @@ --remove $$ and replace with $ dialplan_detail_data = dialplan_detail_data:gsub("%$%$", "$"); - --get the dialplan detail inline + --get the dialplan detail inline detail_inline = ""; if (dialplan_detail_inline) then if (string.len(dialplan_detail_inline) > 0) then @@ -411,7 +413,7 @@ --open the tags if (dialplan_tag_status == "closed") then - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); dialplan_tag_status = "open"; end if (dialplan_detail_tag == "condition") then @@ -450,10 +452,10 @@ if (condition_tag_status == "open") then if (previous_dialplan_detail_tag == "condition") then - --add the condition ending + --add the condition self closing tag if (condition) then if (string.len(condition) > 0) then - table.insert(xml, condition .. [[ />]]); + table.insert(xml, condition .. [[/>]]); end end end @@ -468,7 +470,7 @@ --condition tag but leave off the ending if (condition_type == "default") then - condition = [[ ]]); + table.insert(xml, condition .. [[>]]); + condition = ""; --prevents duplicate time conditions end end if (dialplan_detail_tag == "action") then @@ -496,14 +506,12 @@ table.insert(xml, [[ ]]); end - --save the previous group - previous_dialplan_detail_group = dialplan_detail_group; - - --save the previous tag - previous_dialplan_detail_tag = dialplan_detail_tag; - - --save the previous dialplan_uuid + --save the previous values previous_dialplan_uuid = dialplan_uuid; + previous_dialplan_detail_group = dialplan_detail_group; + previous_dialplan_detail_tag = dialplan_detail_tag; + previous_dialplan_detail_type = dialplan_detail_type; + previous_dialplan_detail_data = dialplan_detail_data; --increment the x x = x + 1;