Fix. Do not build context if there error.

This commit is contained in:
Alexey Melnichuk
2016-02-02 19:08:19 +03:00
parent be2c690a1d
commit 057d487ee7

View File

@@ -108,8 +108,12 @@
if (debug["sql"]) then
log.notice("SQL: " .. sql);
end
x = 0;
local x = 0;
local pass
dbh:query(sql, function(row)
--clear flag pass
pass = false
--get the dialplan
domain_uuid = row.domain_uuid;
dialplan_uuid = row.dialplan_uuid;
@@ -281,8 +285,16 @@
--increment the x
x = x + 1;
--set flag pass
pass = true
end);
-- prevent partial dialplan (pass=nil may be error in sql or empty resultset)
if pass == false then
error('error while build context: ' .. call_context)
end
--close the extension tag if it was left open
if (dialplan_tag_status == "open") then
table.insert(xml, [[ </condition>]]);