From 0fac90e387c0943c417bc98605d602b98df22d78 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 10 Apr 2019 09:46:30 -0600 Subject: [PATCH] Update index.lua --- .../install/scripts/app/is_local/index.lua | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) 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");