Cisco Cisco Computer Telephony Integration OS 8.5 Developer's Guide

Page of 490
   
3-13
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
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.
Note
You must use button enablement mask generated by CTI OS Server in all cases where Cisco provides 
button enablement masks. This prevents application impact if changes are made to the event flow.
Cisco makes no guarantees that the event flow will remain consistent across versions of software.
Warning
The button enablement feature is intended for use in agent mode applications and not for monitor 
mode applications.