Cisco Cisco Computer Telephony Integration Option 8.5 開発者ガイド

ページ / 508
   
4-47
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Chapter 4      Building Your Application
Working with Agent Statistics
The following example demonstrates this task in Java:
/* 1. Create session.*/
CtiOsSession rSession = new CtiOsSession();
/* 2. Add event listener.*/
rSession.AddEventListener(this, 
 CtiOs_Enums.SubscriberList.eAgentList);
/* 3. Set Connection values.*/
Arguments rArgs = new Arguments();
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_CTIOSA, “CTIOSServerA”);
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_PORTA, 42408);
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_CTIOSB, “CTIOSServerB”);
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_PORTB, 42408);
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_HEARTBEAT, 100);
/*4. Connect to server.*.
int returnCode = rSession.Connect(rArgs);
/*5. Set String to AgentID*/
String UIDAgent = “agent.5000.5013”;
/*6. Set the message filter. */
String filter = “MessageId=*;AgentId=5013;
rArgs = new Arguments();
rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_FILTER, filter);
returnCode = rSession.SetMessageFilter(rArgs);
/*7. Wait for agent events.*/
rArgs = new Arguments();
 
// Create a wait object in the session
WaitObject rWaitObj = rSession.CreateWaitObject(rArgs);
// Load the events into the Args for the wait object
rArgs.SetValue("Event1", eAgentStateEvent);
rArgs.SetValue("Event2", eQueryAgentStateConf);
rArgs.SetValue("Event3", eControlFailureConf);
rArgs.SetValue("Event4", eCTIOSFailureEvent);
 
// Set the mask for the WaitObject
rWaitObj.SetMask(rArgs);
 
// Wait for up to 9 seconds, and then give up
if (rWaitObj.WaitOnMultipleEvents(9000) != EVENT_SIGNALED)
{
    // Handle error ...
    return;
}
 
// Find out what triggered the wait
int iEventID = rWaitObj.GetTriggerEvent();
if (iEventID == eControlFailureConf|| iEventID == eCTIOSFailureEvent)
{
    // Handle error ...
    return;
}