Cisco Cisco Computer Telephony Integration OS 8.5 Developer's Guide

Page of 546
 
Chapter 4      Building Your Application
Logging In and Logging Out an Agent
4-44
Cisco ICM Software CTI OS Developer’s Guide Release 6.0(0)
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 customer_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.
How to Log Out an Agent
To log out an agent:
Step 1
Create an instance of the Arguments class.
Step 2
Set log out values for the agent in the Arguments instance.