Change xml handler load balancing to xml_handler/resources/scripts/directory/directory.lua["fs_path"]

This commit is contained in:
markjcrane
2015-10-08 11:03:48 -07:00
parent d0ac25c265
commit d667a31140
2 changed files with 14 additions and 11 deletions

View File

@@ -189,7 +189,10 @@ if ($domains_processed == 1) {
$tmp .= " expire[\"languages\"] = \"3600\";\n";
$tmp .= " expire[\"sofia.conf\"] = \"3600\";\n";
$tmp .= " expire[\"acl.conf\"] = \"3600\";\n";
$tmp .= " load_balancing = false;\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler[\"fs_path\"] = false;\n";
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug[\"params\"] = false;\n";

View File

@@ -99,13 +99,13 @@
dialed_extension = params:getHeader("dialed_extension");
if (dialed_extension == nil) then
--freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is null\n");
load_balancing = false;
xml_handler["fs_path"] = false;
else
--freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is " .. dialed_extension .. "\n");
end
--build the XML string from the database
if (source == "database") or (load_balancing) then
if (source == "database") or (xml_handler["fs_path"]) then
--database connection
if (continue) then
--connect to the database
@@ -138,7 +138,7 @@
--if load balancing is set to true then get the hostname
if (continue) then
if (load_balancing) then
if (xml_handler["fs_path"]) then
--get the domain_name from domains
if (domain_name == nil) then
@@ -181,9 +181,9 @@
--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
--hostname was not found set xml_handler["fs_path"] to false to prevent a database_hostname concatenation error
if (database_hostname == nil) then
load_balancing = false;
xml_handler["fs_path"] = false;
end
--close the database connection
@@ -261,7 +261,7 @@
dial_string = "{sip_invite_domain=" .. domain_name .. ",presence_id=" .. user .. "@" .. domain_name .. "}${sofia_contact(" .. extension .. "@" .. domain_name .. ")}";
end
--set the an alternative dial string if the hostnames don't match
if (load_balancing) then
if (xml_handler["fs_path"]) then
if (local_hostname == database_hostname) then
freeswitch.consoleLog("notice", "[xml_handler-directory.lua] local_host and database_host are the same\n");
else
@@ -271,13 +271,13 @@
--freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dial_string " .. dial_string .. "\n");
end
else
--freeswitch.consoleLog("notice", "[xml_handler-directory.lua] seems balancing is false??" .. tostring(load_balancing) .. "\n");
--freeswitch.consoleLog("notice", "[xml_handler-directory.lua] seems balancing is false??" .. tostring(xml_handler["fs_path"]) .. "\n");
end
--show debug informationa
--if (load_balancing) then
-- freeswitch.consoleLog("notice", "[xml_handler] local_hostname: " .. local_hostname.. " database_hostname: " .. database_hostname .. " dial_string: " .. dial_string .. "\n");
--end
if (xml_handler["fs_path"]) then
freeswitch.consoleLog("notice", "[xml_handler] local_hostname: " .. local_hostname.. " database_hostname: " .. database_hostname .. " dial_string: " .. dial_string .. "\n");
end
end
end);
end