Merge pull request #1420 from moteus/fix_partial_dialplan
Fix. Do not build context if there error.
This commit is contained in:
commit
254ecafad3
|
|
@ -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,26 @@
|
|||
|
||||
--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
|
||||
log.errf('context: %s, extension: %s, type: %s, data: %s ',
|
||||
call_context,
|
||||
dialplan_name or '----',
|
||||
dialplan_detail_tag or '----',
|
||||
dialplan_detail_data or '----'
|
||||
)
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
|
||||
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>]]);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ local function tracef(type, name, level, ...)
|
|||
end
|
||||
|
||||
local LEVELS = {
|
||||
'error',
|
||||
'err',
|
||||
'warning',
|
||||
'notice',
|
||||
'info',
|
||||
|
|
|
|||
Loading…
Reference in New Issue