Share via


Answer a Call (Windows Embedded CE 6.0)

1/6/2010

The following code example shows how to receive an incoming call. The operations in the Initialize RTC and Register to Receive Events examples must be performed before using this code.

Note

This code has not been thoroughly tested, does not contain error checking, and is not intended for production use.

IRTCSessionStateChangeEvent *pISessionState = NULL;
RTC_SESSION_STATE SessionState;

// Create the session state interface.
hr = pIDispatch->QueryInterface( IID_IRTCSessionStateChangeEvent,
                          reinterpret_cast<void**> (&pISessionState));

// if (hr != S_OK) process error here.

// Get the current session state.
hr = pISessionState->get_State(&SessionState);

// if (hr != S_OK) process error here.

// Handle all session states.
switch(SessionState)
{
    // ...
    // Handle the incoming call.
    case RTCSS_INCOMING:
    {
         // Play a ring on the local computer.
         m_pIRTCClient->PlayRing(RTCRT_PHONE, VARIANT_TRUE)

         hr = pISessionState->get_Session(&pIRTCSession);

         // if (hr != S_OK) process error here.

         // Answer the incoming session.
         hr = pIRTCSession->Answer();

         // if (hr != S_OK) process error here. 

         break;
    }
}

See Also

Concepts

Fundamental RTC Code Examples