From 61896c3e3f6ebc2c19b4b786c9ca3c56ea2dae12 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 25 Apr 2020 11:43:44 -0600 Subject: [PATCH] Update index.lua --- .../resources/scripts/app/voicemail/index.lua | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/scripts/resources/scripts/app/voicemail/index.lua b/app/scripts/resources/scripts/app/voicemail/index.lua index 61e9b095f8..d02f5afdd3 100644 --- a/app/scripts/resources/scripts/app/voicemail/index.lua +++ b/app/scripts/resources/scripts/app/voicemail/index.lua @@ -346,8 +346,29 @@ domain_uuid = string.lower(row["domain_uuid"]); end); - --get the message count and send the mwi event - message_waiting(voicemail_id, domain_uuid); + --get voicemail message details + if (voicemail_id) then + local sql = [[SELECT * FROM v_voicemails + WHERE domain_uuid = :domain_uuid + AND voicemail_id = :voicemail_id]] + local params = {domain_uuid = domain_uuid, voicemail_id = id}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params, function(row) + voicemail_local_after_email = row["voicemail_local_after_email"]; + end); + + --set default values + if (voicemail_local_after_email == nil) then + voicemail_local_after_email = "true"; + end + + --get the message count and send the mwi event + if (voicemail_local_after_email == 'true') then + message_waiting(voicemail_id, domain_uuid); + end + end end --check messages