Check for a nil to prevent an error for voicemail, ivr menu and recordings.

This commit is contained in:
Mark Crane 2015-04-04 09:09:09 +00:00
parent 17c68d7e2b
commit 20ec80d46c
3 changed files with 47 additions and 29 deletions

View File

@ -126,23 +126,27 @@
dofile(scripts_dir.."/resources/functions/settings.lua");
settings = settings(domain_uuid);
storage_type = "";
storage_path = "";
if (settings['voicemail'] ~= nil) then
if (settings['voicemail']['storage_type'] ~= nil) then
if (settings['voicemail']['storage_type']['text'] ~= nil) then
storage_type = settings['voicemail']['storage_type']['text'];
end
end
storage_path = "";
if (settings['voicemail']['storage_path'] ~= nil) then
if (settings['voicemail']['storage_path']['text'] ~= nil) then
storage_path = settings['voicemail']['storage_path']['text'];
end
end
end
temp_dir = "";
if (settings['server'] ~= nil) then
if (settings['server']['temp'] ~= nil) then
if (settings['server']['temp']['dir'] ~= nil) then
temp_dir = settings['server']['temp']['dir'];
end
end
end
--if voicemail_id is non numeric then get the number-alias
if (voicemail_id ~= nil) then

View File

@ -52,17 +52,27 @@
dofile(scripts_dir.."/resources/functions/settings.lua");
settings = settings(domain_uuid);
storage_type = "";
if (settings['recordings'] ~= nil and settings['recordings']['storage_type'] ~= nil and settings['recordings']['storage_type']['text'] ~= nil) then
storage_type = settings['recordings']['storage_type']['text'];
end
storage_path = "";
if (settings['recordings'] ~= nil and settings['recordings']['storage_path'] ~= nil and settings['recordings']['storage_path']['text'] ~= nil) then
storage_path = settings['recordings']['storage_path']['text'];
if (settings['voicemail'] ~= nil) then
if (settings['voicemail']['storage_type'] ~= nil) then
if (settings['voicemail']['storage_type']['text'] ~= nil) then
storage_type = settings['voicemail']['storage_type']['text'];
end
end
if (settings['voicemail']['storage_path'] ~= nil) then
if (settings['voicemail']['storage_path']['text'] ~= nil) then
storage_path = settings['voicemail']['storage_path']['text'];
end
end
end
temp_dir = "";
if (settings['server'] ~= nil and settings['server']['temp'] ~= nil and settings['server']['temp']['dir'] ~= nil) then
if (settings['server'] ~= nil) then
if (settings['server']['temp'] ~= nil) then
if (settings['server']['temp']['dir'] ~= nil) then
temp_dir = settings['server']['temp']['dir'];
end
end
end
--set the recordings directory
if (domain_count > 1) then

View File

@ -52,23 +52,27 @@
dofile(scripts_dir.."/resources/functions/settings.lua");
settings = settings(domain_uuid);
storage_type = "";
if (settings['recordings']['storage_type'] ~= nil) then
if (settings['recordings']['storage_type']['text'] ~= nil) then
storage_type = settings['recordings']['storage_type']['text'];
end
end
storage_path = "";
if (settings['recordings']['storage_path'] ~= nil) then
if (settings['recordings']['storage_path']['text'] ~= nil) then
storage_path = settings['recordings']['storage_path']['text'];
if (settings['voicemail'] ~= nil) then
if (settings['voicemail']['storage_type'] ~= nil) then
if (settings['voicemail']['storage_type']['text'] ~= nil) then
storage_type = settings['voicemail']['storage_type']['text'];
end
end
if (settings['voicemail']['storage_path'] ~= nil) then
if (settings['voicemail']['storage_path']['text'] ~= nil) then
storage_path = settings['voicemail']['storage_path']['text'];
end
end
end
temp_dir = "";
if (settings['server'] ~= nil) then
if (settings['server']['temp'] ~= nil) then
if (settings['server']['temp']['dir'] ~= nil) then
temp_dir = settings['server']['temp']['dir'];
end
end
end
--dtmf call back function detects the "#" and ends the call
function onInput(s, type, obj)