Cisco Cisco Computer Telephony Integration OS 8.5 Guia Do Programador

Página de 500
   
3-12
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions
Cisco CTI OS Release 7.2(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 6.0 example:
Public Sub m_Session_OnCallDeliveredEvent(ByVal pArguments as CTIOSClientLib.Arguments)
Dim nBitMask as Integer
If pArguments.IsValid “EnablementMask” Then
nBitMask = pArguments.GetValueInt “EnablementMask”
End If
‘ do bitwise comparison
If nBitMask And ENABLE_ANSWER Then
m_AnswerButton.Enable
End If
End Sub
Java example:
void OnCallDeliveredEvent(Arguments args)
{
Long LMask = args.GetValueUIntObj(CtiOs_IKeywordIDs.CTIOS_ENABLEMENTMASK);
if (null!=LMask)
{
long lMask = LMask.longValue();
if ((lMask & CtiOs_Enums.ButtonEnablement.ENABLE_ANSWER) == 0)
m_AnswerButton.setEnabled(false);
else
m_AnswerButton.setEnabled(true);
}
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 any custom code to enable and disable buttons. This is also the approach 
used internally for the CTI OS ActiveX softphone controls.