<abstract>This document defines an XMPP protocol extension to indicate the presence priority of XMPP resources for applications other than standard XMPP messaging.</abstract>
<li>Added section on RAP-based routing of messages sent to bare JIDs.</li>
<li>Removed RAP request protocol.</li>
<li>Changed app attribute to ns attribute.</li>
<li>Removed the application types registry since it is unnecessary if the ns attribute specifies the XML namespace of the data most closely associated with the application type.</li>
<li>Updated namespaces to conform to XMPP Registrar processes.</li>
<p>Within the Extensible Messaging and Presence Protocol (XMPP; see &rfc3920;), presence indicates availability for communication. Specifically, in systems that bundle presence and instant messaging (see &rfc3921;), the <priority/> child of the XMPP &PRESENCE; stanza indicates availability for communications qualified by the "jabber:client" namespace, especially instant messaging. However, a wide variety of entities might provide XMPP presence, including entities that are not primarily focused on IM (e.g., phones) or even entities that do not support XMPP messaging at all.</p>
<p>If the contact chooses the resource with which it initiates a voice chat based on the standard XMPP <priority/> element, the resulting behavior could be misleading (i.e., initiating the voice chat with the "desktop" resource rather than the "mobile" resource).</p>
<p>What is needed is a way for the user's clients to indicate that the application priority for the three resources is different from the standard XMPP priority. This document defines such a mechanism via an optional XMPP presence extension.</p>
<li>A way for an XMPP server to mark which resource it considers to be primary for any given application type, if it has information -- such as communication preferences -- that can help it determine the primary resource.</li>
<li>A way for an XMPP server to use application priority data for more intelligent routing of specially-labelled XMPP &MESSAGE; stanzas directed to a user's bare JID &LOCALBARE;.</li>
<p>Application priority is encapsulated by a <rap/> element qualified by the 'urn:xmpp:rap:0' namespace &VNOTE;. The attributes of the <rap/> element are as follows.</p>
<td>The primary namespace of the application type.</td>
<td>REQUIRED</td>
</tr>
<tr>
<td>num</td>
<td>The resource's priority for this application type. <note>This protocol uses a 'num' attribute rather than a 'priority' attribute to reduce confusion with standard XMPP presence.)</note></td>
<li><p>A client SHOULD include a <rap/> element for each application type it prioritizes, but SHOULD NOT do so if the priority for that application is the same as the resource's standard XMPP priority.</p></li>
<li><p>A client MUST NOT generate a <rap/> element that has a 'ns' attribute whose value is "jabber:client" or that has no 'ns' attribute (since the default 'ns' is "jabber:client").</p></li>
<li><p>The <rap/> element SHOULD be empty.</p></li>
</ol>
<p>As explained in the following sections, there are two possible transports for RAP data: standard XMPP presence and the XMPP publish-subscribe extension.</p>
<p>RAP data MAY be included as extended content within a standard XMPP presence stanza. This is consistent with the rule that presence stanzas need to be related to the network availability or communication preferences of the entity that provides presence information.</p>
<p>The user's XMPP server might have special information that enables it to flag a resource as primary for a given application type. For instance, the server may include a communication policy service that enables the user to define (outside the context of any presence priorities) that she would prefer to be called at her desktop computer only between the hours of 9:00 AM and 5:00 PM local time, prefer to be called on her mobile phone at all other times, and so on.</p>
<p>To flag the primary resource related to a specific application type, the server shall add a <primary/> child to the relevant RAP element. Here is an example:</p>
<li><p>A server MAY add the <primary/> element to RAP data generated by the resource it determines is "most available" for a given application type.</p></li>
<li><p>Because the default 'ns' is "jabber:client", to flag the primary resource for standard XMPP communications the server SHOULD NOT include a 'ns' attribute, SHOULD NOT include a 'num' attribute, and MUST include a <primary/> child.</p></li>
<li><p>An available resource that has specified a negative priority for an application type MUST NOT be flagged as the primary resource for that application type.</p></li>
<li><p>A client SHOULD NOT include the <primary/> element in RAP data that it generates; however, if a client includes a <primary/> element, the server SHOULD remove or overwrite the element.</p></li>
<li><p>In response to a presence probe, a server SHOULD send presence from the primary resource first (this enables the receiving client to skip any local "most-available-resource" algorithms it might implement) if the client includes RAP data in presence.</p></li>
<li><p>If the primary resource changes for a given application type and the client includes RAP data in presence, a server MUST broadcast updated presence information (including the <primary/> element) for the new primary resource. If the change in primary resource occurs because of a presence broadcast from the current primary resource, the server MUST push presence from the current primary resource (without the <primary/> element) before pushing presence from the new primary resource (including the <primary/> element).</p></li>
<p>A server MAY use the RAP data provided by a client in determining how to route incoming &MESSAGE; stanzas directed to the bare JID &LOCALBARE; of a registered account. In order to enable such routing, the sender MUST include an empty <route/> element qualified by the 'urn:xmpp:raproute:0' namespace &VNOTE; including an 'ns' attribute corresponding to the desired application type.</p>
<p>For example, consider a &xep0155; request sent from one user (Romeo) to another (Juliet), where the users do not share presence. Romeo wants the request to be delivered to the highest-priority resource for the "urn:xmpp:jingle:apps:rtp:0" application type.</p>
<p>If Juliet's server supports RAP routing, it would then deliver the message to whichever of Juliet's resources has the highest priority for the "urn:xmpp:jingle:apps:rtp:0" application type.</p>
<p>If an entity supports resource application priorities, it MUST advertise that fact by returning a feature of "urn:xmpp:rap:0", "urn:xmpp:raproute:0", or both &VNOTE; in response to &xep0030; information requests.</p>
<p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
<p>When the pubsub transport is used, client publishing of resource application priority can result in a presence leak if the node access model is "open". Care should be taken in properly configuring the pubsub node so that unauthorized entities are not able to retrieve information about the user's available resources.</p>
<p>Server flagging of the primary resource is not known to introduce any vulnerabilities or compromises of user privacy.</p>
<p>Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
<p>If the protocol defined in this specification undergoes a major revision that is not fully backward-compatible with an older version, or that contains significant new features, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>