Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 500
   
4-34
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 7.5(1)
Chapter 4      Building Your Application
Logging In and Logging Out an Agent
/* 7. Get the Integer instances for the custom values you entered in the CTI OS Server 
registry.*/
 Integer warningIntObj = IPCCLogInArgs.GetValueIntObj(“custom_WarnIfAgentLoggedIn”);
 
 Integer rejectIntObj =IPCCLogInArgs.GetValueIntObj(“custom_RejectIfAgentLoggedIn”);
/* 8. Get the int values for those object to test later.*/
 custom_WarnIfAgentLoggedIn = warnIntObj.intValue();
 custom_RejectIfAgentLoggedIn = rejectIntObj.intValue();
}
How to Detect the Duplicate Log In Attempt in the Desktop Application
You detect the duplicate log in attempt in the OnQueryAgentStateConf() event, which is sent after the 
application calls SetAgent():
Step 1
Get the agent state value from the Arguments instance passed to the event.
Step 2
Test the agent state value in the CtiOs_Enums.AgentState interface, as follows.
(state != eLogout) && (state != eUnknown)
Step 3
If the test is true, handle the duplicate log in attempt as described in the next section.
The following example demonstrates this task in Java:
public void eQueryAgentStateConf(Arguments rArgs) {
 /* 1. Get the agent state value*/
 Short agentState = rArgs.getValueShortObj(CTIOS_AGENTSTATE)
 
 /*Test the agent state*/
 if (agentState.intValue() != eLogout 
              
&& 
agentState.intValue() 
!= 
eUnknown) {
 
 /*If the agent is logged in, handle duplicate log in attempt.*/
 }
}
How to Handle Duplicate Log In Attempts in the Desktop Application
If you detect from the OnQueryAgentStateConf() event that the agent is already logged in as described 
in the previous section, do the following:
If your custom_WarnIfAgentLoggedIn = 1 and custom_RejectIfAgentLoggedIn = 0, notify the user 
that the agent is already logged in and proceed with Login() depending on the user’s response.
If your custom_RejectIfAgentLoggedIn = 1, notify the user that the agent is already logged in and 
Disconnect.