Add the dialplan context to the debug filename. Add a uuid attribute to make it easier to trouble shoot.
This commit is contained in:
@@ -80,7 +80,15 @@
|
|||||||
|
|
||||||
--handle the directory
|
--handle the directory
|
||||||
if (XML_REQUEST["section"] == "directory" and key and user and domain_name) then
|
if (XML_REQUEST["section"] == "directory" and key and user and domain_name) then
|
||||||
|
|
||||||
|
--prevent processing for invalid user
|
||||||
|
continue = true;
|
||||||
|
if (user == "*97") then
|
||||||
|
continue = false;
|
||||||
|
end
|
||||||
|
|
||||||
--get the extension from the database
|
--get the extension from the database
|
||||||
|
if (continue) then
|
||||||
sql = "SELECT * FROM v_extensions WHERE domain_uuid = '" .. domain_uuid .. "' and extension = '" .. user .. "' and enabled = 'true' ";
|
sql = "SELECT * FROM v_extensions WHERE domain_uuid = '" .. domain_uuid .. "' and extension = '" .. user .. "' and enabled = 'true' ";
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
||||||
@@ -145,9 +153,10 @@
|
|||||||
if (string.len(row.dial_string) > 0) then
|
if (string.len(row.dial_string) > 0) then
|
||||||
dial_string = row.dial_string;
|
dial_string = row.dial_string;
|
||||||
else
|
else
|
||||||
dial_string = "{sip_invite_domain=${domain_name},presence_id=${dialed_user}@${domain_name}}${sofia_contact(${dialed_user}@${domain_name})}";
|
dial_string = "{sip_invite_domain=" .. domain_name .. ",presence_id=" .. user .. "@" .. domain_name .. "}${sofia_contact(" .. user .. "@" .. domain_name .. ")}";
|
||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
|
end
|
||||||
|
|
||||||
--outbound hot desking - get the extension variables
|
--outbound hot desking - get the extension variables
|
||||||
sql = "SELECT * FROM v_extensions WHERE dial_domain = '" .. domain_name .. "' and dial_user = '" .. user .. "' and enabled = 'true' ";
|
sql = "SELECT * FROM v_extensions WHERE dial_domain = '" .. domain_name .. "' and dial_user = '" .. user .. "' and enabled = 'true' ";
|
||||||
@@ -156,6 +165,7 @@
|
|||||||
end
|
end
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, function(row)
|
||||||
--variables
|
--variables
|
||||||
|
extension_uuid = row.extension_uuid;
|
||||||
domain_uuid = row.domain_uuid;
|
domain_uuid = row.domain_uuid;
|
||||||
sip_from_user = row.extension;
|
sip_from_user = row.extension;
|
||||||
call_group = row.call_group;
|
call_group = row.call_group;
|
||||||
@@ -188,15 +198,15 @@
|
|||||||
table.insert(xml, [[ <domain name="]] .. domain_name .. [[">]]);
|
table.insert(xml, [[ <domain name="]] .. domain_name .. [[">]]);
|
||||||
if (number_alias) then
|
if (number_alias) then
|
||||||
if (cidr) then
|
if (cidr) then
|
||||||
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. cidr .. number_alias .. [[>]]);
|
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. cidr .. number_alias .. [[ uuid="]] .. extension_uuid .. [[">]]);
|
||||||
else
|
else
|
||||||
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. number_alias .. [[>]]);
|
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. number_alias .. [[ uuid="]] .. extension_uuid .. [[">]]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (cidr) then
|
if (cidr) then
|
||||||
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. cidr .. [[>]]);
|
table.insert(xml, [[ <user id="]] .. extension .. [["]] .. cidr .. [[ uuid="]] .. extension_uuid .. [[">]]);
|
||||||
else
|
else
|
||||||
table.insert(xml, [[ <user id="]] .. extension .. [[">]]);
|
table.insert(xml, [[ <user id="]] .. extension .. [[" uuid="]] .. extension_uuid .. [[">]]);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(xml, [[ <params>]]);
|
table.insert(xml, [[ <params>]]);
|
||||||
@@ -401,7 +411,7 @@
|
|||||||
|
|
||||||
--open the tags
|
--open the tags
|
||||||
if (dialplan_tag_status == "closed") then
|
if (dialplan_tag_status == "closed") then
|
||||||
table.insert(xml, [[ <extension name="]] .. dialplan_name .. [[" continue="]] .. dialplan_continue .. [[">]]);
|
table.insert(xml, [[ <extension name="]] .. dialplan_name .. [[" continue="]] .. dialplan_continue .. [[" uuid="]] .. dialplan_uuid .. [[">]]);
|
||||||
dialplan_tag_status = "open";
|
dialplan_tag_status = "open";
|
||||||
end
|
end
|
||||||
if (dialplan_detail_tag == "condition") then
|
if (dialplan_detail_tag == "condition") then
|
||||||
@@ -513,7 +523,7 @@
|
|||||||
|
|
||||||
--send the xml to the console
|
--send the xml to the console
|
||||||
if (debug["xml_string"]) then
|
if (debug["xml_string"]) then
|
||||||
local file = assert(io.open("/tmp/dialplan.xml", "w"));
|
local file = assert(io.open("/tmp/dialplan-" .. call_context .. ".xml", "w"));
|
||||||
file:write(XML_STRING);
|
file:write(XML_STRING);
|
||||||
file:close();
|
file:close();
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user