Terminate a Call
Other versions of this page are also available for the following:
8/28/2008
The following example code shows how to terminate a call.
Note
This code has not been thoroughly tested, does not contain error checking, and is not intended for production use.
//
// Specify a reason from the RTC_TERMINATE_REASON
// enumeration to terminate the call.
//
hr = m_pIRTCSession->Terminate(RTCTR_NORMAL);
// if (hr != S_OK) process error here.
// ....
//
// RTCE_SESSION_STATE_CHANGE event handler method
//
IRTCSessionStateChangeEvent *pISessionState = NULL;
RTC_SESSION_STATE SessionState;
// Get the session state interface from the event object.
hr = pIDispatch->QueryInterface(IID_IRTCSessionStateChangeEvent,
reinterpret_cast<void**> (&pISessionState));
// if (hr != S_OK) process error here.
hr = pISessionState->get_State(&SessionState);
// if (hr != S_OK) process error here.
// Handle relevant session states here.
switch(SessionState)
{
// .....
// Handle the disconnect notification.
case RTCSS_DISCONNECTED:
{
// The session must be released and set to NULL.
m_pIRTCSession->Release();
m_pIRTCSession = NULL;
break;
}
// ....
}