Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide
4-20
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions
Cisco CTI OS Release 7.2(1)
Chapter 4 Building Your Application
Connecting to the CTI OS Server
This section also describes how to deal with connection failures, on page 4-21.
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.)
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.
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
CCtiOsSession::Release() method. This will ensure proper memory cleanup
.
For example:
m_pSession->Release();
How to Set the Event Listener and Subscribe to Events
Before making any method calls with the Session instance, you must set the session as an event listener
for the desktop application and subscribe to events.
for the desktop application and subscribe to events.
The following lines show this in
Java:
rSession.AddEventListener(this, CtiOs_Enums.SubscriberList.eAllInOneList);
In this example, the session is adding the containing class, the desktop application, as the listener, and
using the eAllInOneList field in the CtiOs_Enums.SubscriberList class to subscribe to all events.
using the eAllInOneList field in the CtiOs_Enums.SubscriberList class to subscribe to all events.
How to Set Connection Parameters for the Session
To set connection parameters:
Step 1
Create an instance of the Arguments class.
Step 2
Set values for the CTIOS servers, ports, and the heartbeat value.
Note
When setting values, use the String key fields in the CtiOs_IKeywordIDs interface, as shown in the
example below.
example below.