Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide

Page of 490
   
4-18
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
Chapter 4      Building Your Application
Using the C++ CIL and Static Libraries
Subscribing for Events in C++
The publisher-subscriber model provides event interfaces in C++. To subscribe for events, you must 
create a callback class (event sink), or implement the event interface in your main class. You can derive 
the callback class from the Adapter classes defined in CIL.h, such as AllInOneEventsAdapter.h. 
To register for an event, use the appropriate AddEventListener method on the Session object:
// Initialize the event sink
m_pEventSink = new CEventSink(&m_ctiSession, &m_ctiAgent, this);
// Add event sink as an event listener
m_ctiSession.AddAllInOneEventListener((IAllInOne *) m_pEventSink);
To remove an event listener (upon program termination), use the appropriate RemoveEventListener on 
the Session object:
// Tell session object to remove our event sink
m_ctiSession.RemoveSessionEventListener((IAllInOne *) m_pEventSink);
STLPort 
Version 7.1(1)(0) of the Cisco CTI OS Toolkit no longer uses STLPort. It now uses Microsoft’s version 
of STL, which removes any special configuration of the build environment. 
Next Steps
For detailed information on the CTI OS client start up and shut down sequence, see the section 
For detailed information on the CTI OS Client Interface Library objects, see Chapters 6 through 11.
For a complete sample application that uses the CIL interface with C++ static libraries, see the 
C++phone sample application on the CTI OS CD.