Fix MWI for Extensions that with 0 (#2882)

* Fix MWI for Extensions that with 0

MWI was not turning off after messages were deleted for extensions that start with 0. This requires that real voicemail_id to be pulled from the database and not just taken from the destination number. To get around this we try to send mwi to the original vociemail_id (destination number) and voicemail_id_copy (from database). Index.lua is already doing something similar.

* Update listen_to_recording.lua

* Update menu_messages.lua
This commit is contained in:
konradSC
2017-10-18 00:23:40 -04:00
committed by FusionPBX
parent 9db045e02e
commit d407aa4349
2 changed files with 19 additions and 0 deletions

View File

@@ -217,6 +217,10 @@
elseif (dtmf_digits == "7") then elseif (dtmf_digits == "7") then
delete_recording(voicemail_id, uuid); delete_recording(voicemail_id, uuid);
message_waiting(voicemail_id, domain_uuid); message_waiting(voicemail_id, domain_uuid);
--fix for extensions that start with 0 (Ex: 0712)
if (voicemail_id_copy ~= voicemail_id and voicemail_id_copy ~= nil) then
message_waiting(voicemail_id_copy, domain_uuid);
end
elseif (dtmf_digits == "8") then elseif (dtmf_digits == "8") then
forward_to_extension(voicemail_id, uuid); forward_to_extension(voicemail_id, uuid);
dtmf_digits = ''; dtmf_digits = '';

View File

@@ -41,6 +41,17 @@
--message_status new,saved --message_status new,saved
if (session:ready()) then if (session:ready()) then
if (voicemail_id ~= nil) then if (voicemail_id ~= nil) then
--get the voicemail_id
--fix for extensions that start with 0 (Ex: 0712)
sql = [[SELECT voicemail_id FROM v_voicemails WHERE voicemail_uuid = :voicemail_uuid]];
local params = {voicemail_uuid = voicemail_uuid};
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
end
dbh:query(sql, params, function(result)
voicemail_id_copy = result["voicemail_id"];
end);
local sql = [[SELECT voicemail_message_uuid, created_epoch, caller_id_name, caller_id_number local sql = [[SELECT voicemail_message_uuid, created_epoch, caller_id_name, caller_id_number
FROM v_voicemail_messages FROM v_voicemail_messages
WHERE domain_uuid = :domain_uuid WHERE domain_uuid = :domain_uuid
@@ -85,6 +96,10 @@
) )
--send the message waiting event --send the message waiting event
mwi_notify(voicemail_id.."@"..domain_name, new_messages, saved_messages) mwi_notify(voicemail_id.."@"..domain_name, new_messages, saved_messages)
--fix for extensions that start with 0 (Ex: 0712)
if (voicemail_id_copy ~= voicemail_id and voicemail_id_copy ~= nil) then
message_waiting(voicemail_id_copy, domain_uuid);
end
end end
--set the display --set the display