Cisco Cisco Computer Telephony Integration OS 8.5 开发者指南
4-21
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Chapter 4 Building Your Application
Connecting to the CTI OS Server
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 CTI OS 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.
The following example demonstrates this task in
Java:
/* 1. Create Arguments object.*/
Arguments rArgs = new Arguments();
/* 2. Set Connection values.*/
rArgs.SetValue(CTIOS_enums.CTIOS_CTIOSA, “CTIOSServerA”);
rArgs.SetValue(CTIOS_enums.CTIOS_PORTA, 42408);
rArgs.SetValue(CTIOS_enums.CTIOS_CTIOSB, “CTIOSServerB”);
rArgs.SetValue(CTIOS_enums.CTIOS_PORTB, 42408);
rArgs.SetValue(CTIOS_enums.CTIOS_HEARTBEAT, 100);
Note
The Arguments.setValue() methods return a boolean value to indicate whether the method succeeded
(true) or not (false).
(true) or not (false).
How to Connect the Session to the CTI OS Server
After successfully creating the Session instance, you must connect it to the CTI OS Server using the
Session.Connect() method, using the Arguments instance you constructed when setting connection
parameters, as described in the previous section.
Session.Connect() method, using the Arguments instance you constructed when setting connection
parameters, as described in the previous section.
The following line shows this in
Java:
int returnCode = session.Connect(rArgs);
For more information on the possible values and meanings of the int value returned by the Connect()
method in the Java CIL, see page 4-22.
method in the Java CIL, see page 4-22.
When successful, the Connect() method generates the OnConnection() event. Code within the
OnConnection() event should set the connection mode, as described in the next section.
OnConnection() event should set the connection mode, as described in the next section.