Extending the MediaProvider Class

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

A call (represented in the Unified Communications Managed API 2.0 Core SDK 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; }


Although the SupportedMediaTypes property on the MediaProvider class and the property of the same name on the Call class have the same name and purpose, their return types are different.

MediaProvider Class Abstract Methods

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


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


protected abstract SdpAnswer EndGetAnswer(IAsyncResult result);


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


protected abstract SdpOffer EndGetOffer(IAsyncResult result);


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


protected abstract void EndTerminateMedia(IAsyncResult result);


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