Update index.lua
Prevent a nil error when using voicemail has reached its quota.
This commit is contained in:
parent
9fc3541382
commit
6603eaab05
|
|
@ -1,5 +1,5 @@
|
|||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013-2016 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013-2017 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
direct_dial["max_digits"] = 4;
|
||||
|
||||
--debug
|
||||
debug["info"] = false;
|
||||
debug["sql"] = false;
|
||||
debug["info"] = true;
|
||||
debug["sql"] = true;
|
||||
|
||||
--get the argv values
|
||||
script_name = argv[1];
|
||||
|
|
@ -320,9 +320,6 @@
|
|||
--leave a message
|
||||
if (voicemail_action == "save") then
|
||||
|
||||
--valid voicemail
|
||||
if (voicemail_uuid ~= nil) then
|
||||
|
||||
--check the voicemail quota
|
||||
if (vm_disk_quota) then
|
||||
--get voicemail message seconds
|
||||
|
|
@ -339,11 +336,16 @@
|
|||
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")
|
||||
--hangup
|
||||
session:hangup("NORMAL_CLEARING");
|
||||
--set the voicemail_uuid to nil to prevent saving the voicemail
|
||||
voicemail_uuid = nil;
|
||||
end
|
||||
end
|
||||
|
||||
--valid voicemail
|
||||
if (voicemail_uuid ~= nil) then
|
||||
|
||||
--play the greeting
|
||||
timeouts = 0;
|
||||
play_greeting();
|
||||
|
|
@ -529,6 +531,7 @@
|
|||
|
||||
else
|
||||
--voicemail not enabled or does not exist
|
||||
if (session:ready()) then
|
||||
referred_by = session:getVariable("sip_h_Referred-By");
|
||||
if (referred_by) then
|
||||
referred_by = referred_by:match('[%d]+');
|
||||
|
|
@ -539,6 +542,7 @@
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
|
|
|
|||
Loading…
Reference in New Issue