LocalEndpoint

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

LocalEndpoint is an abstract class that serves as the base class for the UserEndpoint and ApplicationEndpoint classes. Although it would be possible to create a class derived from LocalEndpoint, developers should not attempt to do so, but should instead use the UserEndpoint and ApplicationEndpoint classes.

LocalEndpoint State Transitions

The state transitions for both endpoint types, ApplicationEndpoint and UserEndpoint, are shown in the following illustrations.

State diagram for registered application endpoints

Dd253491.4c11b689-61cc-4f2e-b21c-08788e9ba5d9(en-us,office.13).jpg

State diagram for user endpoints and unregistered application endpoints

Dd253491.e6ec4a7d-d03d-4e5a-8bdc-b67003ee1674(en-us,office.13).jpg

  1. The transition from Idle to Establishing occurs when BeginEstablish is called.

  2. The transition from Establishing to Idle occurs when EndEstablish throws an exception.

  3. The transition from Establishing to Established occurs when EndEstablish returns successfully.

  4. The transition from Established to Reestablishing occurs when a registration refresh failure occurs due to a connection drop (applies only to registered application endpoints).

  5. The transition from Reestablishing to Establishing occurs when the connection is restored and the registration is refreshed (applies only to registered application endpoints).

  6. The transition from Established to Terminating occurs when BeginTerminate is called or when a forced deregistration by the server occurs.

  7. The transition from Established to Terminating occurs when a registration refresh fails (applies only to user endpoints).

  8. The transition from Idle to Terminating occurs when BeginTerminate is called on the endpoint.

  9. The transition from Reestablishing to Terminating occurs when BeginTerminate is called on the endpoint.

  10. The transition from Terminating to Terminated occurs when EndTerminate completes.

LocalEndpointSettings Class

The LocalEndpointSettings class contains the settings needed to initialize a LocalEndpoint object.

LocalEndpointSettings Constructors

The LocalEndpointSettings class has the following constructors.

// Initializes a LocalEndpointSettings object.
protected LocalEndpointSettings(string ownerUri);

// Initializes a LocalEndpointSettings object.
public LocalEndpointSettings(string ownerUri, string serverName, int serverPort);

LocalEndpointSettings Properties

The following are the public properties on the LocalEndpointSettings class.

// Gets the URI of the owner of this endpoint. 
public string OwnerUri {get;}

// Gets or sets whether to query for the provisioning data when the endpoint is established.
// By default, the value is set to false and hence by default we will query for provisioning data on start up.
public bool ProvisioningDataDisabled {get; set;}

// Gets or sets the current state of the call screening feature.
// If enabled, incoming calls are screened based on the user's state as perceived by the
// remote participant.
// The default value is false.
public bool PresenceBasedScreeningDisabled {get; set;}

// Gets or sets the methods supported by a registered endpoint.
// By default, this is set to support subscription and signaling sessions.
public string RegisterMethods {get; set;}

// Gets or sets the list of content types that can be supported by the endpoint.
// The content type of any MIME part with handling="required" should be in this list.
// Otherwise, incoming calls will be rejected automatically. 
public IEnumerable<ContentType> SupportedMimePartContentTypes {get; set;}

// Gets or sets the endpoint user agent string.
// This string is used to build the overall UserAgent string for the endpoint. 
// This must be set only if each endpoint's user agent string is different.
// If all endpoints in the application have the same user agent string, only set the application 
// user agent string in CollaborationPlatform. 
// The overall UserAgent string is formed by combining a default user agent string with
// CollaborationPlatform.ApplicationUserAgent and LocalEndpoint.EndpointUserAgent
public string EndpointUserAgent {get; set;}

// Gets or sets whether the endpoint will try to publish quality metrics for the audio calls.
// If set to true, the media quality metrics will not be published to the QoE server. Otherwise, by default,
// the media quality metrics will be published.
// The default value is false. Applications can override this default value.
public bool PublishingQoeMetricsDisabled {get; set;}

// Gets or sets the locality of the user.
// If the application sets this value, it overrides the default
// behavior of retrieving the value from the registration response.
public bool? IsOutsideCorporateNetwork {get; set;}

// Gets the type of user agent that this endpoint represents.
public EndpointType EndpointType {get; }

// Gets the subtype of user agent that this endpoint represents.
public EndpointSubtype EndpointSubtype {get; }

LocalEndpoint Constructors

There are no public contructors on the LocalEndpoint class. Application writers should use the classes derived from LocalEndpoint: ApplicationEndpoint and UserEndpoint.

LocalEndpoint Properties

The following are the public properties on the LocalEndpoint class.

// Gets the locality of the user.
// The default value (false) will be returned
// if the application has not overridden the value in LocalEndpointSettings
// and the value was not present in the registration response.
public bool IsOutsideCorporateNetwork {get;}

// Gets the type of user agent that this endpoint represents.
public EndpointType EndpointType{get;}

