cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Walkthrough Wednesdays

Sporadic Agent Statistics in Monitor Mode

29
Views
0
Helpful
0
Comments
This document was generated from CDN thread

Created by: Bill Westby on 01-04-2010 11:38:04 PM
I took the Java AllAgents sample application and modified it to grab agent statistics each time an agent state change is received, I'm filtering my agent list by skillgroups I'm interested in.  The agent state events work just fine however each time I receive a state change I'm trying (as a test right now) to log the agent statistics at the state change event.  For whatever reason, I cannot reliably get the GetValueArray("Statistics") to return a valid object, 99% of the time it returns null.  When it does return a valid object I am able to log data about the agent.  Here is the code to log the agent statistics during a state change:
  public void OnQueryAgentStatisticsConf(Arguments rEventArgs)
  {
   Arguments args = rEventArgs.GetValueArray ("Staticstics");
      m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Agent stats have changed for " + rEventArgs.GetValueString(CTIOS_UNIQUEOBJECTID));
      if (args != null) {
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "HCI = " + args.GetValue("HandledCallsToday"));
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "HCO = " + args.GetValue("AgentOutCallsToday"));
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "TTI = " + args.GetValue("AgentOutCallsTalkTimeToday"));
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "TTO = " + args.GetValue("HandledCallsTalkTimeToday"));
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "NRT = " + args.GetValue("NotReadyTimeToday"));
        m_log.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "LIT = " + args.GetValue("LoggedOnTimeToday"));
      }
   HandleAgentStateUpdate(rEventArgs, false);
  } // OnQueryAgentStateConf
 
The output is usually like this:
04/01/2010 16:18:34.0191 Agent stats have changed for agent.5005.99999
 
Once in awhile I will get the (args) value to not be null and it will log the statistics, but it's very rare.
 
Any idea why I get a null returned when doing my GetValueArray?  I've tried to follow the developer guide and no luck.
 
ALSO, for "LOGGEDINTIMETODAY" statistic, it always returns a null value, anyone know what the correct spelling is for that parameter?
 
Thanks,
Bill Westby
Medtronic MiniMed

Subject: RE: Sporadic Agent Statistics in Monitor Mode
Replied by: Bill Westby on 04-05-2010 04:30:50 PM
I'll answer my own question in case anyone else runs into this but after many many hours the solution was so simple, just had to use Agent typecasting to get my agent object and wallah, stats appeared:
 

public void OnQueryAgentStatisticsConf(Arguments rEventArgs)
{
// Integer IState = rEventArgs.GetValueIntObj(CTIOS_AGENTSTATE);
Agent agent = (Agent)m_CTISession.GetObjectFromObjectID(rEventArgs.GetValueString(CTIOS_UNIQUEOBJECTID));
if (null != agent) {
Arguments rArgs = agent.GetValueArray("Statistics");
//m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Props = " + m_CTISession.GetCurrentAgent().toString());
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH,
"EventSink.OnAgentStateChange( " +
rEventArgs.GetValueString(CTIOS_UNIQUEOBJECTID) + ")");
if (null != rArgs) {
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Start dumping stats...");
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Args = " + rArgs.DumpArgs());
..............<snip>

Subject: RE: Sporadic Agent Statistics in Monitor Mode
Replied by: Shannon McCoy on 15-07-2010 10:30:37 AM
I'll answer my own question in case anyone else runs into this but after many many hours the solution was so simple, just had to use Agent typecasting to get my agent object and wallah, stats appeared:
 

public void OnQueryAgentStatisticsConf(Arguments rEventArgs)
{
// Integer IState = rEventArgs.GetValueIntObj(CTIOS_AGENTSTATE);
Agent agent = (Agent)m_CTISession.GetObjectFromObjectID(rEventArgs.GetValueString(CTIOS_UNIQUEOBJECTID));
if (null != agent) {
Arguments rArgs = agent.GetValueArray("Statistics");
//m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Props = " + m_CTISession.GetCurrentAgent().toString());
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH,
"EventSink.OnAgentStateChange( " +
rEventArgs.GetValueString(CTIOS_UNIQUEOBJECTID) + ")");
if (null != rArgs) {
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Start dumping stats...");
m_logmgr.Trace(Logger.TRACE_MASK_EVT_REQ_HIGH, "Args = " + rArgs.DumpArgs());
..............<snip>

 
if your first code was a copy and paste yo also misspelled Statistics in
the GetValueArray call which I am sure didn't help But have used the second technique also and it worked much better.
Content for Community-Ad