Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 500
   
4-42
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions
Cisco CTI OS Release 7.2(1)
Chapter 4      Building Your Application
Working with Events
Working with Events
Handling Events in Order
A desktop application using the CTI OS API must handle events in the order they are sent by CTI OS. 
Warning
Because many events include agent state data and button enablement data indicating valid agent 
state transitions, if events are handled out of order agents may not be presented with valid options.
Coding Considerations for CIL Event Handling
The CTI OS CIL fires events to the application in a single thread. It is recommended that the amount of 
time spent in a particular CIL event handler be kept to a minimum so as to ensure timely delivery of 
subsequent CIL events. If a screenpop based on a call event (such as the OnCallDelivered event or the 
OnCallDataUpdate event) takes longer than a few seconds (for example, remote database lookup), it is 
recommended to delegate this operation to a separate thread or separate process so as not to block CTIOS 
event handling. 
Note
The order of arrival of CIL events is highly dependent upon the ACD that is in use at the customer site. 
Therefore CIL event order is not guaranteed. Do not write your event handling code in a manner that 
relies on a particular event order.
If an application calls a COM CIL API method from a COM CIL event callback routine it must ensure 
that the method call is made on the same thread as the CIL event callback. This rule applies to the 
following methods: 
  •
CComSession::SetCurrentCall 
  •
CComSession::SetAgent 
This rule must be followed in order to guarantee that events are fired from the COM CIL to the 
application in the proper sequence. 
When handling events in the browser using JavaScript, event processing time should be kept to a 
minimum since all other JavaScript execution (e.g., handling of button clicks) may be blocked during 
handling of the event.
Monitoring the OnCallEnd() Event
A Monitor Mode application that monitors any Call-related events must also monitor the OnCallEnd() 
event. 
Warning
The Call object in the CTI OS CIL is only deleted when the OnCallEnd() event is received. If the 
OnCallEnd() and OnCallDataUpdate() events are not monitored, Call objects will accumulate and 
cause a memory leak.