// Gets the subtype of the user agent that this endpoint represents.
public EndpointSubType EndpointSubType{get;}

// Gets the RealTimeEndpoint wrapped by this endpoint.
public RealTimeEndpoint InnerEndpoint{get;}

// Gets the platform that this endpoint is bound to.
public CollaborationPlatform Platform{get;}

// Gets the state of the local endpoint.
public LocalEndpointState State{get;}

// Gets the URI of the owner of the endpoint.
public virtual string OwnerUri{get;}

// Gets the phone URI of the owner of the endpoint.
public abstract string OwnerPhoneUri{get;}

// Gets the display name of the owner of the endpoint.
public string OwnerDisplayName{get; protected set;}

// Gets the URI of the endpoint.
public string EndpointUri{get;}

// Gets the default domain for the endpoint URI. 
public string DefaultDomain{get;}

// Gets the phone context for the endpoint.
// Phone context information is retrieved from provisioning data. 
// If user level value is available in provisioning data, then this property returns that value. 
// Otherwise, the pool level value is returned.
// If provisioning data is not available, this property returns an empty string. 
public string PhoneContext{get;}

// Gets the conference services object used to schedule conferences
// and to perform other conference tasks.
public ConferenceServices ConferenceServices{get;}

// Gets the service that can be used to subscribe for presence information.
// Supported only if the endpoint is registered on a server.
public RemotePresence RemotePresence{get;}

// Gets the service used to publish presence data for this endpoint.
// Supported only if the endpoin tis registered on a server.
public LocalOwnerPresence LocalOwnerPresence{get;}

// Gets the current state of the call screening feature.
// If enabled, incoming calls are screened based on the user's state as perceived by the
// remote participant. 
public bool PresenceBasedScreeningDisabled {get;}

// Gets the methods supported by a registered endpoint.
// By default, this is set to support subscription and signaling sessions.
public string RegisterMethods{get;}

// Gets the list of content types that can be supported by the endpoint.
// The content type of any mime part with handling=required should be in this list.
// Otherwise, incoming calls will be rejected automatically.
public IEnumerable<ContentType> SupportedMimePartContentTypes {get; }

// Gets the user agent string that will be used for messages.
// This is formed by combining a default user agent string with
// CollaborationPlatform.ApplicationUserAgent and
// LocalEndpoint.EndpointUserAgent.
public string UserAgent {get;}

// Gets the flag that controls whether the endpoint
// will attempt to publish quality metrics for audio calls.
public bool PublishingQoeMetricsDisabled {get;}

// Gets whether provisioning data query has been disabled.
public bool ProvisioningDataDisabled {get; set;}

// Gets whether the provisioning data autorefresh has been disabled.
public bool ProvisioningDataAutoRefreshDisabled {get;}

The following table lists frequently-used properties of the LocalEndpoint class, and their descriptions.

Property

Description

EndpointType

The type can be User, Application, Gateway, or Conference. User endpoints are always of type User. Application endpoints can be any of the four types. Setting the endpoint type translates to feature tag parameters in the Contact header, with the following correspondences: Application translates to “automata”, Gateway translates to “isGateway”, and Conference translates to “isFocus”.

EndpointSubtype

This can be set only for application endpoints whose EndpointType property is set to Application. The EndpointSubtype property corresponds to the “actor=” parameter in the Contact header. A value of None means that the “actor =” parameter is missing from the Contact header. The remaining values have the following correspondences: Principal corresponds to ”principal”, MessageTaker corresponds to”msg-taker”, Attendant corresponds to”attendant”, and Information corresponds to”information”.

InnerEndpoint

The RealTimeEndpoint object that is wrapped by the LocalEndpoint. This is needed only for advanced scenarios.

Platform

The CollaborationPlatform object that corresponds to this endpoint.

State

The LocalEndpoint state, a value of the LocalEndpointState enumeration. The possible values are Idle, Establishing, Established, Reestablishing, Terminating, and Terminated. For an explanation of the states and transitions between states, see the LocalEndpoint Events section in this topic.

OwnerUri

The URI with which the endpoint was created.

OwnerPhoneUri

The phone URI of the endpoint. This member is overridden in derived classes.

OwnerDisplayName

The display name of the endpoint. This member is overridden in derived classes.

EndpointUri

For registered endpoints this is the dynamic Globally Routable UserAgent URI (GRUU) returned by Office Communications Server during registration. For unregistered application endpoints this will contain the value of the ActiveGruu property on the platform after the endpoint is established. The GRUU is set on any message that the endpoint sends as the Contact header. Application endpoints use the platform’s ActiveGruu property as the Contact header for privileged operations even if it has a dynamic GRUU.

DefaultDomain

The default domain of the endpoint, as derived from the Uri property on the endpoint.

PhoneContext

The phone context to be used for tel URIs. This is received through inband data.

ConferenceServices

This member is used to perform several conference-related tasks for the endpoint.

RemotePresence

