Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[call_center] Use agent_name or agent_id #6520

Merged
merged 1 commit into from Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -7,6 +7,7 @@
</condition>
<condition field="destination_number" expression="^(?:agent\+|\*22)(.+)$">
<action application="set" data="agent_id=$1" enabled="true"/>
<action application="set" data="agent_name=$1" enabled="false"/>
<action application="set" data="agent_authorized=true" enabled="false"/>
<action application="lua" data="app.lua agent_status" enabled="true"/>
</condition>
Expand Down
11 changes: 8 additions & 3 deletions app/scripts/resources/scripts/app/agent_status/index.lua
Expand Up @@ -42,6 +42,7 @@
agent_authorized = session:getVariable("agent_authorized");
agent_action = session:getVariable("agent_action");
agent_id = session:getVariable("agent_id");
agent_name = session:getVariable("agent_name");
agent_password = session:getVariable("agent_password");

--set the sounds path for the language, dialect and voice
Expand All @@ -63,7 +64,7 @@
sounds_dir = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice;

--get the agent_id from the caller
if (agent_id == nil) then
if (agent_id == nil and agent_name == nil) then
min_digits = 2;
max_digits = 20;
max_tries = 3;
Expand All @@ -79,10 +80,14 @@
end

--get the agent password
local params = {domain_uuid = domain_uuid, agent_id = agent_id}
local params = {domain_uuid = domain_uuid, agent_id = agent_id, agent_name = agent_name}
local sql = "SELECT * FROM v_call_center_agents ";
sql = sql .. "WHERE domain_uuid = :domain_uuid ";
sql = sql .. "AND agent_id = :agent_id ";
if (agent_id ~= nil) then
sql = sql .. "AND agent_id = :agent_id ";
else
sql = sql .. "AND agent_name = :agent_name ";
end
if (agent_authorized ~= 'true') then
sql = sql .. "AND agent_password = :agent_password ";
params.agent_password = agent_password;
Expand Down