Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide
4-36
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions
Cisco CTI OS Release 7.2(1)
Chapter 4 Building Your Application
Working with Calls
5.
Ensure that the agent object is set to NULL in the session before you Release the session object. For
example, whenever your application is exiting and you are disconnecting the session object (e.g.
when the user closes your application's window) you should do something similar to the code below:
example, whenever your application is exiting and you are disconnecting the session object (e.g.
when the user closes your application's window) you should do something similar to the code below:
if (m_ctiSession)
{
m_ctiSession->Disconnect();
// stop all events for this session
int nRetVal =
m_pctiSession->RemoveAllInOneEventListener((IAllInOne *)
m_pmyEventSink);
//The application is closing, remove current agent from session
CAgent * pNullAgent = NULL;
m_Session->SetAgent(*pNullAgent);
m_Session->Release();
m_Session = NULL;
}
if(m_ctiAgent)
{
m_ctiAgent->Release();
m_ctiAgent = NULL;
}
if (m_pmyEventSink)
{
m_pmyEventSink->Release();
m_pmyEventSink = NULL;
}
Working with Calls
Handling Multiple Calls
It is critical that you design an Agent Mode desktop application to be able to store all the calls on the
specific device, in order to do the following:
specific device, in order to do the following:
•
Apply incoming events to the correct call
•
Select the correct call on which to make method calls (i.e. telephony requests)
It is not necessary to maintain a set of Call Objects in order to do this. Instead, the application could
store the string UniqueObjectID of each call (keyword CTIOS_UNIQUEOBJECTID).
CTIOS_UNIQUEOBJECTID is always included in the args parameter for each call event. The actual
Call Object can be obtained with the Session object's GetObjectFromObjectID() method in order to
make a method call.
store the string UniqueObjectID of each call (keyword CTIOS_UNIQUEOBJECTID).
CTIOS_UNIQUEOBJECTID is always included in the args parameter for each call event. The actual
Call Object can be obtained with the Session object's GetObjectFromObjectID() method in order to
make a method call.