From 2ccc8c8b12857b790657385ba320826810704d09 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 9 Oct 2023 19:52:13 -0600 Subject: [PATCH] Change how the virtual extension is disabled Made this change because if the XML is not generated then extension variables are not available. These variables are needed for call forward and follow me. --- .../resources/scripts/directory/directory.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 9a91b7d81c..921858748f 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -284,13 +284,12 @@ --get the extension from the database if (continue) then - local sql = "SELECT e.* FROM v_extensions as e, v_domains as d " + local sql = "SELECT e.*, random() FROM v_extensions as e, v_domains as d " .. "WHERE e.domain_uuid = :domain_uuid " .. "AND d.domain_uuid = :domain_uuid " .. "AND d.domain_enabled = 'true' " .. "AND (e.extension = :user or e.number_alias = :user) " - .. "AND e.enabled = 'true' " - .. "AND (e.extension_type = 'default' or extension_type is null) "; + .. "AND e.enabled = 'true' "; local params = {domain_uuid=domain_uuid, user=user}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -370,6 +369,11 @@ forward_user_not_registered_destination = row.forward_user_not_registered_destination; do_not_disturb = row.do_not_disturb; + --if the extension is virtual set register to false + if (row.extension_type == 'virtual') then + auth_acl = 'virtual.' .. row.random; + end + -- get the follow me information if (row.follow_me_uuid ~= nil and string.len(row.follow_me_uuid) > 0) then follow_me_uuid = row.follow_me_uuid; @@ -531,7 +535,7 @@ xml:append([[ ]]); end if (string.len(auth_acl) > 0) then - xml:append([[ ]]); + xml:append([[ ]]); end xml:append([[ ]]); xml:append([[ ]]); @@ -539,6 +543,7 @@ xml:append([[ ]]); xml:append([[ ]]); xml:append([[ ]]); + for key,row in pairs(extension_settings) do if (row.extension_setting_type == 'param') then xml:append([[ ]]);