Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide

Page of 668
 
4-49
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions Release 7.1(1)
 
Chapter 4      Building Your Application
Logging In and Logging Out an Agent
Arguments IPCCLogInArgs = 
connectionProfilesArgs.GetValueArray("IPCC/SoftACD")
/* 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.*/
 }
}