Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 668
 
Chapter 4      Building Your Application
Using the C++ CIL and Static Libraries
4-26
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions Release 7.1(1) 
The foregoing are all the Project Settings required for CTI OS. Click OK, and save 
your project settings. 
Subscribing for Events in C++
Events interfaces are provided in C++ using the publisher-subscriber model. To 
subscribe for events, you must create a callback class (event sink), or implement 
the event interface in your main class. The callback class can be derived from the 
Adapter classes defined in CIL.h, such as AllInOneEventsAdapter.h. 
To register for an event, you 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);