This service is used to subscribe to presence information. Applicable only to registered endpoints.

LocalOwnerPresence

This service is used to publish presence information. Applicable only to registered endpoints.

PresenceBasedScreeningEnabled

If enabled, incoming calls are screened based on the user's state as perceived by the remote participant. Applicable only to registered endpoints.

RegisterMethods

Gets or sets the methods supported by a registered endpoint. This property should usually be set before the endpoint’s Establish method is called. If set later it will take effect when registration refresh occurs. The default value should be sufficient for most applications: "\"Service,Notify,Benotify,Message,Info,Options,Invite\"".

SupportedMimePartContentTypes

Specifies the content types that the application supports. The content type of any mime part with handling=required should be in this list. Otherwise, incoming calls will be rejected automatically.

LocalEndpoint Methods

The following are the public methods on the LocalEndpoint class.

// Returns a snapshot of the conversations managed by this endpoint.
public ReadOnlyCollection<Conversation> GetConversations();

// Initializes the endpoint so that it is ready for receiving incoming messages.
public IAsyncResult BeginEstablish(AsyncCallback userCallback, object state);

// Initializes the endpoint so that it is ready for receiving incoming messages.
public IAsyncResult BeginEstablish(IEnumerable<SignalingHeader> additionalHeaders, 
    AsyncCallback userCallback, object state);

// Completes the establish operation.
public SipResponseData EndEstablish(IAsyncResult result);

//Terminates the endpoint and cleans up active sessions and resources.
//The endpoint is no longer usable.
public IAsyncResult BeginTerminate(AsyncCallback userCallback, object state);

// Completes the asynchronous Terminate operation.
public void EndTerminate(IAsyncResult result)

// Initiates an operation to query for the latest provisioning data.
public IAsyncResult BeginGetProvisioningData(AsyncCallback userCallback, object state);

// Completes the operation to query for the latest provisioning data
public ProvisioningData EndGetProvisioningData(IAsyncResult result);

// Adds an application handler for handling incoming calls of a specific type.
// Only one delegate can be registered for each TCall type.  
// Subsequent calls to this method will overwrite the previously set value.
public void RegisterForIncomingCall<TCall>(IncomingCallDelegate<TCall> incomingCallDelegate) where TCall : Call;

// Removes a previously added handler that was handling incoming calls of a specific type.
public void UnRegisterForIncomingCall<TCall>(IncomingCallDelegate<TCall> incomingCallDelegate) where TCall:Call;

// Handles an incoming signaling session.
// A derived class can override this method to process an incoming SignalingSession before UCMA 2.0 Core processes it.
protected virtual bool HandleSignalingSession(SessionReceivedEventArgs sessionReceivedEventArgs);

The following table lists commonly-used methods of the LocalEndpoint class, and their descriptions.

Method

Description

GetConversations()

Gets a snapshot of the conversations managed by this endpoint.

BeginGetProvisioningData()

Returns the cached inband provisioning data, or retrieves it from the server if not already present.

BeginEstablish()

Initializes the endpoint so that it is ready to receive incoming messages. After calling this method, call EndEstablish to complete the operation. Among other things, this causes endpoints to be registered using the appropriate type. This method can be called only after CollaborationPlatform.Startup has been called successfully.

BeginTerminate()

Terminates the endpoint and cleans up active sessions and resources. After calling this method, call EndTerminate to complete the operation. CollaborationPlatform.Shutdown automatically terminates the endpoints as well. After Terminate is called, the endpoint is unusable.

[M:Microsoft.Rtc.Collaboration.LocalEndpoint.RegisterForIncomingCall<(Of<(TCall>)>)]

Adds an application handler to handle incoming calls of a specific type. Only one delegate can be registered for each type. Subsequent calls to this method overwrite the previously set value.

[M:Microsoft.Rtc.Collaboration.LocalEndpoint.UnregisterForIncomingCall<(Of<(TCall>)>)]

Removes a previously added handler that handled incoming calls of a specific type.

LocalEndpoint Events

The following table lists frequently-used events on the LocalEndpoint class, and their descriptions.

Event

Description

StateChanged

Raised when the state of the endpoint changes. The StateChanged event is raised according to the state transitions in the illustrations that follow this table. The first illustration shows the state transitions for user endpoints and unregistered application endpoints. The second illustration shows the state transitions for registered application endpoints.

RepublishingRequired

Raised when the Register response contains a "presence-state" header with Register-action, which requires the application to republish some of the data. If the Register-action header value is "Added”, applications are expected to publish all categories (eventArg will have PartialRepublish set to false). If the Register-action header value is "fixed”, selected category data might need to be republished (PartialRepublish will be set to true). If the Register-action header value is “Refreshed”, the event is not raised, as nothing needs to be republished. In case of “fixed” or “added”, Unified Communications Managed API 2.0 Core SDK also refreshes all current subscriptions before raising this event.

ConferenceInvitationReceived

Notifies an application when a conference invitation is received.