diff --git a/app/switch/resources/conf/languages/ar/vm/voicemail.xml b/app/switch/resources/conf/languages/ar/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/ar/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ar/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/de/vm/voicemail.xml b/app/switch/resources/conf/languages/de/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/de/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/de/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/en/vm/voicemail.xml b/app/switch/resources/conf/languages/en/vm/voicemail.xml index 8248ae596d..871763fdf4 100644 --- a/app/switch/resources/conf/languages/en/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/en/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/es/vm/voicemail.xml b/app/switch/resources/conf/languages/es/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/es/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/es/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/fr/vm/voicemail.xml b/app/switch/resources/conf/languages/fr/vm/voicemail.xml index fd21361e4a..7407ce48c4 100644 --- a/app/switch/resources/conf/languages/fr/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/fr/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/he/vm/voicemail.xml b/app/switch/resources/conf/languages/he/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/he/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/he/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/it/vm/voicemail.xml b/app/switch/resources/conf/languages/it/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/it/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/it/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/nl/vm/voicemail.xml b/app/switch/resources/conf/languages/nl/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/nl/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/nl/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/pt/vm/voicemail.xml b/app/switch/resources/conf/languages/pt/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/pt/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/pt/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ro/vm/voicemail.xml b/app/switch/resources/conf/languages/ro/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/ro/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ro/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/ru/vm/voicemail.xml b/app/switch/resources/conf/languages/ru/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/ru/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/ru/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/sv/vm/voicemail.xml b/app/switch/resources/conf/languages/sv/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/sv/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/sv/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/tr/vm/voicemail.xml b/app/switch/resources/conf/languages/tr/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/tr/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/tr/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/conf/languages/uk/vm/voicemail.xml b/app/switch/resources/conf/languages/uk/vm/voicemail.xml index 8248ae596d..a63ab0af83 100644 --- a/app/switch/resources/conf/languages/uk/vm/voicemail.xml +++ b/app/switch/resources/conf/languages/uk/vm/voicemail.xml @@ -109,7 +109,7 @@ - + @@ -120,6 +120,18 @@ + + + + + + + + + + + + diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/record_greeting.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/record_greeting.lua index eaf0155506..c2e07ca79d 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/record_greeting.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/record_greeting.lua @@ -1,5 +1,5 @@ -- Part of FusionPBX --- Copyright (C) 2013 Mark J Crane +-- Copyright (C) 2013-2024 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -97,7 +97,7 @@ -- end --end - --option to play, save, and re-record the greeting + --option to play, save, re-record or delete the greeting if (session:ready()) then timeouts = 0; record_menu("greeting", voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".tmp.wav", greeting_id, menu); diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/record_menu.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/record_menu.lua index d314f7c061..3952e15aab 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/record_menu.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/record_menu.lua @@ -1,5 +1,5 @@ -- Part of FusionPBX --- Copyright (C) 2013-2015 Mark J Crane +-- Copyright (C) 2013-2024 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ --to listen to the recording press 1, to save the recording press 2, to re-record press 3 if (session:ready()) then if (string.len(dtmf_digits) == 0) then - dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:voicemail_record_file_options:1:2:3", "", "\\d+"); + dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:voicemail_record_file_options:1:2:3:7", "", "\\d+"); end end --process the dtmf @@ -43,6 +43,7 @@ session:sleep('1000'); --listen to the recording session:streamFile(tmp_file); + session:sleep('1000'); --session:streamFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); --record menu (1=listen, 2=save, 3=re-record) record_menu(type, tmp_file, greeting_id, menu); @@ -85,7 +86,7 @@ sql = sql .. "where domain_uuid = :domain_uuid "; sql = sql .. "and voicemail_id = :voicemail_id "; sql = sql .. "and greeting_id = :greeting_id "; - local params = {domain_uuid = domain_uuid, + local params = {domain_uuid = domain_uuid, voicemail_id = voicemail_id, greeting_id = greeting_id}; --freeswitch.consoleLog("notice", "[SQL] DELETING: " .. greeting_id .. "\n"); dbh:query(sql, params); @@ -156,7 +157,7 @@ advanced(); end if (menu == "tutorial") then - tutorial("finish") + tutorial("finish") end end if (type == "name") then @@ -164,9 +165,8 @@ advanced(); end if (menu == "tutorial") then - tutorial("change_password") + tutorial("change_password") end - end elseif (dtmf_digits == "3") then --re-record the message @@ -185,6 +185,51 @@ if (type == "name") then record_name(menu); end + elseif (dtmf_digits == "7") then + --delete the message + dtmf_digits = ''; + if (type == "name") then + if (file_exists(voicemail_dir.."/"..voicemail_id.."/recorded_name.wav")) then + os.remove(voicemail_dir.."/"..voicemail_id.."/recorded_name.wav"); + end + session:sleep('500'); + session:execute("playback", "phrase:voicemail_record_file_deleted"); + session:sleep('500'); + if (menu == "advanced") then + advanced(); + elseif (menu == "tutorial") then + tutorial("change_password"); + end + end + if (type == "message") then + if (storage_path == "http_cache") then + if (file_exists(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then + os.remove(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + end + else + if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then + os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); + end + end + timeouts = 0; + message_length = 0; + session:setVariable("voicemail_message_seconds", 0); + session:sleep('500'); + session:execute("playback", "phrase:voicemail_record_file_deleted"); + session:sleep('500'); + session:execute("playback", "phrase:voicemail_goodbye"); + session:hangup(); + end + if (type == 'greeting') then + if (file_exists(tmp_file)) then + os.remove(tmp_file); + end + timeouts = 0; + session:sleep('500'); + session:execute("playback", "phrase:voicemail_record_file_deleted"); + session:sleep('500'); + advanced(); + end elseif (dtmf_digits == "*") then if (type == "greeting") then --remove temporary greeting file, if any @@ -220,7 +265,7 @@ advanced(); end if (menu == "tutorial") then - tutorial("finish") + tutorial("finish") end end if (type == "name") then diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/record_message.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/record_message.lua index 7ad9a3846c..2885faf4ec 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/record_message.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/record_message.lua @@ -1,5 +1,5 @@ -- Part of FusionPBX --- Copyright (C) 2013-2023 Mark J Crane +-- Copyright (C) 2013-2024 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -58,8 +58,8 @@ function record_message() --set the variables - local db = dbh or Database.new('system') - local settings = Settings.new(db, domain_name, domain_uuid) + local db = dbh or Database.new('system'); + local settings = Settings.new(db, domain_name, domain_uuid); local message_max_length = settings:get('voicemail', 'message_max_length', 'numeric') or 300; local message_silence_threshold = settings:get('voicemail', 'message_silence_threshold', 'numeric') or 200; local message_silence_seconds = settings:get('voicemail', 'message_silence_seconds', 'numeric') or 3; @@ -77,11 +77,14 @@ --check voicemail recording instructions setting if (skip_instructions == nil) then - if (voicemail_recording_instructions == 'true') then - skip_instructions = 'false'; - elseif (voicemail_recording_instructions == 'false') then + if (voicemail_recording_instructions == 'false') then skip_instructions = 'true'; + else + skip_instructions = 'false'; end + channel_variable_skip_instructions_exists = 'false'; + else + channel_variable_skip_instructions_exists = 'true'; end --record your message at the tone press any key or stop talking to end the recording @@ -92,7 +95,7 @@ dtmf_digits = session:playAndGetDigits(0, 1, 1, 500, "#", "phrase:voicemail_record_message", "", "\\d+"); end end - + --voicemail ivr options if (session:ready()) then if (dtmf_digits == nil) then @@ -240,7 +243,7 @@ else --send information to the console freeswitch.consoleLog("notice", "neither mod_shout or lame found, defaulting to wav\n"); - + --use wav format vm_message_ext = "wav"; end @@ -277,20 +280,22 @@ end end - --check voicemail recording options setting - if (skip_instructions == nil) then + --check voicemail recording options setting (let channel variable take priority over options setting in database) + if (channel_variable_skip_instructions_exists == 'true') then if (skip_options == nil) then - if (voicemail_recording_options == 'true') then - skip_options = 'false'; - elseif (voicemail_recording_options == 'false') then - skip_options = 'true'; - end + skip_options = skip_instructions; end else - skip_options = skip_instructions; + if (skip_options == nil) then + if (voicemail_recording_options == 'false') then + skip_options = 'true'; + else + skip_options = 'false'; + end + end end - --options press 1 to listen to the recording, press 2 to save the recording, press 3 to re-record + --option to play, save, re-record or delete the message if (session:ready()) then if (skip_options == "true") then --save the message @@ -305,4 +310,4 @@ record_menu("message", voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); end end - end + end \ No newline at end of file diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/record_name.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/record_name.lua index 45b8081c86..99074e6e0c 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/record_name.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/record_name.lua @@ -1,5 +1,5 @@ -- Part of FusionPBX --- Copyright (C) 2013 Mark J Crane +-- Copyright (C) 2013-2024 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ max_len_seconds = 30; silence_threshold = 30; silence_seconds = 5; - + --make sure the voicemail directory exists mkdir(voicemail_dir.."/"..voicemail_id); @@ -93,7 +93,7 @@ --play the name --session:streamFile(voicemail_dir.."/"..voicemail_id.."/recorded_name.wav"); - --option to play, save, and re-record the name + --option to play, save, re-record or delete the name if (session:ready()) then timeouts = 0; record_menu("name", voicemail_dir.."/"..voicemail_id.."/recorded_name.wav",nil, menu);