Remove the recordings_dir with automatic domain_name and add domain_name in a few places where it was missing.
This commit is contained in:
parent
7d375d05de
commit
495bafd3f5
|
|
@ -77,115 +77,115 @@
|
||||||
ivr_menu_description = row["ivr_menu_description"];
|
ivr_menu_description = row["ivr_menu_description"];
|
||||||
end);
|
end);
|
||||||
|
|
||||||
--get the recordings from the database
|
--get the recordings from the database
|
||||||
ivr_menu_greet_long_is_base64 = false;
|
ivr_menu_greet_long_is_base64 = false;
|
||||||
ivr_menu_greet_short_is_base64 = false;
|
ivr_menu_greet_short_is_base64 = false;
|
||||||
ivr_menu_invalid_sound_is_base64 = false;
|
ivr_menu_invalid_sound_is_base64 = false;
|
||||||
ivr_menu_exit_sound_is_base64 = false;
|
ivr_menu_exit_sound_is_base64 = false;
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
--greet long
|
--greet long
|
||||||
if (string.len(ivr_menu_greet_long) > 1) then
|
if (string.len(ivr_menu_greet_long) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then
|
||||||
sql = [[SELECT * FROM v_recordings
|
sql = [[SELECT * FROM v_recordings
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..ivr_menu_greet_long..[[' ]];
|
AND recording_filename = ']]..ivr_menu_greet_long..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
||||||
end
|
|
||||||
status = dbh:query(sql, function(row)
|
|
||||||
--add functions
|
|
||||||
require "resources.functions.base64";
|
|
||||||
--add the path to filename
|
|
||||||
ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long;
|
|
||||||
ivr_menu_greet_long_is_base64 = true;
|
|
||||||
--save the recording to the file system
|
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
|
||||||
local file = io.open(ivr_menu_greet_long, "w");
|
|
||||||
file:write(base64.decode(row["recording_base64"]));
|
|
||||||
file:close();
|
|
||||||
end
|
end
|
||||||
end);
|
status = dbh:query(sql, function(row)
|
||||||
end
|
--add functions
|
||||||
end
|
require "resources.functions.base64";
|
||||||
--greet short
|
--add the path to filename
|
||||||
if (string.len(ivr_menu_greet_short) > 1) then
|
ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long;
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then
|
ivr_menu_greet_long_is_base64 = true;
|
||||||
sql = [[SELECT * FROM v_recordings
|
--save the recording to the file system
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
AND recording_filename = ']]..ivr_menu_greet_short..[[' ]];
|
local file = io.open(ivr_menu_greet_long, "w");
|
||||||
if (debug["sql"]) then
|
file:write(base64.decode(row["recording_base64"]));
|
||||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
file:close();
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
status = dbh:query(sql, function(row)
|
--greet short
|
||||||
--add functions
|
if (string.len(ivr_menu_greet_short) > 1) then
|
||||||
require "resources.functions.base64";
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then
|
||||||
--add the path to filename
|
sql = [[SELECT * FROM v_recordings
|
||||||
ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short;
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
ivr_menu_greet_short_is_base64 = true;
|
AND recording_filename = ']]..ivr_menu_greet_short..[[' ]];
|
||||||
--save the recording to the file system
|
if (debug["sql"]) then
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
||||||
local file = io.open(ivr_menu_greet_short, "w");
|
|
||||||
file:write(base64.decode(row["recording_base64"]));
|
|
||||||
file:close();
|
|
||||||
end
|
end
|
||||||
end);
|
status = dbh:query(sql, function(row)
|
||||||
end
|
--add functions
|
||||||
end
|
require "resources.functions.base64";
|
||||||
--invalid sound
|
--add the path to filename
|
||||||
if (string.len(ivr_menu_invalid_sound) > 1) then
|
ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short;
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then
|
ivr_menu_greet_short_is_base64 = true;
|
||||||
sql = [[SELECT * FROM v_recordings
|
--save the recording to the file system
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]];
|
local file = io.open(ivr_menu_greet_short, "w");
|
||||||
if (debug["sql"]) then
|
file:write(base64.decode(row["recording_base64"]));
|
||||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
file:close();
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
status = dbh:query(sql, function(row)
|
--invalid sound
|
||||||
--add functions
|
if (string.len(ivr_menu_invalid_sound) > 1) then
|
||||||
require "resources.functions.base64";
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then
|
||||||
--add the path to filename
|
sql = [[SELECT * FROM v_recordings
|
||||||
ivr_menu_invalid_sound = recordings_dir..domain_name.."/".."/"..ivr_menu_invalid_sound;
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
ivr_menu_invalid_sound_is_base64 = true;
|
AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]];
|
||||||
--save the recording to the file system
|
if (debug["sql"]) then
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
||||||
local file = io.open(ivr_menu_invalid_sound, "w");
|
|
||||||
file:write(base64.decode(row["recording_base64"]));
|
|
||||||
file:close();
|
|
||||||
end
|
end
|
||||||
end);
|
status = dbh:query(sql, function(row)
|
||||||
end
|
--add functions
|
||||||
end
|
require "resources.functions.base64";
|
||||||
--exit sound
|
--add the path to filename
|
||||||
if (string.len(ivr_menu_exit_sound) > 1) then
|
ivr_menu_invalid_sound = recordings_dir..domain_name.."/".."/"..ivr_menu_invalid_sound;
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then
|
ivr_menu_invalid_sound_is_base64 = true;
|
||||||
sql = [[SELECT * FROM v_recordings
|
--save the recording to the file system
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]];
|
local file = io.open(ivr_menu_invalid_sound, "w");
|
||||||
if (debug["sql"]) then
|
file:write(base64.decode(row["recording_base64"]));
|
||||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
file:close();
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
status = dbh:query(sql, function(row)
|
--exit sound
|
||||||
--add functions
|
if (string.len(ivr_menu_exit_sound) > 1) then
|
||||||
require "resources.functions.base64";
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then
|
||||||
--add the path to filename
|
sql = [[SELECT * FROM v_recordings
|
||||||
ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound;
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
ivr_menu_exit_sound_is_base64 = true;
|
AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]];
|
||||||
--save the recording to the file system
|
if (debug["sql"]) then
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
freeswitch.consoleLog("notice", "[ivr_menu] SQL: "..sql.."\n");
|
||||||
local file = io.open(ivr_menu_exit_sound, "w");
|
|
||||||
file:write(base64.decode(row["recording_base64"]));
|
|
||||||
file:close();
|
|
||||||
end
|
end
|
||||||
end);
|
status = dbh:query(sql, function(row)
|
||||||
end
|
--add functions
|
||||||
|
require "resources.functions.base64";
|
||||||
|
--add the path to filename
|
||||||
|
ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound;
|
||||||
|
ivr_menu_exit_sound_is_base64 = true;
|
||||||
|
--save the recording to the file system
|
||||||
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
|
local file = io.open(ivr_menu_exit_sound, "w");
|
||||||
|
file:write(base64.decode(row["recording_base64"]));
|
||||||
|
file:close();
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif (storage_type == "http_cache") then
|
||||||
|
--add the path to file name
|
||||||
|
ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long;
|
||||||
|
ivr_menu_greet_short = storage_path.."/"..ivr_menu_greet_short;
|
||||||
|
ivr_menu_invalid_sound = storage_path.."/"..ivr_menu_invalid_sound;
|
||||||
|
ivr_menu_exit_sound = storage_path.."/"..ivr_menu_exit_sound;
|
||||||
end
|
end
|
||||||
elseif (storage_type == "http_cache") then
|
|
||||||
--add the path to file name
|
|
||||||
ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long;
|
|
||||||
ivr_menu_greet_short = storage_path.."/"..ivr_menu_greet_short;
|
|
||||||
ivr_menu_invalid_sound = storage_path.."/"..ivr_menu_invalid_sound;
|
|
||||||
ivr_menu_exit_sound = storage_path.."/"..ivr_menu_exit_sound;
|
|
||||||
end
|
|
||||||
|
|
||||||
--greet long
|
--greet long
|
||||||
if (not file_exists(ivr_menu_greet_long)) then
|
if (not file_exists(ivr_menu_greet_long)) then
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
-- notice, this list of conditions and the following disclaimer in the
|
-- notice, this list of conditions and the following disclaimer in the
|
||||||
-- documentation and/or other materials provided with the distribution.
|
-- documentation and/or other materials provided with the distribution.
|
||||||
--
|
--
|
||||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||||
|
|
@ -76,8 +76,6 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--add the domain name to the recordings directory
|
|
||||||
recordings_dir = recordings_dir .. "/"..domain_name;
|
|
||||||
|
|
||||||
--set default variable(s)
|
--set default variable(s)
|
||||||
tries = 0;
|
tries = 0;
|
||||||
|
|
@ -202,7 +200,7 @@
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
--greet long
|
--greet long
|
||||||
if (string.len(ivr_menu_greet_long) > 1) then
|
if (string.len(ivr_menu_greet_long) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..greet_long_file_name)) then
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..greet_long_file_name)) then
|
||||||
sql = [[SELECT * FROM v_recordings
|
sql = [[SELECT * FROM v_recordings
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..greet_long_file_name..[[' ]];
|
AND recording_filename = ']]..greet_long_file_name..[[' ]];
|
||||||
|
|
@ -213,7 +211,7 @@
|
||||||
--add functions
|
--add functions
|
||||||
require "resources.functions.base64";
|
require "resources.functions.base64";
|
||||||
--add the path to filename
|
--add the path to filename
|
||||||
ivr_menu_greet_long = recordings_dir.."/"..greet_long_file_name;
|
ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..greet_long_file_name;
|
||||||
ivr_menu_greet_long_is_base64 = true;
|
ivr_menu_greet_long_is_base64 = true;
|
||||||
--save the recording to the file system
|
--save the recording to the file system
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
|
|
@ -226,7 +224,7 @@
|
||||||
end
|
end
|
||||||
--greet short
|
--greet short
|
||||||
if (string.len(ivr_menu_greet_short) > 1) then
|
if (string.len(ivr_menu_greet_short) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..greet_short_file_name)) then
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..greet_short_file_name)) then
|
||||||
sql = [[SELECT * FROM v_recordings
|
sql = [[SELECT * FROM v_recordings
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..greet_short_file_name..[[' ]];
|
AND recording_filename = ']]..greet_short_file_name..[[' ]];
|
||||||
|
|
@ -237,7 +235,7 @@
|
||||||
--add functions
|
--add functions
|
||||||
require "resources.functions.base64";
|
require "resources.functions.base64";
|
||||||
--add the path to filename
|
--add the path to filename
|
||||||
ivr_menu_greet_short = recordings_dir.."/"..greet_short_file_name;
|
ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..greet_short_file_name;
|
||||||
ivr_menu_greet_short_is_base64 = true;
|
ivr_menu_greet_short_is_base64 = true;
|
||||||
--save the recording to the file system
|
--save the recording to the file system
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
|
|
@ -250,7 +248,7 @@
|
||||||
end
|
end
|
||||||
--invalid sound
|
--invalid sound
|
||||||
if (string.len(ivr_menu_invalid_sound) > 1) then
|
if (string.len(ivr_menu_invalid_sound) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..invalid_sound_file_name)) then
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name)) then
|
||||||
sql = [[SELECT * FROM v_recordings
|
sql = [[SELECT * FROM v_recordings
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..invalid_sound_file_name..[[' ]];
|
AND recording_filename = ']]..invalid_sound_file_name..[[' ]];
|
||||||
|
|
@ -261,7 +259,7 @@
|
||||||
--add functions
|
--add functions
|
||||||
require "resources.functions.base64";
|
require "resources.functions.base64";
|
||||||
--add the path to filename
|
--add the path to filename
|
||||||
ivr_menu_invalid_sound = recordings_dir.."/"..invalid_sound_file_name;
|
ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..invalid_sound_file_name;
|
||||||
ivr_menu_invalid_sound_is_base64 = true;
|
ivr_menu_invalid_sound_is_base64 = true;
|
||||||
--save the recording to the file system
|
--save the recording to the file system
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
|
|
@ -274,7 +272,7 @@
|
||||||
end
|
end
|
||||||
--exit sound
|
--exit sound
|
||||||
if (string.len(ivr_menu_exit_sound) > 1) then
|
if (string.len(ivr_menu_exit_sound) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..exit_sound_file_name)) then
|
if (not file_exists(recordings_dir.."/"..domain_name.."/"..exit_sound_file_name)) then
|
||||||
sql = [[SELECT * FROM v_recordings
|
sql = [[SELECT * FROM v_recordings
|
||||||
WHERE domain_uuid = ']]..domain_uuid..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..exit_sound_file_name..[[' ]];
|
AND recording_filename = ']]..exit_sound_file_name..[[' ]];
|
||||||
|
|
@ -285,7 +283,7 @@
|
||||||
--add functions
|
--add functions
|
||||||
require "resources.functions.base64";
|
require "resources.functions.base64";
|
||||||
--add the path to filename
|
--add the path to filename
|
||||||
ivr_menu_exit_sound = recordings_dir.."/"..exit_sound_file_name;
|
ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..exit_sound_file_name;
|
||||||
ivr_menu_exit_sound_is_base64 = true;
|
ivr_menu_exit_sound_is_base64 = true;
|
||||||
--save the recording to the file system
|
--save the recording to the file system
|
||||||
if (string.len(row["recording_base64"]) > 32) then
|
if (string.len(row["recording_base64"]) > 32) then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue