diff --git a/resources/install/scripts/app/is_local/index.lua b/resources/install/scripts/app/is_local/index.lua index 86f1017750..83353d207a 100644 --- a/resources/install/scripts/app/is_local/index.lua +++ b/resources/install/scripts/app/is_local/index.lua @@ -51,16 +51,6 @@ value, err = cache.get(key); if (err == 'NOT FOUND') then - --set the outbound caller id - if (outbound_caller_id_name ~= nil) then - session:execute("set", "caller_id_name="..outbound_caller_id_name); - session:execute("set", "effective_caller_id_name="..outbound_caller_id_name); - end - if (outbound_caller_id_number ~= nil) then - session:execute("set", "caller_id_number="..outbound_caller_id_number); - session:execute("set", "effective_caller_id_number="..outbound_caller_id_number); - end - --connect to the database local Database = require "resources.functions.database"; local dbh = Database.new('system'); @@ -94,6 +84,16 @@ --log the result freeswitch.consoleLog("notice", "[app:dialplan:outbound:is_local] " .. row.destination_number .. " XML " .. destination_context .. " source: database\n"); + --set the outbound caller id + if (outbound_caller_id_name ~= nil) then + session:execute("set", "caller_id_name="..outbound_caller_id_name); + session:execute("set", "effective_caller_id_name="..outbound_caller_id_name); + end + if (outbound_caller_id_number ~= nil) then + session:execute("set", "caller_id_number="..outbound_caller_id_number); + session:execute("set", "effective_caller_id_number="..outbound_caller_id_number); + end + --transfer the call session:transfer(row.destination_number, "XML", row.destination_context); end); @@ -116,6 +116,16 @@ var[key] = value; end + --set the outbound caller id + if (outbound_caller_id_name ~= nil) then + session:execute("set", "caller_id_name="..outbound_caller_id_name); + session:execute("set", "effective_caller_id_name="..outbound_caller_id_name); + end + if (outbound_caller_id_number ~= nil) then + session:execute("set", "caller_id_number="..outbound_caller_id_number); + session:execute("set", "effective_caller_id_number="..outbound_caller_id_number); + end + --send to the console freeswitch.consoleLog("notice", "[app:dialplan:outbound:is_local] " .. value .. " source: cache\n");