From 72a6d370e884deca27f9e80466cc4082a339e319 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Fri, 11 Jan 2013 22:16:15 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20bug:=20An=20email=20is=20not=20sent=20if?= =?UTF-8?q?=20the=20Mailbox=20has=20=E2=80=9CLocal=20After=20Email?= =?UTF-8?q?=E2=80=9D=20=3D=20FALSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/install/scripts/voicemail.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/install/scripts/voicemail.lua b/includes/install/scripts/voicemail.lua index b7e00d818f..d0d2803d4f 100644 --- a/includes/install/scripts/voicemail.lua +++ b/includes/install/scripts/voicemail.lua @@ -790,8 +790,12 @@ freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n"); end status = dbh:query(sql, function(row) + --voicemail_uuid = string.lower(row["voicemail_uuid"]); + --voicemail_password = row["voicemail_password"]; + --greeting_id = row["greeting_id"]; voicemail_mail_to = row["voicemail_mail_to"]; voicemail_attach_file = row["voicemail_attach_file"]; + voicemail_local_after_email = row["voicemail_local_after_email"]; end); --get voicemail message details @@ -843,6 +847,11 @@ end result = api:executeString(cmd); + --local after email is false so delete the recording file + if (voicemail_local_after_email == "false") then + os.remove(voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext); + end + --emailed if (session:ready()) then dtmf_digits = ''; @@ -957,10 +966,8 @@ event:fire(); --if local after email is true then copy the recording file - if (forward_voicemail_local_after_email == "true") then - os.execute("mkdir -p " .. voicemail_dir.."/"..forward_voicemail_id); - os.execute("cp "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.." "..voicemail_dir.."/"..forward_voicemail_id.."/msg_"..uuid.."."..vm_message_ext); - end + os.execute("mkdir -p " .. voicemail_dir.."/"..forward_voicemail_id); + os.execute("cp "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.." "..voicemail_dir.."/"..forward_voicemail_id.."/msg_"..uuid.."."..vm_message_ext); --send the email with the voicemail recording attached if (string.len(forward_voicemail_mail_to) > 2) then @@ -1042,10 +1049,6 @@ end end - --local after email is false so delete the recording file - if (voicemail_local_after_email == "false") then - os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext); - end end function main_menu ()