Allow * 22 login/logout of queue without password by adding variable auto_authorized to dialplan (#1776)

This commit is contained in:
DigiDaz
2016-07-28 02:13:50 +01:00
committed by FusionPBX
parent 28daf96fd9
commit f08094dea1

View File

@@ -29,6 +29,7 @@
uuid = session:get_uuid(); uuid = session:get_uuid();
agent_id = session:getVariable("agent_id"); agent_id = session:getVariable("agent_id");
agent_password = session:getVariable("agent_password"); agent_password = session:getVariable("agent_password");
auto_authorized = session:getVariable("auto_authorized");
--set the sounds path for the language, dialect and voice --set the sounds path for the language, dialect and voice
default_language = session:getVariable("default_language"); default_language = session:getVariable("default_language");
@@ -51,12 +52,14 @@
agent_id = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_id:#", "", "\\d+"); agent_id = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_id:#", "", "\\d+");
end end
--get the pin number from the caller --get the pin number from the caller if not auto_authorized
if (agent_password == nil) then if (auto_authorized == nil) then
min_digits = 3; if (agent_password == nil) then
max_digits = 20; min_digits = 3;
max_tries = 3; max_digits = 20;
agent_password = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); max_tries = 3;
agent_password = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+");
end
end end
--set default as access denied --set default as access denied
@@ -66,7 +69,12 @@
sql = "SELECT * FROM v_call_center_agents "; sql = "SELECT * FROM v_call_center_agents ";
sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .."' "; sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .."' ";
sql = sql .. "AND agent_id = '" .. agent_id .."' "; sql = sql .. "AND agent_id = '" .. agent_id .."' ";
sql = sql .. "AND agent_password = '" .. agent_password .."' ";
--only use password clause if not auto_authorized
if (auto_authorized == nil) then
sql = sql .. "AND agent_password = '" .. agent_password .."' ";
end
freeswitch.consoleLog("notice", "[user status] sql: " .. sql .. "\n"); freeswitch.consoleLog("notice", "[user status] sql: " .. sql .. "\n");
dbh:query(sql, function(row) dbh:query(sql, function(row)
--set the variables --set the variables