Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 500
   
4-33
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions
Cisco CTI OS Release 7.2(1)
Chapter 4      Building Your Application
Logging In and Logging Out an Agent
The following example demonstrates steps 4 through 7 in Java:
void OnGlobalSettingsDownloadConf(Arguments rArgs) {
 /* 4. Get the Arguments instance for the Login configuration 
 information from the event Arguments parameter.*/
 Arguments logInArgs = rArgs.getValueArray(CTIOS_LOGIN);
/* 5. Get the Arguments instance for the Connection Profile
from the Login Arguments instance. */
Arguments connectionProfilesArgs = logInArgs.GetValueArray(CTIOS_CONNECTIONPROFILES);
/* 6. Get the Arguments instance for the specific switch from the Connection
Profiles instance */
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.*/
 }
}