Update index.lua

This commit is contained in:
FusionPBX
2019-10-30 19:52:31 -06:00
committed by GitHub
parent 013aa7a0df
commit 357ca20e28

View File

@@ -236,7 +236,7 @@
--get the voicemail settings
if (voicemail_id ~= nil) then
if (session:ready()) then
if (session ~= nil and session:ready()) then
--get the information from the database
local sql = [[SELECT * FROM v_voicemails
WHERE domain_uuid = :domain_uuid
@@ -257,6 +257,7 @@
voicemail_transcription_enabled = row["voicemail_transcription_enabled"];
voicemail_tutorial = row["voicemail_tutorial"];
end);
--set default values
if (voicemail_local_after_email == nil) then
voicemail_local_after_email = "true";
@@ -268,7 +269,7 @@
--valid voicemail
if (voicemail_uuid ~= nil and string.len(voicemail_uuid) > 0) then
--answer the session
if (session:ready()) then
if (session ~= nil and session:ready()) then
session:answer();
session:execute("sleep", "1000");
end
@@ -282,7 +283,7 @@
end
--set the callback function
if (session:ready()) then
if (session ~= nil and session:ready()) then
session:setVariable("playback_terminators", "#");
session:setInputCallback("on_dtmf", "");
end
@@ -322,7 +323,7 @@
require "app.voicemail.resources.functions.record_name";
require "app.voicemail.resources.functions.message_count"
require "app.voicemail.resources.functions.mwi_notify";
require "app.voicemail.resources.functions.tutorial";
require "app.voicemail.resources.functions.tutorial";
--send a message waiting event
if (voicemail_action == "mwi") then
@@ -351,7 +352,7 @@
--check messages
if (voicemail_action == "check") then
if (session:ready()) then
if (session ~= nil and session:ready()) then
--check the voicemail password
if (voicemail_id) then
if (voicemail_authorized) then
@@ -385,7 +386,7 @@
if (voicemail_action == "save") then
--set the variables
if (session:ready()) then
if (session ~= nil and session:ready()) then
session:setVariable("missed_call", "true");
session:setVariable("voicemail_answer_stamp", api:execute("strftime"));
session:setVariable("voicemail_answer_epoch", api:execute("strepoch"));
@@ -606,7 +607,7 @@
else
--voicemail not enabled or does not exist
if (session:ready()) then
if (session ~= nil and session:ready()) then
referred_by = session:getVariable("sip_h_Referred-By");
if (referred_by) then
referred_by = referred_by:match('[%d]+');