Extending the MediaProvider Class
A call (represented in the Microsoft Unified Communications Managed API (UCMA) 3.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) |
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) |
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) |
Completes the operation started by BeginTerminateMedia. protected abstract void EndTerminateMedia(IAsyncResult result) |
|
Sets the incoming answer on the MediaProvider implementation. protected abstract void SetAnswer(OfferAnswerContext context, SdpOffer originalOffer, SdpAnswer answer) |