From 090d4580d676d3010fea41e5f62c2a9e6f6a2480 Mon Sep 17 00:00:00 2001 From: Mark J Crane Date: Mon, 20 Oct 2025 14:29:28 -0600 Subject: [PATCH] Add the hostname cache prefix --- .../resources/scripts/app/feature_event/index.lua | 5 ++++- app/switch/resources/scripts/call_forward.lua | 7 +++++-- app/switch/resources/scripts/dial_string.lua | 13 +++++++++---- app/switch/resources/scripts/do_not_disturb.lua | 7 +++++-- app/switch/resources/scripts/follow_me.lua | 8 ++++++-- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/switch/resources/scripts/app/feature_event/index.lua b/app/switch/resources/scripts/app/feature_event/index.lua index f3f75f1788..970c9f3fda 100644 --- a/app/switch/resources/scripts/app/feature_event/index.lua +++ b/app/switch/resources/scripts/app/feature_event/index.lua @@ -44,6 +44,9 @@ --prepare the api object api = freeswitch.API(); +--get the hostname + local hostname = api:execute("hostname", ""); + --define the functions require "resources.functions.trim"; require "resources.functions.explode"; @@ -355,5 +358,5 @@ end --clear the cache if (feature_enabled ~= nil) then - cache.del("directory:"..user.."@"..host) + cache.del(hostname.."directory:"..user.."@"..host) end diff --git a/app/switch/resources/scripts/call_forward.lua b/app/switch/resources/scripts/call_forward.lua index 7e972daa3c..a4eea279f8 100644 --- a/app/switch/resources/scripts/call_forward.lua +++ b/app/switch/resources/scripts/call_forward.lua @@ -34,6 +34,9 @@ --create the api object api = freeswitch.API(); +--get the hostname + local hostname = api:execute("hostname", ""); + --includes require "resources.functions.config"; require "resources.functions.channel_utils"; @@ -305,9 +308,9 @@ --clear the cache if extension and #extension > 0 and cache.support() then - cache.del("directory:"..extension.."@"..domain_name); + cache.del(hostname..":directory:"..extension.."@"..domain_name); if #number_alias > 0 then - cache.del("directory:"..number_alias.."@"..domain_name); + cache.del(hostname.."directory:"..number_alias.."@"..domain_name); end end diff --git a/app/switch/resources/scripts/dial_string.lua b/app/switch/resources/scripts/dial_string.lua index cfc1b8010d..6de3128ea4 100644 --- a/app/switch/resources/scripts/dial_string.lua +++ b/app/switch/resources/scripts/dial_string.lua @@ -25,8 +25,13 @@ --set default variables max_tries = "3"; digit_timeout = "5000"; + +--create the api object api = freeswitch.API(); +--get the hostname + local hostname = api:execute("hostname", ""); + --set the debug level debug["sql"] = false; debug["var"] = false; @@ -230,17 +235,17 @@ if ( session:ready() ) then --clear the cache if (user_name ~= nil and context ~= nil) then if (cache.support()) then - cache.del("directory:"..user_name.."@"..context); + cache.del(hostname..":directory:"..user_name.."@"..context); if #number_alias > 0 then - cache.del("directory:"..number_alias.."@"..domain_name); + cache.del(hostname..":directory:"..number_alias.."@"..domain_name); end end end if (db_extension ~= nil and context ~= nil) then if (cache.support()) then - cache.del("directory:"..db_extension.."@"..context); + cache.del(hostname..":directory:"..db_extension.."@"..context); if #number_alias > 0 then - cache.del("directory:"..number_alias.."@"..domain_name); + cache.del(hostname..":directory:"..number_alias.."@"..domain_name); end end end diff --git a/app/switch/resources/scripts/do_not_disturb.lua b/app/switch/resources/scripts/do_not_disturb.lua index cdd2c42d83..1ee42dd925 100644 --- a/app/switch/resources/scripts/do_not_disturb.lua +++ b/app/switch/resources/scripts/do_not_disturb.lua @@ -37,6 +37,9 @@ --create the api object api = freeswitch.API(); +--get the hostname + local hostname = api:execute("hostname", ""); + --include config.lua require "resources.functions.config"; @@ -262,9 +265,9 @@ --clear the cache if extension and #extension > 0 and cache.support() then - cache.del("directory:"..extension.."@"..context); + cache.del(hostname..":directory:"..extension.."@"..context); if #number_alias > 0 then - cache.del("directory:"..number_alias.."@"..context); + cache.del(hostname..":directory:"..number_alias.."@"..context); end end diff --git a/app/switch/resources/scripts/follow_me.lua b/app/switch/resources/scripts/follow_me.lua index fd37d87f79..deadaa086d 100644 --- a/app/switch/resources/scripts/follow_me.lua +++ b/app/switch/resources/scripts/follow_me.lua @@ -28,6 +28,10 @@ --create the api object api = freeswitch.API(); +--get the hostname + local hostname = api:execute("hostname", ""); + +--include and initialize additional objects require "resources.functions.channel_utils"; local log = require "resources.functions.log".follow_me local cache = require "resources.functions.cache" @@ -133,9 +137,9 @@ --clear the cache if (extension ~= nil) and cache.support() then - cache.del("directory:"..extension.."@"..domain_name); + cache.del(hostname..":directory:"..extension.."@"..domain_name); if #number_alias > 0 then - cache.del("directory:"..number_alias.."@"..domain_name); + cache.del(hostname..":directory:"..number_alias.."@"..domain_name); end end