Jump to: navigation, search

Custom Statistics: Getting Agent State for All Channels

When working with Stat Server, you can configure custom statistics that allow your applications to easily monitor information that might not otherwise be available.

In this article we will build a custom statistic that can be used to return the agent state for all channels, and then look at what the returned EventInfo message might look like.

Configuring a Custom Statistic

Custom statistics can be configured by updating the Stat Server application object in your Genesys environment. This means adding a new section to the application object, and then specifying values for a set of options inside that section that determine how statistics are formed and reported.

Important
For details on how to build your own custom statistics, refer to the Stat Server documentation.

To monitor the agent state for all channels, add the following section to your Stat Server application object:

[Custom_CurrentAgentDNState]
Objects=Agent
Category=CurrentState
MainMask=*
Subject=DNAction

Resulting EventInfo Object

Once your custom statistic is defined in the Stat Server application object, your application can receive EventInfo messages that give your application details about the agent state for all channels. Code from the Working with Statistics section of the Stat Server article shows how to subscribe to a statistic; the only change required is using the name defined as part of your custom statistic. (In the example above, the custom statistic name is Custom_CurrentAgentDNState.)

A sample EventInfo message is provided below for reference:

'EventInfo' (2) attributes:
VOID_VALUE [object] = ObjectValue: AgentStatus {
  AgentId = MCR_Agent0
  LoginId = 6000
  Status = 9
  Time = 1392641892
  Place = PlaceStatus {
    PlaceId = Place_6000_MCR
    PlaceStatus = 9
    Time = 1392641892
    DnStatuses = DnStatusesCollection (size=7) [
      [0] DnStatus {
        DN Id = 6000
        SwitchId = Simulator
        GSW DN TYPES = 1
        DN Status = 9
        Time = 1392641892
        Actions = DnActionCollection (size=3) [
          [0] DnAction {
            Action = Monitored
            Time = 1392641870
            ActionDataType = NoData
            ConnectionId = null
            DNIS = null
            ANI = null
            UserData = null
          }
          [1] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
          }
          [2] DnAction {
            Action = AfterCallWork
            Time = 1392641892
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
          }
        ]
      }
      [1] DnStatus {
        DN Id = workitem
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "workitem"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "workitem"
          }
        ]
      }
      [2] DnStatus {
        DN Id = email
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "email"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "email"
          }
        ]
      }
      [3] DnStatus {
        DN Id = fax
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "fax"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "fax"
          }
        ]
      }
      [4] DnStatus {
        DN Id = chat
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "chat"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "chat"
          }
        ]
      }
      [5] DnStatus {
        DN Id = sms
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "sms"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "sms"
          }
        ]
      }
      [6] DnStatus {
        DN Id = webform
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 8
        Time = 1392641870
        Actions = DnActionCollection (size=2) [
          [0] DnAction {
            Action = LoggedIn
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "webform"
          }
          [1] DnAction {
            Action = NotReadyForNextCall
            Time = 1392641870
            ActionDataType = CallData
            ConnectionId = 0000000000000000
            DNIS = null
            ANI = null
            UserData = KVList: 
            'MediaType' [str] = "webform"
          }
        ]
      }
    ]
  }
}

TM_LENGTH [int] = 0
LONG_VALUE [int] = 0
USER_REQ_ID [int] = -1
TM_SERVER [int] = 1392641892
REQ_ID [int] = 520
This page was last edited on July 24, 2015, at 20:51.
Comments or questions about this documentation? Contact us for support!