Error handling
Applies to: Lync 2013 | Lync Server 2013
A developer who implements a subclass of the MediaProvider class must be aware of the exceptions that Microsoft Unified Communications Managed API (UCMA) expects.
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.
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.