Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 490
   
6-94
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
Chapter 6      Event Interfaces and Events
Events in Java CIL
Events in Java CIL
To subscribe for events in the Java CIL, use the AddEventListener method. This method has the 
following syntax:
int AddEventListener(IGenericEvents Listener, int iListID)
where Listener is the IGenericEvents object that subscribes for events and iListID is the ID of the subscriber 
list to add this listener to. Java subscriber list IDs are part of the CtiOs_Enums.SubscriberList interface; each 
C++/COM/VB event interface has a corresponding Java subscriber list (for example, C++/COM/VB 
ISessionEvents corresponds to Java eSessionList). See the Javadoc file for more information on the 
CtiOs_Enums.SubscriberList interface.
The IGenericEvents interface, though it contains the C++/COM/VB events documented in this chapter, 
does not have a callback method for each event. Instead, the OnEvent method passes the event ID code 
and arguments for each event. The OnEvent method has the following syntax:
void OnEvent(int iEventID, Arguments rArgs)
where iEventID is the event ID code for the event and rArgs is the arguments for the event. The 
arguments for each Java event are the same as for the corresponding C++/COM/VB event. See the 
Javadoc file for details on the IGenericEvents interface.
To unsubscribe for events in the Java CIL, use the RemoveEventListener method. This method has the 
following syntax:
int RemoveEventListener(IGenericEvents Listener, int iListID)
where Listener is the IGenericEvents object that is unsubscribing for events and iListID is the ID of the 
subscriber list to remove this listener from.
Events in .NET CIL
To subscribe for events in the .NET CIL, use the AddEventListener method. This method has the 
following syntax:
CilError AddEventListener(IGenericEvents Listener, int iListID)
where Listener is the IGenericEvents object that subscribes for events and iListID is the ID of the subscriber 
list to add this listener to. Subscriber list IDs for .NET are part of the CtiOs_Enums.SubscriberList interface; 
each C++/COM/VB event interface has a corresponding .NET subscriber list (for example, C++/COM/VB 
ISessionEvents corresponds to .NET eSessionList).
The IGenericEvents interface, though it contains the C++/COM/VB events documented in this chapter, 
does not have a callback method for each event. Instead, the OnEvent method passes the event ID code 
and arguments for each event. The OnEvent method has the following syntax:
void OnEvent(Object sender, Cisco.CtiOs.Cil.EventPublisher.EventPublisherEventArgs 
eventArgs)
where, sender is a null object and eventArgs contains the eventID and arguments for the event. The 
arguments for each .NET event are the same as for the corresponding C++/COM/VB event.
The EventPublisherEventArgs class is a data type that defines the information passed to receivers of the 
event. This information includes the event ID and an Arguments array containing the arguments for the 
event. Therefore, event handling code must extract the event arguments from the 
EventPublisherEventArgs object as shown in the following sample code snippet, which uses the .NET 
CIL: