CCX Scripting Series – Are there agents Logged-In or Ready?

In a contact center environment, customers quite often want to perform custom call routing when either there are no agents in a ready state, or if there are no agents logged in to a specific CSQ.  Though I think it’s always a good idea to set this up, surprisingly some contact center managers aren’t concerned with special handling in these situations.  If you do need to check agent availability, here’s a quick overview of the process.

In this example, I will only cover the process for determining agent availability with the assumption you are following scripting best practices and have already configured basic call routing and queuing.


  • int variable to store value of Logged-In agents (or any other statistic)
  • string variable to store value of CSQ name
  • Get Reporting Statistics step
  • If step

In this scripting demonstration, we will create and use the following variables:

  • iAgentsLoggedIn (int)
  • sCSQ (string)


Next we will add a Get Reporting Statistic step to check agent availability in the desired CSQ.  Note, prior to this step, you will need to define the appropriate CSQ name in the script either by hard coding it, or defining it based on called number, or by caller input, etc.  The Get Reporting Statistic step can be used to check (via the Field parameter) whether agents are Ready, Not Ready, or any other CSQ related statistic.  Assign the Result Statistic to the iAgentsLoggedIn variable so we can check it via an If step to determine how to proceed with call processing.


With the CSQ name defined, and after we have determined agent availability (Logged-In, Ready, or whatever) using the Get Reporting Statistic step, we can use an If step to define the next steps. We will create an If step to evaluate the value of iAgentsLoggedIn.


If iAgentsLoggedIn >= 1, we will route the call to the queue. Otherwise, scripting logic will flow through to the False output branch.


Lastly, if you are going to queue callers, it’s a good idea to verify agents are still logged in during each loop of the caller in the queue, to ensure a caller doesn’t get stuck in queue when all agents logout.


Here’s a screenshot of the final script configuration to check whether there are one or more agents logged in to the associated CSQ.