JEP-0155: Chat Session Negotiation

This JEP specifies a feature negotiation profile for initiating a one-to-one chat session.


WARNING: This Informational JEP is Experimental. Publication as a Jabber Enhancement Proposal does not imply approval of this proposal by the Jabber Software Foundation. Implementation of the best practice or protocol profile described herein is encouraged in exploratory implementations, although production systems should not deploy implementations of this protocol until it advances to a status of Draft.


JEP Information

Status: Experimental
Type: Informational
Number: 0155
Version: 0.2
Last Updated: 2005-07-15
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core, JEP-0020, JEP-0068
Supersedes: None
Superseded By: None
Short Name: chatneg
Wiki Page: <http://wiki.jabber.org/index.php/Chat Session Negotiation (JEP-0155)>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JID: stpeter@jabber.org

Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2005 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software 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 JEP 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.

Conformance Terms

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


Table of Contents

1. Introduction
2. Negotiation Flow
3. Implementation Notes
4. Security Considerations
5. IANA Considerations
6. Jabber Registrar Considerations
6.1. Service Discovery Features
6.2. Field Standardization
7. XML Schema
Notes
Revision History


1. Introduction

The traditional model for one-to-one chat "sessions" in Jabber/XMPP is for a user to simply send a message to a contact without any formal negotiation of chat session parameters. This informal approach to initiation of a chat session is perfectly acceptable in most contexts, environments, and cultures. However, it may be desirable to formally request the chat and negotiate its parameters before beginning the chat session in some circumstances, such as:

This proposal defines best practices for such a negotiation, re-using the protocol defined in Feature Negotiation [5].

2. Negotiation Flow

In order to negotiate a chat session, the initiating party ("user") sends a <message/> stanza to the receiving party ("contact") containing a <feature/> child qualified by the 'http://jabber.org/protocol/feature-neg' namespace but containing no <body/> or other standard child elements (as specified in RFC 3921 [6]). The <message/> stanza is used because the user does not necessarily know which of the contact's resources is most available (or indeed if the contact is online). The <message/> stanza type SHOULD be "normal" (either explicitly or by non-inclusion of the 'type' attribute). The stanza MAY include an 'id' attribute for tracking purposes. The data form MUST contain a hidden FORM_TYPE field whose value is "http://jabber.org/protocol/chatneg".

The following is an example of a negotiation request:

Example 1. User requests chat session

<message type='normal'
         from='romeo@montague.net/orchard'
         to='juliet@capulet.com'
         id='neg1'>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='form'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/chatneg</value>
      </field>
      <field label='Accept this chat?'
             type='boolean' 
             var='accept'>
        <value>1</value>
      </field>
      <field label='Enable XHTML Formatting?'
             type='boolean' 
             var='http://jabber.org/protocol/xhtml-im'>
        <value>0</value>
      </field>
      <field label='Enable Chat State Notifications?'
             type='boolean' 
             var='http://jabber.org/protocol/chatstates'>
        <value>0</value>
      </field>
      <field label='Allow Message Logging?' 
             type='boolean' 
             var='logging'>
        <value>0</value>
      </field>
      <field label='Reason' 
             type='text-single' 
             var='reason'>
        <value>Can we talk?</value>
      </field>
    </x>
  </feature>
</message>
  

In the foregoing example, Romeo requests a chat with Juliet and also queries her regarding whether she wants to allow client-side message logging and support XHTML-IM [7] and Chat State Notifications [8] extensions during this chat session. (Note: These fields are examples only; a full set of chat session negotiation parameters will be registered as described in the Jabber Registrar Considerations section of this document.)

Juliet's server delivers Romeo's request to her most available resource (which happens to be "balcony").

We assume that Juliet accepts the chat and specifies that she does not want to log messages or use XHTML formatting but that she does want to use Chat State Notifications:

Example 2. Contact accepts offer and specifies parameters

<message type='normal'
         from='juliet@capulet.com/balcony'
         to='romeo@montague.net/orchard'
         id='neg1'>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/chatneg</value>
      </field>
      <field var='accept'>
        <value>1</value>
      </field>
      <field var='http://jabber.org/protocol/xhtml-im'>
        <value>0</value>
      </field>
      <field var='http://jabber.org/protocol/chatstates'>
        <value>1</value>
      </field>
      <field var='logging'>
        <value>0</value>
      </field>
      <field var='reason'>
        <value>Sure, let's talk!</value>
      </field>
    </x>
  </feature>
</message>
  

However, it could be that Juliet is busy so she declines the invitation.

Example 3. Contact declines offer and specifies reason

<message type='normal'
         from='juliet@capulet.com/balcony'
         to='romeo@montague.net/orchard'
         id='neg1'>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/chatneg</value>
      </field>
      <field var='accept'>
        <value>0</value>
      </field>
      <field var='reason'>
        <value>Sorry, can't chat now! How about tonight?</value>
      </field>
    </x>
  </feature>
</message>
  

If Juliet's client does not support feature negotiation or does not support the "http://jabber.org/protocol/chatneg" FORM_TYPE, it SHOULD return a <service-unavailable/> error (but MAY return no error if, for example, Juliet does not want to reveal her presence to Romeo for whatever reason):

Example 4. Contact returns service unavailable error

