An application can use the ApplicationEndpointclass to create an endpoint that provides services to other clients. One parameter in the ApplicationEndpointconstructor is an ApplicationEndpointSettingsinstance.
ApplicationEndpointSettings
The ApplicationEndpointSettingsclass serves as a container for required and optional information of use to an ApplicationEndpoint. The following are the public members of the ApplicationEndpointSettingsclass.
Copy Code | |
---|---|
// Constructors // Initializes an ApplicationEndpointSettings object. public ApplicationEndpointSettings(string ownerUri); // Initializes an ApplicationEndpointSettings object. public ApplicationEndpointSettings(string ownerUri, string proxyHost, int proxyPort); // Properties // Gets or sets the phone uri of the endpoint. Optional. public string OwnerPhoneUri {get; set;} // Gets or sets the display name of the application endpoint. Optional. public string OwnerDisplayName {get;set;} // Gets the proxy host to use as first hop instead of // directly connecting to the other endpoint. Optional. // This allows messages to be routed to endpoints that // might not be directly reachable. public string ProxyHost {get;} // Gets the port to use for connecting to the proxy. Optional. public int ProxyPort {get;} // Gets or sets a flag to decide whether registration is performed for the endpoint. Optional. public bool UseRegistration {get;set;} // Gets or sets the subject of the certificate to expect from the proxy. public string ProxyCertificateSubject {get; set;} // Gets or sets the subject of the certificate to expect from the proxy. // This is used only if the endpoint is configured with a proxy and CollaborationPlatform has been configured to use MTLS. // It needs to be set only when the subject of the certificate expected from the proxy differs from the proxy host specified. public string ProxyCertificateSubject {get;set;} // Methods // Sets the type of user agent that this endpoint represents. public void SetEndpointType(EndpointType endpointType); // Sets the type of user agent that this endpoint represents. public void SetEndpointType(EndpointType endpointType, EndpointSubtype endpointSubtype); |
The following table provides additional information about some of the properties on the ApplicationEndpointSettingsclass.
Property | Description |
---|---|
OwnerPhoneUri |
The telURI, which should have a format similar to the following: tel:+1-425-5551234. |
ProxyHost |
Proxy host to use as the first hop instead of using a direct connection to the other endpoint. The proxy must be specified for endpoints that use the Office Communications Server infrastructure for any purposes including contact objects and trusted services. |
ProxyPort |
The port number of the proxy host to use as the first hop instead of using a direct connection to the other endpoint. |
UseRegistration |
A flag that specifies whether the ApplicationEndpointmust be registered. If this is set to true, the endpoint is registered during the call to LocalEndpoint.Establish. Registered endpoints must be used if the endpoints must be routable from clients. It also enables use of presence services exposed from the endpoint. |
ProxyCertificateSubject |
A flag that is used only if the endpoint is configured with a proxy and CollaborationPlatformhas been configured to use Mutual TLS. Set this property only when the subject of the certificate that is expected from the proxy differs from the proxy's name. |
ApplicationEndpoint Members
The URI of an application endpoint corresponds to a contact record in the Active Directory (AD) for applications that target Office Communications Server. The forwarding address of the contact record can be set to the trusted service entry of the CollaborationPlatformto route to the endpoint. The contact record has a pool server entry by which the Office Communications Server computer can reach a load-balanced set of endpoints.
The application endpoint uses the platform’s ActiveGruuproperty in its ContactURI to perform privileged operations. An application endpoint must be registered to use presence services and must be directly routable-to from clients. A registered application endpoint also receives a dynamic GRUU from the server. Registration of an application endpoint is more resilient than that of a user endpoint because neither connection failures (even for long periods) nor registration refresh failures cause the endpoint to be terminated. In such cases, the endpoint goes to the Reestablishingstate until registration refresh succeeds.
The following are the public members of the ApplicationEndpointclass.
Copy Code | |
---|---|
// Constructor // Creates a new instance of the ApplicationEndpoint class. public ApplicationEndpoint(CollaborationPlatform platform, ApplicationEndpointSettings settings); // Properties // Gets the URI of owner of this endpoint. public override string OwnerUri{get;} // Gets whether registration is performed for the endpoint. public bool UseRegistration{get;} // Gets the phone URI of the owner of this endpoint. public override string OwnerPhoneUri{get;} |
Creating an ApplicationEndpoint Instance
The following example shows how to create an ApplicationEndpointinstance. The example assumes that a CollaborationPlatforminstance has previously been created and initialized.
Copy Code | |
---|---|
ApplicationEndpointSettings settings = new ApplicationEndpointSettings("sip:contact1@domain",serverFqdn, serverPort); // For registered endpoints (recommended). settings.UseRegistration = true; ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(platform, settings); applicationEndpoint.EndEstablish(applicationEndpoint.BeginEstablish(null, null)); private void EndpointEstablishCompleted(IAsyncResult result) { try { _applicationEndpoint.EndEstablish(result); Console.WriteLine("The Application Endpoint owned by URI: "); Console.WriteLine(_applicationEndpoint.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 Console.WriteLine(regEx.ToString()); } catch (AuthenticationException ae) { // AuthenticationException will be thrown when a general authentication-related problem occurred. // It is left to the developer to write real error handling code Console.WriteLine(ae.ToString()); } catch (OperationTimeoutException ate) { //OperationTimeoutException will be thrown when server did not respond for Register request. // It is left to the developer to write real error handling code Console.WriteLine(ate.ToString()); } } |