A call (represented in the Unified Communications Managed API 2.0 Core SDK as a Callsubclass) serves as a SIP signaling control, while a MediaProvidersubclass 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 MediaProvidersubclass also is responsible for creating and managing a media flow, which can be implemented in a MediaFlowsubclass. A MediaFlowsubclass 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 MediaProvidersubclass is responsible for creating the media flow (an instance of a MediaFlowsubclass) and making it available to the application. Generally, during offer/answer negotiation, the MediaProvidersubclass 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 RaiseFlowConfigurationRequestedHandlermethod on the MediaProvidersubclass instance.

MediaProvider Class Abstract Property

A developer who creates a MediaProvidersubclass must provide a definition for only one MediaProviderproperty, 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 Callclass.

Copy Code
public abstract IEnumerable<string> SupportedMediaTypes {
get; }
Caution:
Although the SupportedMediaTypesproperty on the MediaProviderclass and the property of the same name on the Callclass 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 MediaProvidermethods.

BeginGetAnswer

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

EndGetAnswer

Copy Code
protected abstract SdpAnswer EndGetAnswer(IAsyncResult result);

BeginGetOffer

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

EndGetOffer

Copy Code
protected abstract SdpOffer EndGetOffer(IAsyncResult result);

BeginTerminateMedia

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

EndTerminateMedia

Copy Code
protected abstract void EndTerminateMedia(IAsyncResult result);

SetAnswer

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