InstantMessagingCall.BeginEstablish Method (String, ToastMessage, CallEstablishOptions, AsyncCallback, Object)

Begins the operation of establishing the instant messaging call with the remote participant.

Namespace:  Microsoft.Rtc.Collaboration
Assembly:  Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)

Syntax

'Declaration
Public Function BeginEstablish ( _
    destinationUri As String, _
    toastMessage As ToastMessage, _
    options As CallEstablishOptions, _
    userCallback As AsyncCallback, _
    state As Object _
) As IAsyncResult
'Usage
Dim instance As InstantMessagingCall
Dim destinationUri As String
Dim toastMessage As ToastMessage
Dim options As CallEstablishOptions
Dim userCallback As AsyncCallback
Dim state As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginEstablish(destinationUri, _
    toastMessage, options, userCallback, _
    state)
public IAsyncResult BeginEstablish(
    string destinationUri,
    ToastMessage toastMessage,
    CallEstablishOptions options,
    AsyncCallback userCallback,
    Object state
)

Parameters

  • destinationUri
    Type: System.String
    Destination URI of the remote participant
  • userCallback
    Type: System.AsyncCallback
    The method to be called when the asynchronous operation is completed.
  • state
    Type: System.Object
    A user-provided object that distinguishes this particular asynchronous operation from other asynchronous operations.

Return Value

Type: System.IAsyncResult
Returns an IAsyncResult that references the asynchronous operation.

Exceptions

Exception Condition
ArgumentException

Thrown when the destinationUri parameter is null, empty or invalid SIP URI or tel URI, or when the options parameter contains invalid or restricted signaling headers, or when the call is used as a third-party call controller with custom MIME parts or with early media support.

InvalidOperationException

Thrown when the call is not in a valid state to perform this operation or does not have valid media provider to bind to.

Remarks

toastMessage specifies the message that is displayed on the client when the callee is notified of an incoming call.

Examples

This example shows how to establish a call to a Uri with a toast message. This example assumes that the platform and endpoints have already been initialized.

C# Establish call with toast message

 
        call.BeginEstablish(
            destinationUri,
            new ToastMessage("Do you have a minute?"),
            null /*options*/,
            this.EstablishCompleted,
            call /*state*/);

        private void EstablishCompleted(IAsyncResult result)
        {
            try
            {
                InstantMessagingCall call = result.AsyncState as InstantMessagingCall;
                call.EndEstablish(result);
            }
            catch (RealTimeException exception)
            {
                // TODO: Replace with exception handling code.
                Console.WriteLine("Call establish failed: {0}", exception.Message);
            }
            finally
            {
                // TODO: Add clean up code here.
            }

        }

See Also

Reference

InstantMessagingCall Class

InstantMessagingCall Members

BeginEstablish Overload

Microsoft.Rtc.Collaboration Namespace