From e7d3d5c934034e54f12caab30ee3f84999530eb6 Mon Sep 17 00:00:00 2001 From: luis daniel lucio quiroz Date: Mon, 23 Dec 2013 20:21:25 +0000 Subject: [PATCH] previous changes reverted, agreed with mcrane --- .../resources/scripts/directory/directory.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 4fc3ced1f9..9dd2af8048 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -91,15 +91,10 @@ --set the variable from the params dialed_extension = params:getHeader("dialed_extension"); if (dialed_extension == nil) then - freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is null, trying to build from user\n"); - if (user == nil) then - load_balancing = false; - else - dialed_extension = user; - freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension built from user: " .. dialed_extension .. "\n"); - end + --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is null\n"); + load_balancing = false; else - freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is " .. dialed_extension .. "\n"); + --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is " .. dialed_extension .. "\n"); end --if load balancing is set to true then get the hostname @@ -133,16 +128,15 @@ sql = "SELECT hostname FROM registrations "; sql = sql .. "WHERE reg_user = '"..dialed_extension.."' "; sql = sql .. "AND realm = '"..domain_name.."'"; - dbh:query(sql, function(row) + status = dbh_switch:query(sql, function(row) database_hostname = row["hostname"]; end); --freeswitch.consoleLog("notice", "[xml_handler] sql: " .. sql .. "\n"); + --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] database_hostname is " .. database_hostname .. "\n"); --hostname was not found set load_balancing to false to prevent a database_hostname concatenation error if (database_hostname == nil) then load_balancing = false; - else - --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] database_hostname is " .. database_hostname .. "\n"); end --close the database connection @@ -280,6 +274,9 @@ end); end + --close the database connection + dbh:release(); + --set the xml array and then concatenate the array to a string if (continue and password) then --build the xml