Added support for authentication via voicemail box passwords (#3076)
This commit is contained in:
parent
66a5d9e92c
commit
bc6a58aa30
|
|
@ -79,6 +79,21 @@
|
||||||
end);
|
end);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--introduce authentication process
|
||||||
|
session:streamFile("phrase:pin_number_start:#");
|
||||||
|
|
||||||
|
--get the user ext, if applicable
|
||||||
|
if (pin_number == "voicemail") then
|
||||||
|
min_digits = 1;
|
||||||
|
max_digits = 6;
|
||||||
|
user_ext = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:pin_number_enter_extension:#", "", "\\d+");
|
||||||
|
if (not user_ext or user_ext == "") then
|
||||||
|
session:streamFile("phrase:voicemail_fail_auth:#");
|
||||||
|
session:hangup("NORMAL_CLEARING");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--get the user pin number
|
--get the user pin number
|
||||||
min_digits = 2;
|
min_digits = 2;
|
||||||
max_digits = 20;
|
max_digits = 20;
|
||||||
|
|
@ -107,6 +122,23 @@
|
||||||
--set the authorized pin number that was used
|
--set the authorized pin number that was used
|
||||||
session:setVariable("pin_number", digits);
|
session:setVariable("pin_number", digits);
|
||||||
end);
|
end);
|
||||||
|
elseif (pin_number == "voicemail") then
|
||||||
|
local sql = [[SELECT * FROM v_voicemails
|
||||||
|
WHERE voicemail_id = :user_ext
|
||||||
|
AND voicemail_password = :digits
|
||||||
|
AND domain_uuid = :domain_uuid
|
||||||
|
AND voicemail_enabled = 'true' ]];
|
||||||
|
local params = {user_ext = user_ext, digits = digits, domain_uuid = domain_uuid};
|
||||||
|
if (debug["sql"]) then
|
||||||
|
freeswitch.consoleLog("NOTICE", "[pin_number] SQL: "..sql.."; params: " .. json.encode(params) .. "\n");
|
||||||
|
end
|
||||||
|
auth = false;
|
||||||
|
dbh:query(sql, params, function(row)
|
||||||
|
--set the variable to true
|
||||||
|
auth = true;
|
||||||
|
--set the authorized pin number that was used
|
||||||
|
session:setVariable("pin_number", digits);
|
||||||
|
end);
|
||||||
else
|
else
|
||||||
pin_number_table = explode(",",pin_number);
|
pin_number_table = explode(",",pin_number);
|
||||||
for index,pin_number in pairs(pin_number_table) do
|
for index,pin_number in pairs(pin_number_table) do
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<include>
|
||||||
|
<macro name="pin_number_start">
|
||||||
|
<input>
|
||||||
|
<match>
|
||||||
|
<action function="play-file" data="voicemail/vm-continue.wav" />
|
||||||
|
</match>
|
||||||
|
</input>
|
||||||
|
</macro>
|
||||||
|
<macro name="pin_number_enter_extension">
|
||||||
|
<input>
|
||||||
|
<match>
|
||||||
|
<action function="play-file" data="ivr/ivr-please_enter_extension_followed_by_pound.wav" />
|
||||||
|
</match>
|
||||||
|
</input>
|
||||||
|
</macro>
|
||||||
|
</include>
|
||||||
Loading…
Reference in New Issue