From b194261635cb26a5d215f7ca28149b8bece59fe2 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 6 Apr 2015 07:08:17 +0000 Subject: [PATCH] Add voicemail storage path variables. --- .../install/scripts/app/voicemail/index.lua | 29 ++++++++++--------- .../resources/functions/record_greeting.lua | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/resources/install/scripts/app/voicemail/index.lua b/resources/install/scripts/app/voicemail/index.lua index be51df7c05..03010e91d5 100644 --- a/resources/install/scripts/app/voicemail/index.lua +++ b/resources/install/scripts/app/voicemail/index.lua @@ -122,6 +122,19 @@ domain_uuid = string.lower(domain_uuid); end + --if voicemail_id is non numeric then get the number-alias + if (voicemail_id ~= nil) then + if tonumber(voicemail_id) == nil then + voicemail_id = api:execute("user_data", voicemail_id .. "@" .. domain_name .. " attr number-alias"); + end + end + + --set the voicemail_dir + voicemail_dir = voicemail_dir.."/default/"..domain_name; + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] voicemail_dir: " .. voicemail_dir .. "\n"); + end + --settings dofile(scripts_dir.."/resources/functions/settings.lua"); settings = settings(domain_uuid); @@ -136,6 +149,9 @@ if (settings['voicemail']['storage_path'] ~= nil) then if (settings['voicemail']['storage_path']['text'] ~= nil) then storage_path = settings['voicemail']['storage_path']['text']; + storage_path = storage_path:gsub("${domain_name}", domain_name); + storage_path = storage_path:gsub("${voicemail_id}", voicemail_id); + storage_path = storage_path:gsub("${voicemail_dir}", voicemail_dir); end end end @@ -148,19 +164,6 @@ end end - --if voicemail_id is non numeric then get the number-alias - if (voicemail_id ~= nil) then - if tonumber(voicemail_id) == nil then - voicemail_id = api:execute("user_data", voicemail_id .. "@" .. domain_name .. " attr number-alias"); - end - end - - --set the voicemail_dir - voicemail_dir = voicemail_dir.."/default/"..domain_name; - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] voicemail_dir: " .. voicemail_dir .. "\n"); - end - --get the voicemail settings if (voicemail_id ~= nil) then if (session:ready()) then diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua index 6f9730eeab..4650a6faac 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua @@ -128,6 +128,7 @@ end elseif (storage_type == "http_cache") then freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. " ".. storage_path .."\n"); + storage_path = storage_path:gsub("${domain_name}", domain_name); session:execute("record", storage_path .."/"..recording_name); else --prepare to record the greeting @@ -140,7 +141,6 @@ result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav", max_len_seconds, silence_threshold, silence_seconds); --session:execute("record", voicemail_dir.."/"..uuid.." 180 200"); end - end --use the new greeting