Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide

Page of 490
   
2-6
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
Chapter 2      CTI OS Client Interface Library Architecture
CIL Object Model
Note
Reference counting must be done explicitly in C++ applications (COM or non-COM). Visual Basic, 
Java, and the .NET framework perform automatic reference counting. 
Call Object Lifetime
Call objects are created at the CIL in response to events from the CTI OS server. Usually, a Call object 
is created in response to the OnCallBegin event, but in certain failover recovery scenarios a Call object 
is created in response to an OnSnapshotCallConf event. Any call data available for the call is passed in 
the event, and is used to set up the Call object’s initial state and properties. 
The Call object remains valid at the CIL until the receipt of the OnCallEnd event. When the OnCallEnd 
event is received, the Session object publishes the event to any subscribers to the event interfaces. 
Applications and objects must release any remaining references to the Call object within their event 
handler for OnCallEnd to delete the Call object.  When the Call object’s OnEvent method returns after 
handling OnCallEnd, the Session checks the reference count for zero; if any references remain, the call 
object is removed from the call object collection but is not deleted until the last reference to it is released.
Agent Object Lifetime
In Agent Mode, the client programmer must create an Agent object (which causes its reference count to 
be incremented to one) and must pass it to the Session in the SetAgent method.
Note
In C++, you must create the object on the heap memory store so that it can exist beyond the scope of the 
method creating it. For clients using other CILs, this is handled automatically.
The Session holds a reference to the Agent object as long as it is in use, but the client programmer must 
release the last reference to the object to prevent a memory leak.
In Monitor Mode, objects are created at the CIL when the CIL receives an event for that agent for the 
first time (e.g in an OnAgentStateChange event). When the Session receives an event for an 
unrecognized Agent, that new Agent is added to the Session’s collection of agents. 
During application clean-up, the Session object releases its references to all agents in the Agent 
collection. To ensure proper memory clean-up, the programmer must release all reference to Agent 
objects. 
SkillGroup Object Lifetime
A SkillGroup object is created at the CIL the first time an OnNewSkillGroupStatisticsEvent event occurs 
for that SkillGroup. It is added to the SkillGroup collection, and it is subsequently updated by follow-on 
OnNewSkillGroupStatisticsEvent events. 
During application clean-up, the Session object releases its references to all skill groups in the 
SkillGroup collection. To ensure proper memory clean-up, the programmer must release all reference to 
SkillGroup objects.