UserEndpoint

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.

A UserEndpoint instance can be used for real users represented as Active Directory domain services user objects.

UserEndpoint instances can be created from client-mode or server-mode CollaborationPlatform objects. When a UserEndpoint is established, it registers with a server running Microsoft Office Communications Server. This connection to the server is cached and is used for all outgoing communications. The endpoint registration is refreshed periodically to maintain registered status. In the event of a connection drop, the endpoint attempts to recover by refreshing the registration (by default, the endpoint’s status changes to Terminated). If a refresh fails, however, the endpoint is terminated. If the registration recovers, existing subscriptions are refreshed and the RepublishingRequired event might be raised. As long as the endpoint’s State property is set to Established, all presence services are available to it.

Important

If a UserEndpoint is used with a server-mode CollaborationPlatform instance in a high-scale application, the application should set the IsEndpointThrottled on SipEndpoint to false. The following code example shows how to do this for an existing UserEndpoint instance named userEP.

SipEndpoint sipEP = userEP.InnerEndpoint;
sipEP.IsEndpointThrottled = false;

Several methods and properties on the UserEndpoint class appear in the next code example.

public UserEndpoint(
    CollaborationPlatform platform, 
    UserEndpointSettings settings);


// Gets or sets the credential needed to authenticate the endpoint with servers.
public NetworkCredential Credential{get;set;}

// Gets the service used to access or update contact/group information for this endpoint.
public ContactGroupServices ContactGroupServices{get;}

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

// Gets the TelephonyMode for the endpoint.
public string TelephonyMode{get;}

// Gets the value that indicates whether the user is Unified Messaging-enabled.
public bool UmEnabled{get;}

The following table lists several frequently-used members of the UserEndpoint class.

Member

Description

Credential

Gets the credentials for an endpoint. The credential is needed whenever a CollaborationPlatform instance is configured to use SipTransportType.Tcp. When a user endpoint is challenged by the server, the endpoint supplies its credential for authentication purposes. The user endpoint is configured so that it will fail registration if it is not challenged by a server. If a server-type CollaborationPlatform instance is configured with MTLS, a credential is not needed.

ContactGroupServices

Gets the service that is used to access and update contact information for this endpoint.

OwnerUri

Gets the URI configured for this user.

OwnerPhoneUri

Gets the phone URI configured for this user. If the Presence publishing service has not yet been established (that is, if the PresencePublishingServices property is not set), an empty string is returned. An empty string will also be returned if a phone number is not found in the UserProperties category.

TelephonyMode

Gets the telephony mode configured for this user. If the Presence publishing service has not yet been established (that is, if the PresencePublishingServices property is not set), an empty string is returned. An empty string will also be returned if a telephonyMode is not found in the UserProperties category.

UmEnabled

Gets the value that indicates whether the user is enabled for Unified Messaging. If the Presence publishing service has not yet been established (that is, if the PresencePublishingServices property is not set), UmEnabled returns false. This property is true if UserProperties.ExUmEnabledFeatures has its lowest-order bit set.

Creating a UserEndpoint Instance

The following example shows how to create a UserEndpoint instance. The steps involve creating a CollaborationPlatform instance, creating a UserEndpoint instance, setting the credentials on the endpoint, and then establishing the endpoint.

UserEndpointSettings settings = new UserEndpointSettings("sip:user1@domain", serverFqdn, serverPort);

// Set credentials if the platform does not use MTLS.
settings.Credential = CredentialCache.DefaultNetworkCredentials;

UserEndpoint userEndpoint = new UserEndpoint(platform, settings);

userEndpoint.BeginEstablish(EndEndpointEstablish, _userEndpoint);

void EndEndpointEstablish(IAsyncResult ar)
{
  UserEndpoint userEndpoint = ar.AsyncState as UserEndpoint;
  try
  {
    userEndpoint.EndEstablish(ar);
    Console.WriteLine("The User Endpoint owned by URI: ");
    Console.WriteLine(userEndpoint.OwnerUri);
    Console.WriteLine(" is now established and registered.");
  }
  catch (ConnectionFailureException connFailEx)
  {
    // ConnectionFailureException will be thrown when the endpoint cannot connect to the server, or the credentials are invalid.
    // It is left to the developer to write real error-handling code.
    Console.WriteLine(connFailEx.ToString());
  }
  catch (InvalidOperationException iOpEx)
  {
    // InvalidOperationException will be thrown when the endpoint is not in a valid state to connect. To connect, the platform must be started and the Endpoint Idle.
    // It is left to the developer to write real error-handling code.
    Console.WriteLine(iOpEx.ToString());
  }
  catch (RegisterException regEx)
  {
    // RegisterException will be thrown when the endpoint cannot be registered (usually due to bad credentials).
    // It is left to the developer to write real error-handling code (here, the appropriate action is likely reprompting for user/password/domain strings).
    Console.WriteLine(regEx.ToString());
  }

}

UserEndpointSettings Class

The UserEndpointSettings class is used to initialize a UserEndpoint instance when it is created.

UserEndpointSettings Constructors

The UserEndpointSettings class has the following constructors.

// Creates a new instance of the UserEndpointSettings class.
public UserEndpointSettings(string ownerUri, string serverName);

// Creates a new instance of the UserEndpointSettings class.
public UserEndpointSettings(string ownerUri, string serverName, int serverPort);

UserEndpointSettings Properties

The following are the public properties on the UserEndpointSettings class.

// Gets the name of the server being used.
public string ServerName {get;}

// Gets the port of the server being used.
public int ServerPort {get;}

// Gets or sets the endpoint ID (EPID) to use for the endpoint. Optional.
public string EndpointId {get; set;}

// Gets or sets the credential needed to authenticate the endpoint with servers.
// Use CredentialCache.DefaultNetworkCredentials for a logged-on user.
public NetworkCredential Credential {get; set;}