When using sip_to_user set before the dialplan_cache_key

To get use the sip_to_user  it needs to be set before the cache
This commit is contained in:
FusionPBX 2022-09-22 16:26:49 -06:00 committed by GitHub
parent f4b9a3331c
commit 49aa12067b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -110,7 +110,11 @@
if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then
context_name = 'public'; context_name = 'public';
end end
--freeswitch.consoleLog("notice", "[xml_handler] ".. dialplan_mode .. " key:" .. dialplan_cache_key .. "\n");
--use alternative sip_to_user instead of the default
if (dialplan_destination == '${sip_to_user}' or dialplan_destination == 'sip_to_user') then
destination_number = api:execute("url_decode", sip_to_user);
end
--set the dialplan cache key --set the dialplan cache key
local dialplan_cache_key = "dialplan:" .. call_context; local dialplan_cache_key = "dialplan:" .. call_context;
@ -118,10 +122,8 @@
dialplan_cache_key = "dialplan:" .. call_context .. ":" .. destination_number; dialplan_cache_key = "dialplan:" .. call_context .. ":" .. destination_number;
end end
--use alternative sip_to_user instead of the default --log the dialplan mode and dialplan cache key
if (dialplan_destination == '${sip_to_user}') then freeswitch.consoleLog("notice", "[xml_handler] ".. dialplan_mode .. " key:" .. dialplan_cache_key .. "\n");
destination_number = api:execute("url_decode", sip_to_user);
end
--get the cache --get the cache
XML_STRING, err = cache.get(dialplan_cache_key); XML_STRING, err = cache.get(dialplan_cache_key);
@ -153,7 +155,7 @@
table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]); table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]);
table.insert(xml, [[<document type="freeswitch/xml">]]); table.insert(xml, [[<document type="freeswitch/xml">]]);
table.insert(xml, [[ <section name="dialplan" description="">]]); table.insert(xml, [[ <section name="dialplan" description="">]]);
table.insert(xml, [[ <context name="]] .. call_context .. [[">]]); table.insert(xml, [[ <context name="]] .. call_context .. [[" destination_number="]]..destination_number..[[" hostname="]]..hostname..[[">]]);
--get the dialplan xml --get the dialplan xml
if (context_name == 'public' and dialplan_mode == 'single') then if (context_name == 'public' and dialplan_mode == 'single') then