From ab0f5d32953f49362d4fef72656fa32d10f13185 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 4 Oct 2023 09:00:15 -0600 Subject: [PATCH] Update agent state to waiting --- app/call_centers/call_center_agent_status.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/call_centers/call_center_agent_status.php b/app/call_centers/call_center_agent_status.php index 6d35c09d21..840d5c9fad 100644 --- a/app/call_centers/call_center_agent_status.php +++ b/app/call_centers/call_center_agent_status.php @@ -207,18 +207,28 @@ if (!isset($row['queue_name'])) { if ($agent_status == "Do Not Disturb") { //set the default dnd action - $dnd_action = "add"; + $dnd_action = "add"; + //set the call center status to Logged Out - if (is_uuid($row['agent_uuid'])) { - $command = "api callcenter_config agent set status ".$row['agent_uuid']." 'Logged Out' "; - } + if (is_uuid($row['agent_uuid'])) { + $command = "api callcenter_config agent set status ".$row['agent_uuid']." 'Logged Out' "; + $response = event_socket_request($fp, $command); + } } else { if (is_uuid($row['agent_uuid'])) { + //set the agent status $command = "api callcenter_config agent set status ".$row['agent_uuid']." '".$agent_status."'"; + $response = event_socket_request($fp, $command); + + //set the agent state + if ($agent_status == 'Available' || $agent_status == 'Logged Out') { + $command = "api callcenter_config agent set state ".$row['agent_uuid']." 'Waiting'"; + $response = event_socket_request($fp, $command); + } } } - $response = event_socket_request($fp, $command); + } //echo $command."\n";