diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua index d07f6090f8..1925250d38 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua @@ -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, [[ ]]);