Make storage_path and storage_type = http_cache work (#3892)

* Make storage_path work

if storage_path was set, the script would fail. I have fixed it by removing the references to unset variables. I also made the recordings use the path.

* Update ivr.conf.lua

Add storage_path definition so storage_type of http_cache works correctly
This commit is contained in:
timando 2018-12-04 13:25:04 +10:00 committed by FusionPBX
parent d3374a0aeb
commit 804b7ca91e
2 changed files with 14 additions and 7 deletions

View File

@ -95,7 +95,11 @@
local settings = Settings.new(dbh, domain_name, domain_uuid)
local storage_type = settings:get('recordings', 'storage_type', 'text')
local storage_path = settings:get('recordings', 'storage_path', 'text')
if (storage_path != nil then
storage_path = storage_path:gsub("${domain_name}", domain_name)
storage_path = storage_path:gsub("${domain_uuid}", domain_uuid)
end
--get the recordings from the database
ivr_menu_greet_long_is_base64 = false;
ivr_menu_greet_short_is_base64 = false;

View File

@ -70,9 +70,8 @@
if (settings['recordings']['storage_path'] ~= nil) then
if (settings['recordings']['storage_path']['text'] ~= nil) then
storage_path = settings['recordings']['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);
storage_path = storage_path:gsub("${domain_name}", session:getVariable("domain_name"));
storage_path = storage_path:gsub("${domain_uuid}", domain_uuid);
end
end
end
@ -130,14 +129,14 @@
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
session:execute("set", "playback_terminators=#");
--make the directory
mkdir(recordings_dir);
--begin recording
if (storage_type == "base64") then
--include the file io
local file = require "resources.functions.file"
--make the directory
mkdir(recordings_dir);
--record the file to the file system
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs);
session:execute("record", recordings_dir .."/".. recording_name);
@ -152,6 +151,7 @@
freeswitch.consoleLog("notice", "[recordings] ".. storage_type .. " ".. storage_path .."\n");
session:execute("record", storage_path .."/"..recording_name);
else
freeswitch.consoleLog("notice", "[recordings] ".. storage_type .. " ".. recordings_dir .."\n");
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs);
session:execute("record", "'"..recordings_dir.."/"..recording_name.."' 10800 500 500");
end
@ -270,6 +270,9 @@ if ( session:ready() ) then
--add the domain name to the recordings directory
recordings_dir = recordings_dir .. "/"..domain_name;
--if a recording directory is specified, use that instead
if storage_path ~= nil then recordings_dir = storage_path; end
--set the sounds path for the language, dialect and voice
default_language = session:getVariable("default_language");
default_dialect = session:getVariable("default_dialect");