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.
- 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
ApplicationEndpointinstances 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 ApplicationEndpointwith 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 ApplicationEndpointinstance.
-
Create and establish an ApplicationEndpointinstance, as shown in the following example code. The most important steps appear in the following list.
- Create a
CollaborationPlatforminstance using settings appropriate to
your server.
- Create an
ApplicationEndpointinstance, passing the platform instance
created in the first step as a parameter in call to the
constructor.
- 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*/, "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; ae.EndEstablish(result); }
- Create a
CollaborationPlatforminstance using settings appropriate to
your server.
-
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 xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\“aggregateState\"><availability>3500</availability></state>"; String automatonXml = "<contactCard xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://schemas.microsoft.com/2006/09/sip/contactcard\"><automaton>true</automaton></contactCard>";
-
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);
-
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 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;
-
Use the LocalOwnerPresenceproperty on the endpoint to publish the presence information.
Copy Code endpoint.LocalOwnerPresence.BeginPublishPresence( new PresenceCategoryMetaData[] { contactCardMetaData , appStateCategory}, PresencePublishingCompleted, endpoint.LocalOwnerPresence); } ... void PresencePublishingCompleted(IAsyncResult result) { LocalOwnerPresence lop = result.AsyncState as LocalOwnerPresence; lop.EndPublishPresence(result); }
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.