<abstract>This document defines an XMPP protocol extension to indicate the presence priority of XMPP resources for applications other than messaging.</abstract>
<remark><p>Added section on RAP-based routing of messages sent to bare JIDs; removed RAP request protocol; changed app attribute to ns attribute; 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; updated namespaces to conform to XMPP Registrar processes.</p></remark>
<p>Within the Extensible Messaging and Presence Protocol (XMPP; see &rfc3920;), presence indicates availability for communication -- specifically, communication via XMPP messaging in the "jabber:client" namespace (usually in the form of "instant messaging" or IM as described in &rfc3921;). 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>Consider a scenario in which a contact wants to initiate a voice chat (e.g., via &xep0166;) with a user who has the following three XMPP resources:</p>
<p>If the contact chooses the resource with which it initiates a voice chat based on the user's default XMPP presence priority (i.e., priority for XMPP messaging), 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 messaging priority. Such information can also be used by an XMPP to route XMPP &MESSAGE; stanzas directed to a user's bare JID (&BAREJID;). This document defines such a mechanism via an optional XMPP presence extension.</p>
<p>In addition, this document also defines a way for an XMPP server to flag which resource it considers to be primary for any given application type, if it has information -- such as communication preferences -- that can help determine the primary resource.</p>
<p>Consider the three resources ("desktop", "pda", and "mobile") mentioned above. The presence stanzas received by a contact for those three resources would be as follows &NSNOTE;:</p>
<li><p>A client SHOULD NOT specify resource application presence if the priority for that application is the same as the resource's XMPP messaging 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>
<section1topic='Flagging the Primary Resource'anchor='flag'>
<p>The user's server may 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>
<p>The following business rules apply to resource flagging by the server:</p>
<olstart='1'>
<li><p>A server MAY add the primary resource flag to the presence broadcasts 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 XMPP messaging 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 resource flag in presence stanzas that it generates; however, if a client includes the primary resource flag in a presence stanza, the server SHOULD remove or overwrite the flag.</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 algorithms it might implement).</p></li>
<li><p>If the primary resource changes for a given application type, a server MUST push presence (including the primary resource flag) 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 resource flag) before pushing presence from the new primary resource (including the primary resource flag).</p></li>
<p>A server MAY use the RAP data provided by clients in order to route incoming &MESSAGE; stanzas directed to the bare JID (&BAREJID;) of a registered account. In order to enable such routing, the sender MUST include an empty <route/> element qualified by the 'http://www.xmpp.org/extensions/xep-0168.html#ns-raproute' namespace &NSNOTE; including an 'ns' attribute corresponding to the desired application.</p>
<p>For example, consider a &xep0155; request send from one user (Romeo) to another (Juliet), where the users do not share presence:</p>
<fieldlabel='Accept this session?'type='boolean'var='accept'>
<value>true</value>
<required/>
</field>
...
</feature>
</message>
]]></example>
<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 "http://www.xmpp.org/extensions/xep-0167#ns" application type.</p>
<p>Neither client publishing of resource application priority nor server flagging of the primary resource introduces any known security vulnerabilities or compromises of user privacy.</p>
<p>Upon advancement of this specification, the ®ISTRAR; shall issue permanent namespaces in accordance with the process defined in Section 4 of &xep0053;.</p>