Globally Enabling the Media Stack
The application can choose to negotiate session descriptions with the RTC media stack enabled.
The media stack is automatically enabled when the application calls the IRTCClient::Initialize method. The session negotiations include the following:
Receiving an Incoming Session
The following steps are taken to negotiate descriptions for incoming sessions:
- The application implements the IRTCSessionDescriptionManager interface to handle session management. The IRTCSessionDescriptionManager interface has one callback method, EvaluateSessionDescription. This method allows the application to decide whether to handle the incoming session description negotiations or let the RTC Client API handle the negotiations. The application registers the IRTCSessionDescriptionManager by calling the IRTCClient2::SetSessionDescriptionManager method.
- When an incoming session invite arrives, the RTC Client API calls into the IRTCSessionDescriptionManager::EvaluateSessionDescription method with the session description and content type of the session. The application indicates whether to handle the session description in the pfApplicationSession parameter of the IRTCSessionDescriptionManager::EvaluateSessionDescription method. If the pfApplicationSession parameter is true, the session type becomes RTCST_APPLICATION; otherwise, the session type becomes RTCST_PC_TO_PC.
Creating an Outgoing Session
The application takes the following steps to create an outgoing session:
- The application calls IRTCClient2::CreateSessionWithDescription with the data that will form the body of the SIP INVITE request. The data includes the content type along with the session description of the SIP INVITE request. The application then calls the IRTCSession::AddParticipant method to invite the remote party to the session.
- The called party receives a callback on the IRTCSessionDescriptionManager::EvaluateSessionDescription method. The decision to handle session negotiations is returned in the pfApplicationSession parameter. If this parameter is set to TRUE, the session type becomes RTCST_APPLICATION.
- The called party receives an IRTCSessionStateChangeEvent indicating that the session state has changed to RTCSS_INCOMING. The called party obtains the session object from the IRTCSessionStateChangeEvent::get_Session method. The called party can then query the session object to get the session type, which is always RTCST_APPLICATION for sessions with application-defined media negotiations. The called party can also call the IRTCSessionStateChangeEvent2::GetRemoteSessionDescription method to obtain the session description.
- The called party can accept the call by calling the IRTCSession2::AnswerWithSessionDescription method, passing the content type and a new session description back to the application that created the call.
- Once the session is connected, the caller can query the session object for the called party's session description by calling the IRTCSessionStateChangeEvent2::GetRemoteSessionDescription method.
Renegotiating a Session Description
The steps for Reinvites are the same as those described in the Globally Disabling the Media Stack section.