<message type='error'
         from='juliet@capulet.com/balcony'
         to='romeo@montague.net/orchard'
         id='neg1'>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='form'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/chatneg</value>
      </field>
      <field label='Accept this chat?'
             type='boolean' 
             var='accept'>
        <value>1</value>
      </field>
      <field label='Enable XHTML Formatting?'
             type='boolean' 
             var='http://jabber.org/protocol/xhtml-im'>
        <value>0</value>
      </field>
      <field label='Enable Chat State Notifications?'
             type='boolean' 
             var='http://jabber.org/protocol/chatstates'>
        <value>0</value>
      </field>
      <field label='Allow Message Logging?' 
             type='boolean' 
             var='logging'>
        <value>0</value>
      </field>
      <field label='Reason' 
             type='text-single' 
             var='reason'>
        <value>Can we talk?</value>
      </field>
    </x>
  </feature>
  <error code='503' type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</message>
  

If Juliet's client does not support one of the required features, it SHOULD return a <feature-not-implemented/> error (but MAY return no error if, for example, Juliet does not want to reveal her presence to Romeo for whatever reason):

Example 5. Contact returns feature not implemented error

<message type='error'
         from='juliet@capulet.com/balcony'
         to='romeo@montague.net/orchard'
         id='neg1'>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='form'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/chatneg</value>
      </field>
      <field label='Accept this chat?'
             type='boolean' 
             var='accept'>
        <value>1</value>
      </field>
      <field label='Enable XHTML Formatting?'
             type='boolean' 
             var='http://jabber.org/protocol/xhtml-im'>
        <value>0</value>
      </field>
      <field label='Enable Chat State Notifications?'
             type='boolean' 
             var='http://jabber.org/protocol/chatstates'>
        <value>0</value>
      </field>
      <field label='Allow Message Logging?' 
             type='boolean' 
             var='logging'>
        <value>0</value>
      </field>
      <field label='Reason' 
             type='text-single' 
             var='reason'>
        <value>Can we talk?</value>
      </field>
    </x>
  </feature>
  <error code='501' type='cancel'>
    <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</message>
  

If Juliet's client does not support one of the optional features (e.g., Chat State Notifications) but it accepts the request, it MUST set the value of that boolean variable to "0".

3. Implementation Notes

A client MAY require a human user to approve each chat session negotiation request or MAY auto-accept and auto-reject requests based on some user-configurable policy.

4. Security Considerations

If a contact accepts a user's request or returns an error to the user, the user will effectively discover the contact's presence (at least the presence of one of the contact's resources). Due care must be exercised in determining whether to accept the request or return an error (e.g., the contact's client must not automatically accept the user's request or return an error to the user if the user is in the contact's block list).

5. IANA Considerations

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

6. Jabber Registrar Considerations

6.1 Service Discovery Features

The Jabber Registrar [10] shall add 'http://jabber.org/protocol/chatneg' to its registry of Service Discovery features.

Registry Submission

<var>
  <name>http://jabber.org/protocol/chatneg</name>
  <desc>Support for Chat Session Negotiation and its FORM_TYPE</desc>
  <doc>JEP-0155</doc>
</var>
    

6.2 Field Standardization

Field Standardization for Data Forms [11] defines a process for standardizing the fields used within Data Forms qualified by a particular namespace. The following fields shall be registered for use in Chat Session Negotiation:

Registry Submission

<form_type>
  <name>http://jabber.org/protocol/chatneg</name>
  <doc>JEP-0155</doc>
  <desc>
    Forms enabling negotation of a one-to-one
    chat session between two entities.
  </desc>
  <field
      var='accept'
      type='boolean'
      label='Whether to accept the invitation'/>
  <field
      var='http://jabber.org/protocol/chatstates'
      type='boolean'
      label='Whether to enable Chat State Notifications per JEP-0085'/>
  <field
      var='http://jabber.org/protocol/chatstates'
      type='boolean'
      label='Whether to enable XHTML-IM formatting per JEP-0071'/>
  <field
      var='logging'
      type='boolean'
      label='Whether to allow client-side message logging'/>
  <field
      var='reason'
      type='text-single'
      label='A reason for chatting (or not)'/>
</form_type>
      

7. XML Schema

This proposal defines best practices for use of JEP-0020 and therefore does not require a separate schema.


Notes

1. JEP-0030: Service Discovery <http://www.jabber.org/jeps/jep-0030.html>.

2. JEP-0115: Entity Capabilities <http://www.jabber.org/jeps/jep-0115.html>.

3. RFC 3261: Session Initiation Protocol (SIP) <http://www.ietf.org/rfc/rfc3261.txt>.

4. In essence, a chat state negotiation request as specified herein is functionally equivalent to a SIP INVITE request, and acceptance of such a request is functionally equivalent to sending a SIP 200 OK response; see Section 17 of RFC 3261.

5. JEP-0020: Feature Negotiation <http://www.jabber.org/jeps/jep-0020.html>.

6. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://www.ietf.org/rfc/rfc3921.txt>.

7. JEP-0071: XHTML-IM <http://www.jabber.org/jeps/jep-0071.html>.

8. JEP-0085: Chat State Notifications <http://www.jabber.org/jeps/jep-0085.html>.

9. 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/>.

10. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.

11. JEP-0068: Field Data Standardization for Data Forms <http://www.jabber.org/jeps/jep-0068.html>.


Revision History

Version 0.2 (2005-07-15)

Further described contexts in which chat session negotiation could be useful; added more examples; added reference to SIP RFC and explained basic mapping to SIP INVITE method; added Jabber Registrar considerations. (psa)

Version 0.1 (2005-07-14)

Initial JEP version. (psa)

Version 0.0.1 (2005-07-12)

First draft. (psa)


END