From a11a32e6067ec0ce41be393bc07dae95a0c898cd Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 27 May 2013 18:55:59 +0000 Subject: [PATCH] Remove the need to define the recordings_dir to set variable in the *732 dialplan but leave it as an optional so it is backwards compatible and remains customizable. --- includes/install/scripts/recordings.lua | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/includes/install/scripts/recordings.lua b/includes/install/scripts/recordings.lua index 9c81a9eeaa..b5e6c2d6f0 100644 --- a/includes/install/scripts/recordings.lua +++ b/includes/install/scripts/recordings.lua @@ -22,15 +22,21 @@ -- Contributor(s): -- Mark J Crane -pin_number = ""; -max_tries = "3"; -digit_timeout = "3000"; -sounds_dir = ""; -recordings_dir = ""; -file_name = ""; -recording_number = ""; -recording_slots = ""; -recording_prefix = ""; +--set the variables + pin_number = ""; + max_tries = "3"; + digit_timeout = "3000"; + sounds_dir = ""; + recordings_dir = ""; + file_name = ""; + recording_number = ""; + recording_slots = ""; + recording_prefix = ""; + +--include config.lua + scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1)); + dofile(scripts_dir.."/resources/functions/config.lua"); + dofile(config()); --dtmf call back function detects the "#" and ends the call function onInput(s, type, obj) @@ -131,7 +137,22 @@ if ( session:ready() ) then --get the dialplan variables and set them as local variables pin_number = session:getVariable("pin_number"); sounds_dir = session:getVariable("sounds_dir"); - recordings_dir = session:getVariable("recordings_dir"); + domain_name = session:getVariable("domain_name"); + + --set the base recordings dir + base_recordings_dir = recordings_dir; + + --get the recordings from the config.lua and append the domain_name if the system is multi-tenant + if (domain_count > 1) then + recordings_dir = recordings_dir .. "/" .. domain_name; + end + + --use the recording_dir when the variable is set + if (session:getVariable("recordings_dir")) then + if (base_recordings_dir ~= session:getVariable("recordings_dir")) then + recordings_dir = session:getVariable("recordings_dir"); + end + end --set the sounds path for the language, dialect and voice default_language = session:getVariable("default_language");