Cisco Cisco Computer Telephony Integration Option 9.0 개발자 가이드

다운로드
페이지 500
   
4-21
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
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).
How to Connect the Session to the CTI OS Server
After you successfully create 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.
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.
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.
Dealing with Connection Failures
This section contains the following information:
  •
  •
  •
  •
Also see 
Connection Failure Events
If the Connect() method does not succeed, one of the following events is generated:
  •
OnConnectionRejected() event indicates that an unsupported version mismatch has been found.
  •
OnCTIOSFailure() indicates that the CTI OS Server requested in the Connect() method is down. If 
an OnConnectionFailure() event is generated, the application is in Failover and the CIL continues 
to attempt to connect until the connection succeeds or until the application calls Disconnect(). The 
Arguments parameter for the event includes the following keywords:
  –
FailureCode