Add domain_uuid check to pin_number.lua.
This commit is contained in:
parent
d1aa88dfd1
commit
4b17d5dac2
|
|
@ -53,18 +53,39 @@
|
||||||
|
|
||||||
--define the check pin number function
|
--define the check pin number function
|
||||||
function check_pin_number()
|
function check_pin_number()
|
||||||
|
|
||||||
--sleep
|
--sleep
|
||||||
session:sleep(500);
|
session:sleep(500);
|
||||||
|
|
||||||
--increment the number of tries
|
--increment the number of tries
|
||||||
tries = tries + 1;
|
tries = tries + 1;
|
||||||
|
|
||||||
|
--get the domain_uuid
|
||||||
|
domain_uuid = session:getVariable("domain_uuid");
|
||||||
|
if (domain_uuid == nil) then
|
||||||
|
--get the domain_name
|
||||||
|
domain_name = session:getVariable("domain_name");
|
||||||
|
--get the domain_uuid using the domain_name
|
||||||
|
sql = [[SELECT domain_name FROM v_domains
|
||||||
|
WHERE domain_name = ']] .. domain_name ..[[' ]];
|
||||||
|
if (debug["sql"]) then
|
||||||
|
freeswitch.consoleLog("NOTICE", "SQL: "..sql.."\n");
|
||||||
|
end
|
||||||
|
dbh:query(sql, function(row)
|
||||||
|
domain_uuid = row["domain_uuid"];
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
|
||||||
--get the user pin number
|
--get the user pin number
|
||||||
min_digits = 2;
|
min_digits = 2;
|
||||||
max_digits = 20;
|
max_digits = 20;
|
||||||
digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+");
|
digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+");
|
||||||
|
|
||||||
--validate the user pin number
|
--validate the user pin number
|
||||||
if (pin_number == "database") then
|
if (pin_number == "database") then
|
||||||
sql = [[SELECT * FROM v_pin_numbers
|
sql = [[SELECT * FROM v_pin_numbers
|
||||||
WHERE pin_number = ']] .. digits ..[['
|
WHERE pin_number = ']] .. digits ..[['
|
||||||
|
AND domain_uuid = ']] .. domain_uuid .. [['
|
||||||
AND enabled = 'true' ]];
|
AND enabled = 'true' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("NOTICE", "SQL: "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "SQL: "..sql.."\n");
|
||||||
|
|
@ -72,7 +93,6 @@
|
||||||
auth = false;
|
auth = false;
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, function(row)
|
||||||
--get the values from the database
|
--get the values from the database
|
||||||
domain_uuid = row["domain_uuid"];
|
|
||||||
accountcode = row["accountcode"];
|
accountcode = row["accountcode"];
|
||||||
--set the variable to true
|
--set the variable to true
|
||||||
auth = true;
|
auth = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue