Cisco Cisco Computer Telephony Integration OS 8.5 Developer's Guide

Page of 500
   
4-29
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 7.5(1)
Chapter 4      Building Your Application
Connecting to the CTI OS Server
     If DialToneArgs.IsValid("Mute") = 1 Then
       Mute = DialToneArgs.GetValueInt("Mute")
       If Mute = 1 Then
         MsgBox "Dial Tone MUTE"//Your logic here
       Else
         MsgBox "Dial Tone  NOT MUTE"//Your logic here
       End If
     End If
End If
End If
End Sub
Disconnecting from CTI OS Server
Disconnecting from CTI OS Server (via the Disconnect() method) before shutting down is an 
important part of the client application functionality. The Disconnect() method closes the socket 
connection between the client application and CTI OS. On most switches, it does not log the agent out. 
If no logout request was issued before the Disconnect(), then on most switches the agent stays 
logged into the instrument even after the client application has shut down. 
Note
Disconnect is a higher priority method than all others. Before calling Disconnect, ensure that all prior 
requests have completed lest the call to Disconnect may abort these requests. For example, calling 
Disconnect immediately after calling Logout may result in an agent not being logged out.
Upon Disconnect(), each object maintained by the Session (Call, Skillgroup, Wait) is released and 
no further events are received. Cleaning up the Agent object is the developer’s responsibility since it was 
handed to the Session (via the SetAgent() method.
Code sample:
In the C++ and COM CIL only, to disconnect from CTI OS Server when the session mode has not yet 
been established by means of calling either CCtiOsSsession::SetAgent(...) or  
CCtiOsSsession::SetMessageFilter(...), disconnect must be called with an arguments array containing 
the CTIOS_FORCEDDISCONNECT set to True.
m_session.Disconnect
// Perform disconnect
if(m_ctiSession->GetValueInt(CTIOS_CONNECTIONMODE) == eSessionModeNotSet )
{  // If the session mode has not yet been set by SetAgent or
                           // SetSessionMode at the time of the disconnect.
   // we need to indicate the session that a disconnect needs to   
   // be forced
   bool    bAllocOk = true;
   Arguments * pDisconnectArgs = NULL;
   bAllocOk = Arguments::CreateInstance(&pDisconnectArgs);
   
   if ((false==bAllocOk) || (pDisconnectArgs == NULL))
   {
   CDialog::OnClose();
   argsWaitParams.Release();
   return;
   }
   pDisconnectArgs->AddItem(CTIOS_FORCEDDISCONNECT,true);
   m_ctiSession->Disconnect(*pDisconnectArgs);
   pDisconnectArgs->Release();
}
else