Edit

Share via


LocalEndpoint.BeginEstablish Method

Definition

Overloads

BeginEstablish(AsyncCallback, Object)

Establishes the endpoint so that it can receive incoming calls and conference invitations.

BeginEstablish(IEnumerable<SignalingHeader>, AsyncCallback, Object)

Establishes the endpoint so that it can receive incoming calls and conference invitations.

BeginEstablish(AsyncCallback, Object)

Establishes the endpoint so that it can receive incoming calls and conference invitations.

public:
 IAsyncResult ^ BeginEstablish(AsyncCallback ^ userCallback, System::Object ^ state);
public IAsyncResult BeginEstablish (AsyncCallback userCallback, object state);
member this.BeginEstablish : AsyncCallback * obj -> IAsyncResult
Public Function BeginEstablish (userCallback As AsyncCallback, state As Object) As IAsyncResult

Parameters

userCallback
AsyncCallback

The method to be called when the asynchronous operation is completed.

state
Object

A user-provided object that distinguishes this particular asynchronous operation from other asynchronous operations.

Returns

An IAsyncResult that references the asynchronous operation.

Exceptions

Thrown when the state of the platform or endpoint is not correct for this operation.

Examples

The following example shows how to establish an application endpoint. The example assumes that a CollaborationPlatform object has been started as a server platform. Application endpoints cannot be used with client platforms.

C# ApplicationEndpoint initialization

try
{
    ApplicationEndpointSettings settings = new ApplicationEndpointSettings("sip:myapplication@contoso.com");

    ApplicationEndpoint endpoint = new ApplicationEndpoint(platform, settings);

    // Customize settings if required
    settings.OwnerPhoneUri = "tel:+14255553333";

    // Register event handlers
    endpoint.StateChanged += this.Endpoint_StateChanged;
    endpoint.RegisterForIncomingCall&lt;InstantMessagingCall&gt;(this.InstantMessagingCallReceived);

    endpoint.BeginEstablish(this.EndpointEstablishCompleted, endpoint /*state*/);
}
catch (InvalidOperationException)
{
    // Platform was shutdown on another thread

    // TODO: Replace with error handling code.
    Console.WriteLine("Could not establish endpoint. Platform was not in a valid state.");
}

private void EndpointEstablishCompleted(IAsyncResult result)
{
    try
    {
        LocalEndpoint endpoint = result.AsyncState as LocalEndpoint;
        endpoint.EndEstablish(result);
    }
    catch (RealTimeException exception)
    {
        // TODO: Replace with error handling code.
        Console.WriteLine("Failed to establish endpoint: {0}", exception.Message);
    }
    finally
    {
        // TODO: Add clean up code here.

    }
}


The following example shows how to establish an application endpoint. The example assumes that a CollaborationPlatform object has been started as a server platform. Application endpoints cannot be used with client platforms.

C# ApplicationEndpoint initialization

try
{
    UserEndpointSettings settings = new UserEndpointSettings(userName, serverName);

    // Customize settings if required
    settings.Credential = credential;

    UserEndpoint endpoint = new UserEndpoint(platform, settings);

    // Register event handlers
    endpoint.StateChanged += this.Endpoint_StateChanged;
    endpoint.RegisterForIncomingCall&lt;InstantMessagingCall&gt;(this.InstantMessagingCallReceived);

    endpoint.BeginEstablish(this.EndpointEstablishCompleted, endpoint /*state*/);
}
catch (InvalidOperationException)
{
    // Platform was shutdown on another thread

    // TODO: Replace with error handling code.
    Console.WriteLine("Could not establish endpoint. Platform was not in a valid state.");
}

private void EndpointEstablishCompleted(IAsyncResult result)
{
    try
    {
        LocalEndpoint endpoint = result.AsyncState as LocalEndpoint;
        endpoint.EndEstablish(result);
    }
    catch (RealTimeException exception)
    {
        // TODO: Replace with error handling code.
        Console.WriteLine("Failed to establish endpoint: {0}", exception.Message);
    }
    finally
    {
        // TODO: Add clean up code here.

    }
}


Remarks

Registration, querying for in-band provisioning data, getting Media Relay Tokens, and automatic presence publication and subscription are some of the operations performed during endpoint establishment. For ApplicationEndpoints all the operations are optional while for UserEndpoints the last two operations are optional.

Applies to

BeginEstablish(IEnumerable<SignalingHeader>, AsyncCallback, Object)

Establishes the endpoint so that it can receive incoming calls and conference invitations.

public:
 IAsyncResult ^ BeginEstablish(System::Collections::Generic::IEnumerable<Microsoft::Rtc::Signaling::SignalingHeader ^> ^ additionalHeaders, AsyncCallback ^ userCallback, System::Object ^ state);
public IAsyncResult BeginEstablish (System.Collections.Generic.IEnumerable<Microsoft.Rtc.Signaling.SignalingHeader> additionalHeaders, AsyncCallback userCallback, object state);
member this.BeginEstablish : seq<Microsoft.Rtc.Signaling.SignalingHeader> * AsyncCallback * obj -> IAsyncResult
Public Function BeginEstablish (additionalHeaders As IEnumerable(Of SignalingHeader), userCallback As AsyncCallback, state As Object) As IAsyncResult

Parameters

additionalHeaders
IEnumerable<SignalingHeader>

Collection of signaling headers to be included with Register request. Can be null.

userCallback
AsyncCallback

The method to be called when the asynchronous operation is completed.

state
Object

A user-provided object that distinguishes this particular asynchronous operation from other asynchronous operations.

Returns

An IAsyncResult that references the asynchronous operation.

Exceptions

Thrown when the state of the platform or endpoint is not right for this operation

Thrown when one of the additional headers is a restricted header.

Remarks

Registration, querying for in-band provisioning data, getting Media Relay Tokens, and automatic presence publication and subscription are some of the operations performed during endpoint establishment. For ApplicationEndpoints all the operations are optional while for UserEndpoints the last two operations are optional.

Applies to