mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update index.lua
Prevent an error when the voicemail_uuid is empty when the voicemail box is disabled.
This commit is contained in:
@@ -320,30 +320,30 @@
|
||||
--leave a message
|
||||
if (voicemail_action == "save") then
|
||||
|
||||
--check the voicemail quota
|
||||
if (vm_disk_quota) then
|
||||
--get voicemail message seconds
|
||||
local sql = [[SELECT coalesce(sum(message_length), 0) as message_sum FROM v_voicemail_messages
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_uuid = :voicemail_uuid]]
|
||||
local params = {domain_uuid = domain_uuid, 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(row)
|
||||
message_sum = row["message_sum"];
|
||||
end);
|
||||
if (tonumber(vm_disk_quota) <= tonumber(message_sum)) then
|
||||
--play message mailbox full
|
||||
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-mailbox_full.wav")
|
||||
--set the voicemail_uuid to nil to prevent saving the voicemail
|
||||
voicemail_uuid = nil;
|
||||
end
|
||||
end
|
||||
|
||||
--valid voicemail
|
||||
if (voicemail_uuid ~= nil) then
|
||||
|
||||
--check the voicemail quota
|
||||
if (vm_disk_quota) then
|
||||
--get voicemail message seconds
|
||||
local sql = [[SELECT coalesce(sum(message_length), 0) as message_sum FROM v_voicemail_messages
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_uuid = :voicemail_uuid]]
|
||||
local params = {domain_uuid = domain_uuid, 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(row)
|
||||
message_sum = row["message_sum"];
|
||||
end);
|
||||
if (tonumber(vm_disk_quota) <= tonumber(message_sum)) then
|
||||
--play message mailbox full
|
||||
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-mailbox_full.wav")
|
||||
--set the voicemail_uuid to nil to prevent saving the voicemail
|
||||
voicemail_uuid = nil;
|
||||
end
|
||||
end
|
||||
|
||||
--play the greeting
|
||||
timeouts = 0;
|
||||
play_greeting();
|
||||
|
||||
Reference in New Issue
Block a user