From 3d2f72d2d4d42b21c96170f8b155c0be2b9180a1 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 29 Apr 2013 17:30:13 +0000 Subject: [PATCH] If VM local after email is set to false and email address is not provided still save the voicemail message and send the mwi. --- .../resources/functions/send_email.lua | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/includes/install/scripts/app/voicemail/resources/functions/send_email.lua b/includes/install/scripts/app/voicemail/resources/functions/send_email.lua index 42d098abce..57a94edd23 100644 --- a/includes/install/scripts/app/voicemail/resources/functions/send_email.lua +++ b/includes/install/scripts/app/voicemail/resources/functions/send_email.lua @@ -136,19 +136,21 @@ end --whether to keep the voicemail message and details local after email - if (voicemail_local_after_email == "false") then - --delete the voicemail message details - sql = [[DELETE FROM v_voicemail_messages - WHERE domain_uuid = ']] .. domain_uuid ..[[' - AND voicemail_uuid = ']] .. db_voicemail_uuid ..[[' - AND voicemail_message_uuid = ']] .. uuid ..[[']] - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n"); - end - status = dbh:query(sql); - --set message waiting indicator - message_waiting(id, domain_uuid); - --clear the variable - db_voicemail_uuid = ''; + if (voicemail_mail_to) then + if (voicemail_local_after_email == "false" and string.len(voicemail_mail_to) > 0) then + --delete the voicemail message details + sql = [[DELETE FROM v_voicemail_messages + WHERE domain_uuid = ']] .. domain_uuid ..[[' + AND voicemail_uuid = ']] .. db_voicemail_uuid ..[[' + AND voicemail_message_uuid = ']] .. uuid ..[[']] + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n"); + end + status = dbh:query(sql); + --set message waiting indicator + message_waiting(id, domain_uuid); + --clear the variable + db_voicemail_uuid = ''; + end end end