XEP-0168: Resource Application Priority

Abstract
This document defines an XMPP protocol extension to indicate the presence priority of XMPP resources for applications other than standard XMPP messaging.
Authors
  • Peter Saint-Andre
  • Joe Hildebrand
Copyright
© 2005 – 2008 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Deferred

WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.
Type
Standards Track
Version
0.7 (2008-09-26)
Document Lifecycle
  1. Experimental
  2. Deferred
  3. Proposed
  4. Stable
  5. Final

1. Introduction

Within the Extensible Messaging and Presence Protocol (XMPP Core [1]), presence indicates availability for communication. Specifically, in systems that bundle presence and instant messaging (see XMPP IM [2]), 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.

Consider a scenario in which a contact wants to initiate a voice chat (see Jingle RTP Sessions (XEP-0167) [3]) with a user who has the following three XMPP resources:

Table 1: Application Presence
Resource Messaging Priority Voice Chat Priority
desktop 10 5
pda 5 -1
mobile -1 10

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).

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.

As applications of that core use case, this document also defines:

2. What Is An Application?

This specification deliberately leaves the meaning of the term "application" or "application type" fairly loose. Possible examples include:

A future version of this specificaiton might establish a registry for application types.

3. Application Priority

3.1 Format

Application priority is encapsulated by a <rap/> element qualified by the 'urn:xmpp:rap:0' namespace (see Namespace Versioning regarding the possibility of incrementing the version number). The attributes of the <rap/> element are as follows.

Table 2: RAP Attributes
Attribute Definition Inclusion
ns The primary namespace of the application type. REQUIRED
num The resource's priority for this application type. [4] REQUIRED

An example follows.

Example 1. Data format
<rap xmlns='urn:xmpp:rap:0'
     ns='urn:xmpp:jingle:apps:rtp:0'
     num='5'/>

3.2 Generation

The following business rules apply to the generation of resource application priority by the client:

  1. 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.

  2. 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").

  3. The <rap/> element SHOULD be empty.

As explained in the following sections, there are two possible transports for RAP data: standard XMPP presence and the XMPP publish-subscribe extension.

3.3 Presence Transport

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.

For the three resources ("desktop", "pda", and "mobile") mentioned above, the presence stanzas received by a contact would be as follows.

Example 2. Contact receives presence from user
<presence from='juliet@capulet.lit/desktop' to='romeo@montague.lit/home'>
  <priority>10</priority>
  <rap xmlns='urn:xmpp:rap:0'
       ns='urn:xmpp:jingle:apps:rtp:0'
       num='5'/>
</presence>

<presence from='juliet@capulet.lit/pda' to='romeo@montague.lit/home'>
  <priority>5</priority>
  <rap xmlns='urn:xmpp:rap:0'
       ns='urn:xmpp:jingle:apps:rtp:0'
       num='-1'/>
</presence>

<presence from='juliet@capulet.lit/mobile' to='romeo@montague.lit/home'>
  <priority>-1</priority>
  <rap xmlns='urn:xmpp:rap:0'
       ns='urn:xmpp:jingle:apps:rtp:0'
       num='10'/>
</presence>

3.4 Pubsub Transport

Alternatively, RAP data MAY be provided via the XMPP Publish-Subscribe (XEP-0060) [5] publish-subscribe extension, specifically the Personal Eventing Protocol (XEP-0163) [6] profile thereof.

For the three resources ("desktop", "pda", and "mobile") mentioned above, the pubsub notifications received by a contact would be as follows.

Example 3. Contact receives pubsub notifications from user
<message from='juliet@capulet.lit'
         id='rap1'
         to='romeo@montague.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:rap:0'>
      <item>
        <rap xmlns='urn:xmpp:rap:0'
             ns='urn:xmpp:jingle:apps:rtp:0'
             num='5'/>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='replyto' jid='juliet@capulet.lit/desktop'/>
  </addresses>
</message>

<message from='juliet@capulet.lit'
         id='rap2'
         to='romeo@montague.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:rap:0'>
      <item>
      <rap xmlns='urn:xmpp:rap:0'
           ns='urn:xmpp:jingle:apps:rtp:0'
           num='-1'/>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='replyto' jid='juliet@capulet.lit/pda'/>
  </addresses>
</message>

<message from='juliet@capulet.lit'
         id='rap3'
         to='romeo@montague.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:rap:0'>
      <item>
      <rap xmlns='urn:xmpp:rap:0'
           ns='urn:xmpp:jingle:apps:rtp:0'
           num='10'/>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='replyto' jid='juliet@capulet.lit/mobile'/>
  </addresses>
</message>

4. Flagging the Primary Resource

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.

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:

Example 4. Primary resource flag
<presence from='juliet@capulet.lit/mobile'>
  <priority>-1</priority>
  <rap xmlns='urn:xmpp:rap:0'
       ns='urn:xmpp:jingle:apps:rtp:0'
       num='10'>
    <primary/>
  </rap>
</presence>

The following business rules apply to primary resource flagging by the server:

  1. A server MAY add the <primary/> element to RAP data generated by the resource it determines is "most available" for a given application type.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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).

5. RAP-Based Message Routing

A server MAY use the RAP data provided by a client in determining how to route incoming <message/> stanzas directed to the bare JID <localpart@domain.tld> 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 (see Namespace Versioning regarding the possibility of incrementing the version number) including an 'ns' attribute corresponding to the desired application type.

