Xuc Internals: Agent State Story

Agent state is an important concept in XiVO solutions, this status allows managers to check for agent availability, agents to be able to see if they are able to transfer the call to the relevant person. Last but not least, agent real time statistics are based on this agent state accuracy.

CCManager

The aim of this post is to describe how Agent State is calculated and processed inside xivo solutions.
The service responsible of AgentState creation and maintenance is the xuc server. Xuc Server is a piece of software written in Scala, running as a Docker image inside a Docker container.
Xuc Server is interacting with xivo_ctid, the original ctid server written in python, which is slowly deprecated and replaced by the xuc.

What Is An Agent State ?

Agent state is a mix of agent status (Ready Paused …) and phone device status (Ringing, Dialing, OnCall)

Agent States

Information used to compute agent state is coming from different sources, AMI, XiVO database or XiVO configuration database.

xivo_ctid is generating AgentLoggedOut events, AgentReady, AgentOnPause and AgentOnWrapup. Login events are received through Asterisk Management Interface (AMI), line events are received from the AMI and used to calculate on call, dialing, ringing states.https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239

Agent State Initialization

Initialization of the agent state data is a specific process, when the system starts it has to be aware of the agents current states. When running, agents states events are dynamically propagated through the system.

Agent States Actors

Xuc server is using intensively Akka and many actors are responsible of the init steps. Inside Xuc many strategies are used to create and communicate with the actors, but this is not the subject of this post, so let’s assume actors are created and can send and receive messages.

The first actor involved in this initialization process is the ConfigManager, which connects to the xivo cti server througth the CtiLink actor.
Once the CliLink is connected to XiVO cti server, it sends a message to the ConfigInitializer in order to start the configuration download process.
ConfigInitializer requests the list of users from XiVO Cti server. Cti server responds by sending UserConfigUpdate messages.
When the UserConfigUpdate message is received, if the user is an agent, XiVO database is requested to check if this agent is already logged on or not.
Result of this request triggers an AgentInitLoggedIn or AgentInitLoggedOut message which is sent to the AgentManager to finish the initialization process.
AgentManager will then create the Agent State Finite State Machines, and the agent stat collectors and forward this init message to the state machine.
Agent State Machine will then calculate and send the final AgentLogin or AgentLoggedOut sate to the event bus.

Agent States Init

Running System

Once the system is running, events are propagated to the agent state machine from the AMI for the line events and the login event, from xivo ctid for the logout, onpause, ready on wrapup events.

Agent States Summary

Share