Cisco Cisco Computer Telephony Integration OS 8.5 Developer's Guide

Page of 546
 
4-27
Cisco ICM Software CTI OS Developer’s Guide Release 6.0(0)
 
Chapter 4      Building Your Application
Connecting to the CTI OS Server
Connecting to the CTI OS Server
To connect a desktop application to the CTI OS server, you must:
1.
Create a session instance, described below.
2.
Set the event listener and subscribe to events, described below.
3.
Set connection parameters, described below.
4.
Call the Connect() method, described on page 4-29.
5.
Set the connection mode, described on page 4-31.
This section also describes how to deal with connection failures, on page 4-29.
How to Create the Session Instance
To connect to the CTIOS Server, you must first create an instance of the 
CtiOsSession object.
The following line shows this in Java:
CtiOsSession rSession = new CtiOsSession();
Session Object Lifetime (C++ only)
In C++, a Session object must be created on the heap memory store so that it can exist 
beyond the scope of the method creating it. (In COM, VB, and Java, this is handled 
automatically.)
For example:
CCtiOsSession * m_pSession = NULL;
m_pSession = new CCtiOsSession();
The client application should hold a reference to the Session 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 when the object is not longer needed.
During application cleanup, the Session object must only be disposed by invoking 
the CCtiOsSession::Release() method. This will ensure proper memory cleanup
.
For example:
m_pSession->Release();