From 967445ab34bf59ee04c9ee31e04395a054ff3785 Mon Sep 17 00:00:00 2001 From: yois615 <38441801+yois615@users.noreply.github.com> Date: Sat, 31 Dec 2022 13:44:37 -0500 Subject: [PATCH] [call_center] Use agent_name or agent_id (#6520) When logging into call center from phone, index.lua only supports identity with agent_id. We allow passing agent_name as well to assist with BLF configuration. --- .../switch/conf/dialplan/200_agent_status.xml | 1 + .../resources/scripts/app/agent_status/index.lua | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/dialplans/resources/switch/conf/dialplan/200_agent_status.xml b/app/dialplans/resources/switch/conf/dialplan/200_agent_status.xml index b87bbb6352..91d3e8d5ad 100644 --- a/app/dialplans/resources/switch/conf/dialplan/200_agent_status.xml +++ b/app/dialplans/resources/switch/conf/dialplan/200_agent_status.xml @@ -7,6 +7,7 @@ + diff --git a/app/scripts/resources/scripts/app/agent_status/index.lua b/app/scripts/resources/scripts/app/agent_status/index.lua index c5798e8df1..77f0ecc3a4 100644 --- a/app/scripts/resources/scripts/app/agent_status/index.lua +++ b/app/scripts/resources/scripts/app/agent_status/index.lua @@ -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 @@ -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; @@ -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;