Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 490
   
3-7
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
Chapter 3      CIL Coding Conventions
COM Error Codes
Note
If a method that is supposed to trigger an event returns an error code, check this return value before 
continuing to wait for events. Depending on the error code, the event you were waiting for may not be 
triggered.
COM Error Codes
For applications using the CTI OS CIL for COM, the Microsoft COM layer adds a level of error detection 
and provides additional error codes, called HRESULTs. For COM method calls in C++, the HRESULT 
is returned from the method call, and indicates success or failure of the method call. The CIL error code 
is also returned, but as an [out, retval] parameter. For example:
// COM Example in C++
int errorCode = 0;
HRESULT hr = pCall->Answer(&errorCode);
if (errorCode=CIL_FAILED)
printf(“An error has occurred while answering the call.”)
In Visual Basic, HRESULT values are hidden under the covers. When an error occurs, a Visual Basic 
exception is thrown, which can be caught using the On Error: construct. The CIL error code is returned 
as the result of the method call:
‘ VB example:
On Error GoTo Error_handler
Dim errorCode as Long
E_CTIOS_SESSION_ 
DISCONNECT_PENDIN
G
-300
A disconnect is already pending.
E_CTIOS_SESSION_NO
T_ CONNECTED
-301
The session is not connected.
E_CTIOS_SESSION_NO
T_DISCONNECTED
-351
The call to Connect failed because the session is not in a 
disconnected state. The session may be connected or a 
previous call to Disconnect may not yet be complete.
E_CTIOS_AGENT_ 
ALREADY_IN_SESSION
-900
An object for this agent already exists in the session.
E_CTIOS_SET_AGENT_ 
SESSION_DISCONNECT
_ REQUIRED
-901
Session must be disconnected before operation.
E_CTIOS_SERVICE_SEN
D_MESSAGE_FAILED
-902
Could not send message. Session may not be connected.
E_CTIOS_CALL_ALREA
DY_CURRENT_IN_SESS
ION
-903
An object for this call is already set as current in the session.
E_CTIOS_LOGIN_ 
INCONSISTENT_ 
ARGUMENTS
-904
The AgentID and/or PeripheralID provided to a Login call do 
not match the properties set on the Agent object when 
SetAgent() was called.
CIL Error Code
Numeri
c Value
Description