Error handling
Applies to: Skype for Business 2015
A developer who implements a subclass of the MediaProvider class must be aware of the exceptions that Microsoft Unified Communications Managed API (UCMA) expects.
OfferAnswerException
A MediaProvider subclass implementation can throw OfferAnswerException in EndGetOffer and EndGetAnswer(IAsyncResult). The FailureReason property on this exception contains information about why the exception was thrown.
Other exceptions
In addition to OfferAnswerException, the developer should also be aware of the following exceptions:
A BeginXxx method should throw only ArgumentException or InvalidOperationException.
BeginXxx can throw InvalidOperationException if an operation is not valid in the current state of the MediaProvider subclass implementation. The associated Call subclass should catch the exception and take appropriate action, depending on the operation state. Appropriate actions include terminating the call or retrying the operation.
A custom implementation of a Call subclass should not receive ArgumentException in general, because Call never passes a null value of OfferAnswerContext or CallContext. The MediaProvider can very well assert the value on any API where OfferAnswerContext is passed. The Call class has special logic for handling an OfferAnswerException exception, which is shown in the previous section of this topic.An EndXxx method can throw only the exceptions that are derived from the RealTimeException class:
The BeginTerminateMedia(CallDialogContext, Boolean, AsyncCallback, Object) can be called multiple times in UCMA and should not throw an exception if mediaSession is already terminated. If the media session is already terminated, EndTerminateMedia should be completed as a NOOP.