diff --git a/resources/install/scripts/app/voicemail/resources/functions/choose_greeting.lua b/resources/install/scripts/app/voicemail/resources/functions/choose_greeting.lua index ae134dd416..227ce1ef39 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/choose_greeting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/choose_greeting.lua @@ -96,8 +96,7 @@ end); end elseif (storage_type == "http_cache") then - --need additional work - + greeting_location = storage_path.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"; --vm_message_ext; end --play the greeting diff --git a/resources/install/scripts/app/voicemail/resources/functions/forward_to_extension.lua b/resources/install/scripts/app/voicemail/resources/functions/forward_to_extension.lua index 5664b138d2..fe3922a2fb 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/forward_to_extension.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/forward_to_extension.lua @@ -67,6 +67,7 @@ message_length = row["message_length"]; message_status = row["message_status"]; message_priority = row["message_priority"]; + message_base64 = row["message_base64"]; end); end @@ -95,6 +96,9 @@ table.insert(sql, "voicemail_message_uuid, "); table.insert(sql, "domain_uuid, "); table.insert(sql, "voicemail_uuid, "); + if (storage_type == "base64") then + table.insert(sql, "message_base64, "); + end table.insert(sql, "created_epoch, "); table.insert(sql, "caller_id_name, "); table.insert(sql, "caller_id_number, "); @@ -107,6 +111,9 @@ table.insert(sql, "'".. voicemail_message_uuid .."', "); table.insert(sql, "'".. domain_uuid .."', "); table.insert(sql, "'".. forward_voicemail_uuid .."', "); + if (storage_type == "base64") then + table.insert(sql, "'".. message_base64 .."', "); + end table.insert(sql, "'".. created_epoch .."', "); table.insert(sql, "'".. caller_id_name .."', "); table.insert(sql, "'".. caller_id_number .."', "); @@ -118,7 +125,17 @@ if (debug["sql"]) then freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n"); end - dbh:query(sql); + if (storage_type == "base64") then + array = explode("://", database["system"]); + local luasql = require "luasql.postgres"; + local env = assert (luasql.postgres()); + local dbh = env:connect(array[2]); + res, serr = dbh:execute(sql); + dbh:close(); + env:close(); + else + dbh:query(sql); + end --set the message waiting event local event = freeswitch.Event("message_waiting"); diff --git a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua index 19eef4a34d..ccd4375dd3 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua @@ -82,21 +82,26 @@ end); end elseif (storage_type == "http_cache") then - --need additional work + message_location = storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext; end --play the message if (session:ready()) then if (string.len(dtmf_digits) == 0) then stream_seek = true; - if (vm_message_ext == "mp3") then - if (api:executeString("module_exists mod_vlc") == "true") then - session:streamFile("vlc://"..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + if (storage_type == "http_cache") then + message_location = storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext; + session:streamFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + else + if (vm_message_ext == "mp3") then + if (api:executeString("module_exists mod_vlc") == "true") then + session:streamFile("vlc://"..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + else + session:streamFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + end else session:streamFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); end - else - session:streamFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); end stream_seek = false; session:streamFile("silence_stream://1000"); diff --git a/resources/install/scripts/app/voicemail/resources/functions/play_greeting.lua b/resources/install/scripts/app/voicemail/resources/functions/play_greeting.lua index 8ca2191c88..0d08d99101 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/play_greeting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/play_greeting.lua @@ -64,14 +64,17 @@ file:write(base64.decode(row["greeting_base64"])); file:close(); end + --custom greeting + session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); end); end elseif (storage_type == "http_cache") then - --need additional work + session:streamFile(storage_path.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); + else + session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); end - --custom greeting - session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); + --sleep session:streamFile("silence_stream://200"); else --default greeting diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua index 870811325c..9620e42ce9 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua @@ -110,11 +110,11 @@ session:execute(action, data); end end - + --clear the variables action = ""; data = ""; - + --inrement the option count count = count + 1; end); --end results @@ -127,8 +127,8 @@ session:transfer(dtmf_digits.." XML "..context); end end - end - + end + end end end @@ -146,21 +146,25 @@ max_len_seconds = 300; silence_threshold = 30; silence_seconds = 5; - mkdir(voicemail_dir.."/"..voicemail_id); - if (vm_message_ext == "mp3") then - --make the recording - --session:execute("record", "vlc://#standard{access=file,mux=mp3,dst="..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.."}"); - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, silence_threshold, silence_seconds); - --convert the wav to an mp3 - --apt-get install lame - resample = "/usr/bin/lame -b 32 --resample 8 -m s "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3"; - session:execute("system", resample); - --delete the wav file - if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3")) then - os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav"); - end + if (storage_path == "http_cache") then + result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds); else - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds); + mkdir(voicemail_dir.."/"..voicemail_id); + if (vm_message_ext == "mp3") then + --make the recording + --session:execute("record", "vlc://#standard{access=file,mux=mp3,dst="..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.."}"); + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, silence_threshold, silence_seconds); + --convert the wav to an mp3 + --apt-get install lame + resample = "/usr/bin/lame -b 32 --resample 8 -m s "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3"; + session:execute("system", resample); + --delete the wav file + if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3")) then + os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav"); + end + else + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds); + end end --session:execute("record", voicemail_dir.."/"..uuid.." 180 200");