For example, consider a Stanza Session Negotiation (XEP-0155) [7] 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.

Example 5. User requests session
<message from='romeo@montague.lit/orchard'
         to='juliet@capulet.lit'
         type='headline'>
  <thread>ffd7076498744578d10edabfe7f4a866</thread>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='form'>
      <title>Open chat with Romeo?</title>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:ssn</value>
      </field>
      <field label='Accept this session?' type='boolean' var='accept'>
        <value>true</value>
        <required/>
      </field>
    </x>
  </feature>
  <route xmlns='urn:xmpp:raproute:0'
         ns='urn:xmpp:jingle:apps:rtp:0'/>
</message>

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.

6. Determining Support

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 (see Namespace Versioning regarding the possibility of incrementing the version number) in response to Service Discovery (XEP-0030) [8] information requests.

Example 6. Entity queries a server regarding protocol support
<iq from='juliet@capulet.lit/balcony'
    id='disco1'
    to='capulet.lit'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
Example 7. Server communicates protocol support for RAP
<iq from='capulet.lit'
    id='disco1'
    to='juliet@capulet.lit/balcony'
    type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='urn:xmpp:rap:0'/>
    <feature var='urn:xmpp:raproute:0'/>
  </query>
</iq>

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 Entity Capabilities (XEP-0115) [9]. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.

7. Security Considerations

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.

Server flagging of the primary resource is not known to introduce any vulnerabilities or compromises of user privacy.

8. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [10].

9. XMPP Registrar Considerations

9.1 Protocol Namespaces

This specification defines the following XML namespaces:

Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar [11] shall add the foregoing namespaces to the registry located at <https://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function (XEP-0053) [12].

9.2 Namespace Versioning

If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, 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 XEP-0053.

10. XML Schemas

10.1 RAP

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:rap:0'
    xmlns='urn:xmpp:rap:0'
    elementFormDefault='qualified'>

  <xs:element name='rap'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='primary' type='empty' minOccurs='0' maxOccurs='1'/>
      </xs:sequence>
      <xs:attribute name='ns' type='xs:string' default='jabber:client'/>
      <xs:attribute name='num' type='xs:byte'/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

10.2 RAP Routing

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:raproute:0'
    xmlns='urn:xmpp:raproute:0'
    elementFormDefault='qualified'>

  <xs:element name='route'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='ns' type='xs:string' default='jabber:client'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>


Appendices

Appendix A: Document Information

Series
XEP
Number
0168
Publisher
XMPP Standards Foundation
Status
Deferred
Type
Standards Track
Version
0.7
Last Updated
2008-09-26
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM, XEP-0030
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Peter Saint-Andre
Email
stpeter@stpeter.im
JabberID
stpeter@jabber.org
URI
https://stpeter.im/
Joe Hildebrand
Email
jhildebr@cisco.com
JabberID
hildjj@jabber.org

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

2. RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc6121>.

3. XEP-0167: Jingle RTP Sessions <https://xmpp.org/extensions/xep-0167.html>.

4. This protocol uses a 'num' attribute rather than a 'priority' attribute to reduce confusion with standard XMPP presence.)

5. XEP-0060: Publish-Subscribe <https://xmpp.org/extensions/xep-0060.html>.

6. XEP-0163: Personal Eventing Protocol <https://xmpp.org/extensions/xep-0163.html>.

7. XEP-0155: Stanza Session Negotiation <https://xmpp.org/extensions/xep-0155.html>.

8. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

9. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.

10. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

11. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

12. XEP-0053: XMPP Registrar Function <https://xmpp.org/extensions/xep-0053.html>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.7 (2008-09-26)
    psa
  2. Version 0.6 (2007-11-19)

    Documented optional pubsub transport for RAP data.

    psa
  3. Version 0.5 (2007-11-15)

    Editorial review and consistency check.

    psa
  4. Version 0.4 (2007-06-06)
    psa
  5. Version 0.3 (2006-09-17)

    Changed im application type to messaging; added jingle-video.

    psa
  6. Version 0.2 (2005-12-19)

    Clarified structure of, and added schema for, RAP request namespace.

    psa
  7. Version 0.1 (2005-12-15)

    Initial published version.

    psa
  8. Version 0.0.6 (2005-11-29)

    Document cleanup.

    psa
  9. Version 0.0.5 (2005-11-17)

    Added support for RAP requests via IQ.

    psa
  10. Version 0.0.4 (2005-10-27)

    Defined registry of application types; clarified business rules; corrected schema.

    psa/jjh
  11. Version 0.0.3 (2005-10-24)

    Broadened previous resource flagging proposal to include priority for applications other than messaging.

    psa/jjh
  12. Version 0.0.2 (2005-09-26)

    Added more business rules and examples; defined service discovery guidelines.

    psa/jjh
  13. Version 0.0.1 (2005-09-23)

    First draft.

    psa/jjh

Appendix I: Bib(La)TeX Entry

@report{saint-andre2005xep0168,
  title = {Resource Application Priority},
  author = {Saint-Andre, Peter and Hildebrand, Joe},
  type = {XEP},
  number = {0168},
  version = {0.7},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0168.html},
  date = {2005-09-23/2008-09-26},
}

END