Fixed the following bug. When dialing *99 it produces this error.

2013-02-21 18:39:28.016638 [ERR] mod_lua.cpp:198 ...app/voicemail/resources/functions/record_message.lua:39: bad argument #1 to 'len' (string expected, got nil)
This commit is contained in:
Mark Crane
2013-02-22 20:50:44 +00:00
parent 78f2cbe010
commit 15323f8f51
@@ -36,27 +36,29 @@
end end
--direct dial --direct dial
if (string.len(dtmf_digits) > 0) then if (dtmf_digits ~= nil) then
if (session:ready()) then if (string.len(dtmf_digits) > 0) then
if (direct_dial["enabled"] == "true") then if (session:ready()) then
if (string.len(dtmf_digits) < max_digits) then if (direct_dial["enabled"] == "true") then
dtmf_digits = dtmf_digits .. session:getDigits(direct_dial["max_digits"], "#", 5000); if (string.len(dtmf_digits) < max_digits) then
dtmf_digits = dtmf_digits .. session:getDigits(direct_dial["max_digits"], "#", 5000);
end
end end
end end
end if (session:ready()) then
if (session:ready()) then freeswitch.consoleLog("notice", "[voicemail] dtmf_digits: " .. string.sub(dtmf_digits, 0, 1) .. "\n");
freeswitch.consoleLog("notice", "[voicemail] dtmf_digits: " .. string.sub(dtmf_digits, 0, 1) .. "\n"); if (dtmf_digits == "*") then
if (dtmf_digits == "*") then --check the voicemail password
--check the voicemail password check_password(voicemail_id, password_tries);
check_password(voicemail_id, password_tries); --send to the main menu
--send to the main menu timeouts = 0;
timeouts = 0; main_menu();
main_menu(); elseif (string.sub(dtmf_digits, 0, 1) == "*") then
elseif (string.sub(dtmf_digits, 0, 1) == "*") then --do not allow dialing numbers prefixed with *
--do not allow dialing numbers prefixed with * session:hangup();
session:hangup(); else
else session:transfer(dtmf_digits, "XML", context);
session:transfer(dtmf_digits, "XML", context); end
end end
end end
end end