Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 546
 
Chapter 2      CTI OS Client Interface Library Architecture
CIL Object Model
2-8
Cisco ICM Software CTI OS Developer’s Guide Release 6.0(0)
Note
Reference counting must be done explicitly in C++ applications (COM or 
non-COM). VisualBasic will perform automatic reference counting. 
Call Object Lifetime
Call objects are created at the CIL in response to events from the CTIOS server. 
Usually, a Call object will be created in response to the OnCallBegin event, but in 
certain failover recovery scenarios a Call object could be 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 will remain valid at the CIL until the receipt of the OnCallEnd 
event. When the OnCallEnd event is received, the Session object will publish 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 allow the Call object to be properly deleted.  When the Call object’s 
OnEvent method returns after handling OnCallEnd, the Session will check the 
reference count for zero; if any references remain, the call object will be removed 
from the call object collection and will be deleted.
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++, the object must be created on the heap memory store so that it can exist 
beyond the scope of the method creating it. For COM/VB clients, this is handled 
automatically.
The Session will hold 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.