Cisco Cisco Computer Telephony Integration OS 8.5 Developer's Guide

Page of 508
   
3-12
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Chapter 3      CIL Coding Conventions
Using Button Enablement Masks
unsigned int unBitMask = 0;
if (args.IsValid(“EnablementMask”))
{
args.GetValueInt(“EnablementMask”, & unBitMask) 
//do bitwise comparison
If(unBitMask & ENABLE_ANSWER)
m_AnswerButton.Enable();
}
}
Visual Basic.NET example:
Private Sub m_session_OnAgentStateChange(ByVal pIArguments As 
Cisco.CTIOSCLIENTLib.Arguments) Handles m_session.OnAgentStateChange
        Dim bitmask As Integer
        'Determine the agent's button enablement and update the buttons on the form
         bitmask = m_Agent.GetValueInt("EnablementMask")
        btnReady.Enabled = False
        btnNotReady.Enabled = False
        btnLogout.Enabled = False
        btnStartMonitoring.Enabled = False
        If bitmask And Cisco.CTIOSCLIENTLib.enumCTIOS_EnablementMasks.ENABLE_READY Then
            btnReady.Enabled = True
        End If
        If bitmask And Cisco.CTIOSCLIENTLib.enumCTIOS_EnablementMasks.ENABLE_NOTREADY Then
            btnNotReady.Enabled = True
        End If
        If bitmask And 
Cisco.CTIOSCLIENTLib.enumCTIOS_EnablementMasks.ENABLE_NOTREADY_WITH_REASON Then
            btnNotReady.Enabled = True
        End If
        If bitmask And Cisco.CTIOSCLIENTLib.enumCTIOS_EnablementMasks.ENABLE_LOGOUT Then
            btnLogout.Enabled = True
        End If
        If bitmask And 
Cisco.CTIOSCLIENTLib.enumCTIOS_EnablementMasks.ENABLE_LOGOUT_WITH_REASON Then
            btnLogout.Enabled = True
        End If
    End Sub
The advantage of using this approach is that all of the peripheral-specific details of enabling and 
disabling buttons is determined in a central location – at the CTI OS Server. This allows future new 
features to be enabled, and software bugs to be corrected in a central location, which is a great benefit 
for deploying future releases.
Warning
The button enablement feature is intended to be used in agent mode applications and not for monitor 
mode applications.
For any given event, the CTI OS Server calculates the appropriate button enablement bitmask, and sends 
it to the CIL with the event parameters. The button enablement bit masks are discussed in detail in 
 You can use these masks to write a custom softphone-type 
application without writing custom code to enable and disable buttons. This approach is also used 
internally for the CTI OS ActiveX softphone controls.