Extending the MediaProvider class

Applies to: Skype for Business 2015

A call (represented in the UCMA 5.0 as a Call subclass) serves as a SIP signaling control, while a MediaProvider subclass is the media counterpart that is responsible for SDP negotiation, as described in RFC 3264, An Offer/Answer Model with the Session Description Protocol (SDP). A MediaProvider subclass also is responsible for creating and managing a media flow, which can be implemented in a MediaFlow subclass. A MediaFlow subclass implementation must provide the protocol implementation of the actual media exchange and customized behavior for exchanging media of a specific type. For more information, see Extending the MediaFlow class.

A MediaProvider subclass is responsible for creating the media flow (an instance of a MediaFlow subclass) and making it available to the application. Generally, during offer/answer negotiation, the MediaProvider subclass should create a new flow if one has not been created for a given context. The flow can then be made available to the application by the RaiseFlowConfigurationRequestedHandler method on the MediaProvider subclass instance.

MediaProvider class abstract property

A developer who creates a MediaProvider subclass must provide a definition for only one MediaProvider property, SupportedMediaTypes. This property returns a list of the media types supported by the custom media provider, similar to the property of the same name on the Call class.

public abstract IEnumerable<string> SupportedMediaTypes { get; }

Warning

The MediaProvider and Call classes both have a SupportedMediaTypes property. Although these properties have the same name and purpose, their return types are different.

Abstract methods on the MediaProvider class

In addition to the previously mentioned property, the developer must provide definitions for the following seven MediaProvider methods.

Method

Description

BeginGetAnswer(OfferAnswerContext, SdpOffer, AsyncCallback, Object)

Gets an answer from the MediaProvider implementation for the incoming offer.

protected abstract IAsyncResult BeginGetAnswer(OfferAnswerContext offerAnswerContext, SdpOffer offer, AsyncCallback userCallback, object state)

EndGetAnswer(IAsyncResult)

Completes the operation started by BeginGetAnswer.

protected abstract SdpAnswer EndGetAnswer(IAsyncResult result)

BeginGetOffer(OfferAnswerContext, Collection<SdpContentDescription>, AsyncCallback, Object)

Gets the initial offer from the MediaProvider implementation.

protected abstract IAsyncResult BeginGetOffer(OfferAnswerContext offerAnswerContext, Collection<SdpContentDescription> lastLocalOutgoingSdps, AsyncCallback userCallback, object state)

EndGetOffer(IAsyncResult)

Completes the operation started by BeginGetOffer.

protected abstract SdpOffer EndGetOffer(IAsyncResult result)

BeginTerminateMedia(CallDialogContext, Boolean, AsyncCallback, Object)

Starts an asynchronous media termination operation.

protected abstract IAsyncResult BeginTerminateMedia(CallDialogContext callDialogContext, bool isTerminatingSignalingSession, AsyncCallback userCallback, object state)

EndTerminateMedia(IAsyncResult)

Completes the operation started by BeginTerminateMedia.

protected abstract void EndTerminateMedia(IAsyncResult result)

SetAnswer(OfferAnswerContext, SdpOffer, SdpAnswer)

Sets the incoming answer on the MediaProvider implementation.

protected abstract void SetAnswer(OfferAnswerContext context, SdpOffer originalOffer, SdpAnswer answer)