Update ivr.conf.lua

If the IVR Menu recordings are base64 don't update the path.
This commit is contained in:
FusionPBX 2016-06-24 18:40:14 -06:00 committed by GitHub
parent 3e2dea7b70
commit 8f26972c20
1 changed files with 8 additions and 5 deletions

View File

@ -83,10 +83,11 @@
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 (settings.recordings.storage_type == "base64") then if (settings.recordings.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 recording_base64 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
@ -102,6 +103,7 @@
if (string.len(row["recording_base64"]) > 32) then if (string.len(row["recording_base64"]) > 32) then
local file = io.open(ivr_menu_greet_long, "w"); local file = io.open(ivr_menu_greet_long, "w");
file:write(base64.decode(row["recording_base64"])); file:write(base64.decode(row["recording_base64"]));
file:write(row["recording_base64"]);
file:close(); file:close();
end end
end); end);
@ -179,6 +181,7 @@
end); end);
end end
end end
elseif (settings.recordings.storage_type == "http_cache") then elseif (settings.recordings.storage_type == "http_cache") then
--add the path to file name --add the path to file name
ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long; ivr_menu_greet_long = storage_path.."/"..ivr_menu_greet_long;
@ -188,7 +191,7 @@
end end
--greet long --greet long
if (not file_exists(ivr_menu_greet_long)) then if (not ivr_menu_greet_long_is_base64 and not file_exists(ivr_menu_greet_long)) then
if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then
ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long;
elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then
@ -198,7 +201,7 @@
--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(ivr_menu_greet_short)) then if (not ivr_menu_greet_short_is_base64 and not file_exists(ivr_menu_greet_short)) then
if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then if (file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then
ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long; ivr_menu_greet_short = recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long;
elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_greet_long)) then
@ -210,7 +213,7 @@
end end
--invalid sound --invalid sound
if (not file_exists(ivr_menu_invalid_sound)) then if (not ivr_menu_invalid_sound_is_base64 and not file_exists(ivr_menu_invalid_sound)) then
if (file_exists(recordings_dir.."/"..domain_name.. "/"..ivr_menu_invalid_sound)) then if (file_exists(recordings_dir.."/"..domain_name.. "/"..ivr_menu_invalid_sound)) then
ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound; ivr_menu_invalid_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound;
elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_invalid_sound)) then elseif (file_exists(sounds_dir.."/en/us/callie/8000/"..ivr_menu_invalid_sound)) then
@ -219,7 +222,7 @@
end end
--exit sound --exit sound
if (not file_exists(ivr_menu_exit_sound)) then if (not ivr_menu_exit_sound_is_base64 and not file_exists(ivr_menu_exit_sound)) then
if (file_exists(recordings_dir.."/"..ivr_menu_exit_sound)) then if (file_exists(recordings_dir.."/"..ivr_menu_exit_sound)) then
if (ivr_menu_exit_sound ~= nil and ivr_menu_exit_sound ~= "") then if (ivr_menu_exit_sound ~= nil and ivr_menu_exit_sound ~= "") then
ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound; ivr_menu_exit_sound = recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound;