Add voicemail storage path variables.

This commit is contained in:
Mark Crane
2015-04-06 07:08:17 +00:00
parent 344f84ff17
commit 4749b99a7e
2 changed files with 17 additions and 14 deletions

View File

@@ -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

View File

@@ -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