This documentation is archived and is not being maintained.

Presence and the ApplicationEndpoint

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.

An ApplicationEndpoint endpoint designates a service involving communications, possible user interactions, and collaborations. It is represented by a Contact object 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 ApplicationEndpoint instance 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 ApplicationEndpoint is intended to remain online indefinitely, we recommend that the automaton element in the contactCard element for such an endpoint be set to true. In this way, the ApplicationEndpoint presentity 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 ApplicationEndpoint for presence information.

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

  • Automatic screening of incoming calls based on subscriber membership in blocked containers is disabled.

  • Contacts and groups are disabled.

  • Grammar-based publication is not allowed.

  • Bootstrapping and startup presence publications are disabled.

  • Public Internet cloud (PIC) users are not permitted to subscribe to presence from ApplicationEndpoint instances such as bots and notification agents.

    This restriction limits the potential for Denial of Service attacks. There is a maximum number of subscriptions that can be placed on a presentity at a given time, so without this restriction, a remote endpoint could flood the ApplicationEndpoint with subscription requests, thereby making it unable to handle legitimate subscription requests.

Publishing Presence

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

To publish the presence of an ApplicationEndpoint instance

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

    1. Create a CollaborationPlatform instance using settings appropriate to your server.

    2. Create an ApplicationEndpoint instance, 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 BeginEstablish() method.

    The following example code is for purposes of illustration only.

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

    String aggregateStateXml = "<state xmlns=\"\" xmlns:xsi=\"\" xsi:type=\“aggregateState\"><availability>3500</availability></state>";
    String automatonXml = "<contactCard xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns=\"\"><automaton>true</automaton></contactCard>";
  3. Create CustomPresenceCategory instances for the state and contactCard categories. The strings to pass in the aggregateStateXml argument of the constructor appear in the previous step of this procedure.

    CustomPresenceCategory appStateCategory = new CustomPresenceCategory("state", aggregateStateXml);
    CustomPresenceCategory contactCardCategory = new CustomPresenceCategory("contactcard", automatonXml); 
  4. Create two PresenceCategoryWithMetadata instances, 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 ApplicationEndpoint instance 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.

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

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

Subscribing to the Presence of a Remote User

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