Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Extending the MediaProvider Class

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.

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; }
Caution noteCaution

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.

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

BeginGetAnswer

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

EndGetAnswer

protected abstract SdpAnswer EndGetAnswer(IAsyncResult result);

BeginGetOffer

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

EndGetOffer

protected abstract SdpOffer EndGetOffer(IAsyncResult result);

BeginTerminateMedia

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


EndTerminateMedia

protected abstract void EndTerminateMedia(IAsyncResult result);

SetAnswer

protected abstract void SetAnswer(OfferAnswerContext context, SdpOffer originalOffer, SdpAnswer answer); 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.