%ents; ]>
Chat Session Negotiation This document specifies a feature negotiation profile for initiating a one-to-one chat session. &LEGALNOTICE; 0155 Experimental Standards Track Standards JIG Council XMPP Core XMPP IM XEP-0020 XEP-0068 chatneg &stpeter; &ianpaterson; 0.8 2006-10-02 ip

Added continue field and optional terminate acknowledgement; specified renegotiation failure proceedure; added context to Introduction; changed unavailable presence handling; renamed logging field to otr.

0.7 2006-07-14 psa

Added secure field from XEP-0116.

0.6 2006-07-13 psa

Specified that a client must re-initiate if it receives presence unavailable; changed document type to Standards Track.

0.5 2006-01-24 psa

Added renegotiate use case.

0.4 2006-01-03 psa

Added terminate use case; further specified mapping to SIP.

0.3 2005-12-30 psa

Further specified use of id attribute and thread element.

0.2 2005-07-15 psa

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 XMPP Registrar considerations.

0.1 2005-07-14 psa

Initial version.

0.0.1 2005-07-12 psa

First draft.

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 (e.g., see &xmppim;). This informal approach to initiation of a chat session is perfectly acceptable in many 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 &xep0020;.

In order to initiate a negotiated 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. The &MESSAGE; stanza MUST NOT contain a &BODY; child element (as specified in &rfc3921;). 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 SHOULD include an 'id' attribute and MUST contain a &THREAD; element for tracking purposes (where the newly-generated ThreadID is unique to the proposed session). The data form MUST contain a hidden FORM_TYPE field whose value is "http://jabber.org/protocol/chatneg" and MUST contain a boolean field named "accept". &BOOLEANNOTE;

The following is an example of a negotiation request:

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg true 0 0 1 1 Can we talk? ]]>

In the foregoing example, Romeo requests a chat with Juliet and also queries her regarding whether she wants to disable all message logging (see &xep0136;) A client MUST NOT set the 'otr' field to 'true' unless it has confirmed that its server will allow it to switch off Automated Archiving (see Message Archiving). and support &xep0071; and &xep0085; 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 XMPP Registrar Considerations section of this document.)

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

In any response to the request, the contact's client MUST mirror the 'id' attribute and &THREAD;value so that the user's client can correctly track the response.

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:

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg true 0 1 1 1 Sure, let's talk! ]]>

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

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 0 Sorry, can't chat now! How about tonight? ]]>

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 &unavailable; error. However, if Juliet does not want to reveal her presence to Romeo for whatever reason, or she is using a legacy client that does not support returning a &unavailable; error, then her client MAY return no error. In this case Romeo MAY, proceed to send stanzas to Juliet outside the context of a negotiated chat session.

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 1 0 0 1 1 Can we talk? ]]>

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

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 1 0 0 1 1 Can we talk? ]]>

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" or "false".

At any time during an existing chat session, either party MAY attempt to renegotiate the parameters of the session. The requesting party does this by sending a new &MESSAGE; stanza containing a feature negotiation form and a &THREAD; element with the same value as that of the existing chat session.

Note: The "accept" field SHOULD NOT be included in a renegotiation form. The set of other fields in the form MAY be different from the set included in the initial session negotitation.

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 1 1 1 1 Gotta have formatting! ]]> ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg true 1 1 1 Agreed, XHTML is fun. ]]>

If the other party's client does not support one of the required features, it SHOULD return a &feature; error instead. In that case the existing negotiated chat session parameters are maintained. Either party MAY then terminate the chat session as specified in the section Terminating a Chat.

Either party MAY use chat renegotiation to attempt to continue the session using another of its resources. The requesting party does this by sending a feature renegotiation form with a "continue" field containing the value of the new resource:

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg PDA I am leaving the orchard. ]]>

The requesting party SHOULD NOT send stanzas within the session from either resource until the other party has accepted or rejected (with a &feature; error) the switch to the new resource.

The other party SHOULD accept the switch since the requesting party might otherwise be unable to continue the session:

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg PDA OK, hurry to me. ]]>

Once the other party has accepted the switch then all stanzas sent within the chat session MUST be to or from the new resource. Note: Both parties MUST ensure that they comply with all the other chat session negotiation parameters that were previously agreed for this session.

In order to explicitly terminate a negotiated chat, the party that wishes to end the chat MUST do so by sending a &MESSAGE; containing a data form of type "submit". The &MESSAGE; stanza SHOULD possess an 'id' attribute and MUST contain a &THREAD; element with the same XML character data as the original initiation request. The data form containing a boolean field named "terminate" set to a value of "1" or "true" and MAY also contain a "reason" field.

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 1 Gotta go! ]]>

Both parties MUST then consider the chat session to be ended.

The other party's client MAY explicitly acknowledge the termination of the chat by sending a &MESSAGE; containing a data form of type "result", with no "reason" field and the value of the "terminate" field set to "1" or "true". The client MUST mirror the 'id' attribute and &THREAD; value it received.

ffd7076498744578d10edabfe7f4a866 http://jabber.org/protocol/chatneg 1 ]]>

When mapping instant messaging flows to SIP, implementations SHOULD adhere to &xmppsimple;.

In addition, the following mappings apply to chat session negotiation:

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.

If a party receives XMPP presence of type "unavailable" from the full JID (&FULLJID;) of the other party (i.e., the resource with which it has had an active session) during a chat session, the receiving party MAY assume that the other client will still be unable to continue the session (perhaps it simply became "invisible", or it is persisting the state of the negotiated chat until it reconnects and receives "offline" messages). However, if the receiving party assumes that the other client will not be able to continue the session, then it MUST explicitly terminate the session (see Terminating a Chat) - since its assumption could be incorrect. If the receiving party later receives presence of type "available" from that same resource or another resource associated with the other party and the receiving party desires to restart the chat session, it MUST initiate a new chat session (including a newly-generated ThreadID) with the other party rather than renegotiate parameters for the terminated session. (Note: This is consistent with the handling of chat states as specified in XEP-0085.)

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 therefore be exercised in determining whether to accept the request or return an error. For examples, the contact's client SHOULD NOT automatically (i.e. without first asking the contact) either accept the user's request or return an error to the user unless the user is subscribing to the contact's presence (and the contact's presence is not currently "invisible" to the user). Furthermore, the contact's client MUST NOT take either action if the user is in the contact's block list.

This document requires no interaction with &IANA;.

The ®ISTRAR; shall include 'http://jabber.org/protocol/chatneg' in its registry of Service Discovery features.

http://jabber.org/protocol/chatneg Support for Chat Session Negotiation and its FORM_TYPE XEP-0155 ]]>

&xep0068; 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:

http://jabber.org/protocol/chatneg XEP-0155 Forms enabling negotation of a one-to-one chat session between two entities. ]]>

This proposal re-uses the format defined in XEP-0020 and therefore does not require a separate schema.

Thanks to Thomas Charron and Jean-Louis Seguineau for their feedback.