An ApplicationEndpointendpoint designates a service involving communications, possible user interactions, and collaborations. It is represented by a Contactobject in Active Directory. This endpoint type is globally trusted and highly available, and uses server permissions. Using IM or audio, this endpoint type can communicate with one or more remote parties, and can collaborate using presence through Enhanced Presence subscription and publication. An ApplicationEndpointinstance can be assigned a SIP URI and a Dialed Number Identification Service (DNIS) telephone number. Applications that require multimodal communications or presence must register with Office Communications Server. Because there are limitations on how many categories an endpoint can subscribe to at the same time, if an ApplicationEndpointis intended to remain online indefinitely, we recommend that the automatonelement in the contactCardelement for such an endpoint be set to true. In this way, the ApplicationEndpointpresentity is recognized as an automaton or “bot” and a persistent subscription need not be maintained, thereby saving client resources. In this case, a client can poll the ApplicationEndpointfor presence information.

With regard to presence, there are restrictions on the ApplicationEndpointtype that do not apply to the UserEndpointtype. These restrictions appear in the following list.

Publishing Presence

The following procedure shows the steps involved in publishing the presence of an ApplicationEndpointinstance.

To publish the presence of an ApplicationEndpoint instance
  1. Create and establish an ApplicationEndpointinstance, as shown in the following example code. The most important steps appear in the following list.

    1. Create a CollaborationPlatforminstance using settings appropriate to your server.

    2. Create an ApplicationEndpointinstance, passing the platform instance created in the first step as a parameter in call to the constructor.

    3. Establish the endpoint created in the previous step by calling the endpoint’s BeginEstablishmethod.

    The following example code is for purposes of illustration only.

    Copy Code
    ServerPlatformSettings settings = new
    ServerPlatformSettings("MyAppAgent", "localhost", 5061/*port*/,
    CollaborationPlatform platform = new
    platform.EndStartUp(_collabPlatform.BeginStartUp(null, null)); 
    ApplicationEndpointSettings settings = new
    // Make sure that UseRegistration is set to true. 
    settings.UseRegistration = true;
    ApplicationEndpoint endpoint = new
    endpoint.BeginEstablish( EstablishCompleted, endpoint);
    void EstablishCompleted(IAsyncResult result)
      ApplicationEndpoint ae = result.AsyncState as
  2. Indicate that the ApplicationEndpointinstance is available by publishing its aggregateStatewith a value of 3500 for availability. In addition, if the endpoint is intended to be always online, publish a contactCardwhose automatonelement has a value of true.

    Copy Code
    String aggregateStateXml = "<state
    String automatonXml = "<contactCard
  3. Create CustomPresenceCategoryinstances for the stateand contactCardcategories. The strings to pass in the aggregateStateXmlargument of the constructor appear in the previous step of this procedure.

    Copy Code
    CustomPresenceCategory appStateCategory = new
    CustomPresenceCategory("state", aggregateStateXml);
    CustomPresenceCategory contactCardCategory = new
    CustomPresenceCategory("contactcard", automatonXml); 
  4. Create two PresenceCategoryWithMetadatainstances, passing the instance ID, the container, and the presence category in the calls to the constructor. The presence categories were created in the previous step of this procedure. An ApplicationEndpointinstance specifies the containers to which it will publish. In the following code example, the default containers will be published to, making the presence information available to everyone.

    Copy Code
    PresenceCategoryWithMetaData stateMetaData = new
    			 1 /* instanceId  */,
    			 0 /* default container */,
    			 appStateCategory /* state*/);
    // This state category will be published only once.
    stateMetaData.ExpiryPolicy = ExpiryPolicy.Persistent;
    PresenceCategoryWithMetaData contactCardMetaData = new
    			 5 /* instanceId  */,
    			 0 /* default container */,
    			 contactCardCategory /* contactCard*/);
    // This contactCard category will be published only once.
    contactCardMetaData.ExpiryPolicy = ExpiryPolicy.Persistent;
  5. Use the LocalOwnerPresenceproperty on the endpoint to publish the presence information.

    Copy Code
    			new PresenceCategoryMetaData[] { contactCardMetaData ,
    void PresencePublishingCompleted(IAsyncResult result)
      LocalOwnerPresence lop = result.AsyncState as LocalOwnerPresence;

Subscribing to the Presence of a Remote User

The steps for an ApplicationEndpointinstance to subscribe to the presence of a remote user are identical to those for a UserEndpointinstance. For more information, see Subscribing to Presence.