xeps/xep-0155.xml

603 lines
36 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Chat Session Negotiation</title>
<abstract>This document specifies a feature negotiation profile for initiating a one-to-one chat session.</abstract>
&LEGALNOTICE;
<number>0155</number>
<status>Experimental</status>
<type>Standards Track</type>
<jig>Standards JIG</jig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XMPP IM</spec>
<spec>XEP-0020</spec>
<spec>XEP-0068</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>chatneg</shortname>
&ianpaterson;
&stpeter;
<revision>
<version>0.11</version>
<date>2006-11-03</date>
<initials>ip</initials>
<remark><p>Removed reason field; added new implementation notes; many clarifications including the handling of required fields</p></remark>
</revision>
<revision>
<version>0.10</version>
<date>2006-10-31</date>
<initials>ip</initials>
<remark><p>Defined handling of offline requests; specified localization of the title element and all labels; changed syntax of list of unacceptable fields; removed reason field from some examples; added confirmation message to initial negotiation; clarified the initial participating resources; removed id attributes.</p></remark>
</revision>
<revision>
<version>0.9</version>
<date>2006-10-08</date>
<initials>ip</initials>
<remark><p>Added language field; replaced secure field with security field; changed type of otr, XHTML and Chat State fields from boolean to list-single; added not-acceptable error; several clarifications.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2006-10-02</date>
<initials>ip</initials>
<remark><p>Added continue field and optional terminate acknowledgement; specified renegotiation failure proceedure; added context to Introduction; changed unavailable presence handling; renamed logging field to otr.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2006-07-14</date>
<initials>psa</initials>
<remark><p>Added secure field from XEP-0116.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2006-07-13</date>
<initials>psa</initials>
<remark><p>Specified that a client must re-initiate if it receives presence unavailable; changed document type to Standards Track.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2006-01-24</date>
<initials>psa</initials>
<remark><p>Added renegotiate use case.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2006-01-03</date>
<initials>psa</initials>
<remark><p>Added terminate use case; further specified mapping to SIP.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2005-12-30</date>
<initials>psa</initials>
<remark><p>Further specified use of id attribute and thread element.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2005-07-15</date>
<initials>psa</initials>
<remark><p>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.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2005-07-14</date>
<initials>psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2005-07-12</date>
<initials>psa</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>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:</p>
<ul>
<li>Whenever parameters specific to a chat session must be agreed. e.g., security and privacy parameters (see &xep0116; and &xep0136;).</li>
<li>The parties are unknown to each other, have not exchanged presence, or have not discovered their respective capabilities via &xep0030; or &xep0115;.</li>
<li>When an XMPP-based system interfaces with a SIP-based system built on top of &rfc3261;. <note>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 <cite>RFC 3261</cite>.</note></li>
<li>Within an organization or culture in which one would not simply begin chatting with another person (e.g., a superior) without first receiving permission to do so.</li>
</ul>
<p>This proposal defines best practices for such a negotiation, re-using the protocol defined in &xep0020;.</p>
</section1>
<section1 topic='Negotiating a New Chat Session' anchor='new'>
<section2 topic='Initiating a Chat' anchor='new-initiate'>
<p>In order to initiate a negotiated chat session, the initiating party ("user") sends a &MESSAGE; <note>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).</note> stanza to the receiving party ("contact") containing a &lt;feature/&gt; 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 type SHOULD be "normal" (either explicitly or by non-inclusion of the 'type' attribute). The stanza 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 inclusion of "otr" and "security" fields is also RECOMMENDED. Note: The options within any 'list-single' fields SHOULD appear in order of preference.</p>
<p>Note: Chat sessions may be conducted between entities who are never online at the same time. However, if the user is interested only in an <em>immediate</em> chat session then the user SHOULD instruct the contact's server not to store the message for later delivery using the &xep0079; protocol.</p>
<p>In the following example of a negotiation request, Romeo requests a chat with Juliet and also queries her regarding whether she wants to enable all message logging (see &xep0136;) <note>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 <cite>Message Archiving</cite>).</note> and support the &xep0071; and &xep0085; extensions during this chat session. He also requires that they are both connected securely to their servers, and asks which language she prefers amoungst those he can write. (Note: These fields are examples only; a full set of chat session negotiation parameters will be registered as described in the <link url='#registrar'>XMPP Registrar Considerations</link> section of this document.)</p>
<example caption="User requests chat session"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com'>
<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>http://jabber.org/protocol/chatneg</value>
</field>
<field label='Accept this chat?' type='boolean' var='accept'>
<value>true</value>
<required/>
</field>
<field label='Off-The-Record?' type='list-single' var='otr'>
<value>false</value>
<option label='Allow message logging'>
<value>false</value>
</option>
<option label='Disable all message logging'>
<value>true</value>
</option>
<required/>
</field>
<field label='XHTML Formatting?'
type='list-single'
var='http://jabber.org/protocol/xhtml-im'>
<value>true</value>
<option label='Disable'><value>false</value></option>
<option label='Enable'><value>true</value></option>
</field>
<field label='Chat State Notifications?'
type='list-single'
var='http://jabber.org/protocol/chatstates'>
<value>true</value>
<option label='Disable'><value>false</value></option>
<option label='Enable'><value>true</value></option>
</field>
<field label='Minimum security level'
type='list-single'
var='security'>
<value>c2s</value>
<option label='Both parties must be securely connected to their servers'>
<value>c2s</value>
</option>
<required/>
</field>
<field label='Primary written language of the chat'
type='list-single'
var='language'>
<value>en</value>
<option label='English'><value>en</value></option>
<option label='Italiano'><value>it</value></option>
</field>
</x>
</feature>
<amp xmlns='http://jabber.org/protocol/amp'>
<rule action='drop' condition='deliver' value='stored'/>
</amp>
</message>
]]></example>
<p>The user MAY request a session with a specific resource of the contact. However, if the user specifies no resource (or if the specified resource is not available), then the contact's server delivers the request to the contact's most available resource (which in the examples below happens to be "balcony"). If no resource is available (and no <cite>Advanced Message Processing</cite> rule included in the request specifies otherwise) then the server MAY store the request for later delivery.</p>
</section2>
<section2 topic='Accepting a Chat' anchor='new-accept'>
<p>If, upon reception of a user's chat session request, a contact finds that the request had been stored for later delivery, and if the contact is interested only in an <em>immediate</em> chat session, then it SHOULD initiate a new chat session negotiation (including a newly-generated ThreadID) instead of responding to the user's request. Note: Sending any response to the user's original request would leak presence information since it would divulge the fact that the contact had been offline rather than just ignoring the user.</p>
<p>In any response to the user's request, the contact's client MUST mirror the &THREAD; value so that the user's client can correctly track the response.</p>
<p>If the request is accepted then the client MUST include in its response values for all the fields that the request indicated are required. If the contact's client does not support one of the default values or if the contact has disabled its support (as for Chat State Notifications and XHTML formatting in the example below), and the client can still accept the request, then it MUST set that field to a value that it can support.</p>
<p>In the example below we assume that Juliet accepts the chat and specifies that she prefers to speak Italian with Romeo:</p>
<example caption="Contact accepts chat and specifies parameters"><![CDATA[
<message type='normal'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>true</value></field>
<field var='otr'><value>false</value></field>
<field var='http://jabber.org/protocol/xhtml-im'>
<value>false</value>
</field>
<field var='http://jabber.org/protocol/chatstates'>
<value>false</value>
</field>
<field var='security'><value>c2s</value></field>
<field var='language'><value>it</value></field>
</x>
</feature>
</message>
]]></example>
<p>Note: Both entities MUST assume the session is being established with the resource of the contact that sends the reply, even if the user sent its request to a different resource of the contact.</p>
</section2>
<section2 topic='Rejecting a Chat' anchor='new-reject'>
<p>If the contact does not want to reveal presence to the user for whatever reason then the contact's client SHOULD return no response or error (see <link url='#secure-leak'>Presence Leaks</link>). Also, if the contact is using a legacy client then it MAY not support returning any response or error. In both these cases the user MAY, proceed to send stanzas to the contact outside the context of a negotiated chat session.</p>
<p>However, if the contact simply prefers not to chat then the client SHOULD decline the invitation. The data form MUST contain the FORM_TYPE field and the "accept" field set to "0" or "false". It is RECOMMENDED that the form does not contain any other fields even if the request indicated they are required. The client MAY include a reason in the &BODY; child of the &MESSAGE; stanza:</p>
<example caption="Contact declines offer and specifies reason"><![CDATA[
<message type='normal'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>0</value></field>
</x>
</feature>
<body>Sorry, can't chat now! How about tonight?</body>
</message>
]]></example>
<p>If the contact'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:</p>
<example caption="Contact returns service unavailable error"><![CDATA[
<message type='error'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<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>
...
</x>
</feature>
<error code='503' type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
]]></example>
<p>If the contact's client does not support one or more of the <em>required</em> features, it SHOULD return a &feature; error, specifying the field(s) not implemented using the 'var' attribute of one or more &lt;field/&gt; child elements of a &lt;feature/&gt; child element of the &lt;error/&gt; scoped by the 'http://jabber.org/protocol/feature-neg' namespace:</p>
<example caption="Contact returns feature not implemented error"><![CDATA[
<message type='error'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<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>
...
</x>
</feature>
<error code='501' type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<field var='otr'/>
</feature>
</error>
</message>
]]></example>
<p>If the contact's client supports <em>none</em> of the options for one or more fields, it SHOULD return a &notacceptable; error, specifying the field(s) with unsupported options using the 'var' attribute of one or more &lt;field/&gt; child elements of a &lt;feature/&gt; child element of the &lt;error/&gt; scoped by the 'http://jabber.org/protocol/feature-neg' namespace:</p>
<example caption="Contact returns options not acceptable error"><![CDATA[
<message type='error'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<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>
...
</x>
</feature>
<error code='406' type='modify'>
<not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<field var='security'/>
</feature>
</error>
</message>
]]></example>
</section2>
<section2 topic='Completing or Canceling the Negotitation' anchor='new-complete'>
<p>If the contact accepted the chat (see <link url='#new-accept'>Accepting a Chat</link>) then the user MUST either complete or cancel the session negotitation. If the contact chose an option other than the default (prefered) value for one or more of the fields, then instead of having the client accept the session automatically the user may prefer to review the values that the contact selected before confirming that the session is open. <note>See <cite>Encrypted Sessions</cite> for examples of other instances where the user might find the values submitted by the contact unacceptable.</note> In any case the user's client SHOULD verify that the selected values are acceptable before completing the session negotitation - and confirming that the chat session is open - by replying with a form with the form 'type' attribute set to 'result'. The form MUST contain the FORM_TYPE field and the "accept" field set to "1" or "true". It MAY contain the other fields received from the contact. The user MAY include other content (e.g., a &BODY; element) in the confirmation stanza:</p>
<example caption="User completes negotitation and confirms session is open"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>true</value></field>
<field var='otr'><value>false</value></field>
<field var='http://jabber.org/protocol/xhtml-im'>
<value>false</value>
</field>
<field var='http://jabber.org/protocol/chatstates'>
<value>false</value>
</field>
<field var='security'><value>c2s</value></field>
<field var='language'><value>it</value></field>
</x>
</feature>
<body>I forgot what I wanted to say!</body>
</message>
]]></example>
<p>Alternatively, if the user decides to cancel the session negotitation then the client MUST reply with a data form containing the FORM_TYPE field and the "accept" field set to "0" or "false":</p>
<example caption="User cancels session negotitation"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>0</value></field>
</x>
</feature>
</message>
]]></example>
</section2>
</section1>
<section1 topic='Other Use Cases' anchor='usecases'>
<section2 topic='Switching Resources' anchor='switch'>
<p>Either party MAY ask to continue the session using another of its resources. The requesting party does this by submitting a form with a "continue" field containing the value of the new resource:</p>
<example caption="One party asks to switch session to another of its resources"><![CDATA[
<message type='normal'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='continue'><value>PDA</value></field>
</x>
</feature>
</message>
]]></example>
<p>The requesting party SHOULD NOT send stanzas within the session from either resource until the other party has accepted the switch to the new resource.</p>
<p>The other client SHOULD accept the switch automatically since the requesting party might otherwise be unable to continue the session:</p>
<example caption="Other client accepts switch"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='continue'><value>PDA</value></field>
</x>
</feature>
</message>
]]></example>
<p>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.</p>
</section2>
<section2 topic='Renegotiating a Chat' anchor='renegotiate'>
<p>At any time during an existing chat session, either party MAY attempt to renegotiate the parameters of the session using the protocol described in <link url='#new'>Negotiating a New Chat Session</link>. The requesting party does this by sending a new &MESSAGE; stanza containing a feature negotiation form and a &THREAD; element with the <em>same</em> value as that of the existing chat session. Note: Although the "accept" field MUST be included in a renegotiation form, the other fields MAY be different from the set of fields included in the initial session negotitation form.</p>
<example caption="One party requests renegotiation"><![CDATA[
<message type='normal'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<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 change?' type='boolean' var='accept'>
<value>true</value>
<required/>
</field>
<field label='Off-The-Record?' type='list-single' var='otr'>
<value>true</value>
<option label='Disable all message logging'>
<value>true</value>
</option>
<required/>
</field>
</x>
</feature>
</message>
]]></example>
<p>The requesting party MAY continue to send stanzas within the session while it is waiting for the other party to either accept or reject the renegotiation.</p>
<example caption="Other party accepts renegotiation and specifies parameters"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>1</value></field>
<field var='otr'><value>true</value></field>
</x>
</feature>
</message>
]]></example>
<p>Note: Both parties MUST consider the renegotiation to be complete as soon as the acceptance message has been sent (or received). The requesting party SHOULD NOT send a renegotiation completion or cancelation message (see <link url='#new-complete'>Completing or Canceling the Negotitation</link>).</p>
<p>Note: Both parties MUST ensure that they comply with all the chat session negotiation parameters that were not renegotiated but had previously been agreed for this session.</p>
<p>If the other party's client does not support one or more of the <em>required</em> features, it SHOULD return a &feature; error instead, while if it supports <em>none</em> of the options for one or more fields, it SHOULD return a &notacceptable; error instead (see <link url='#new-reject'>Rejecting a Chat</link>). However, if the other party simply prefers to maintain the existing negotiated parameters then it SHOULD decline the renegotiation as in the example below. Note: In any of these cases the existing negotiated chat session parameters are maintained. Either party MAY choose to terminate the chat session only as specified in the section <link url='#terminate'>Terminating a Chat</link>.</p>
<example caption="Other party declines renegotiation"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='accept'><value>0</value></field>
</x>
</feature>
</message>
]]></example>
</section2>
<section2 topic='Terminating a Chat' anchor='terminate'>
<p>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 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".</p>
<example caption="One party terminates chat"><![CDATA[
<message type='normal'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/orchard'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='terminate'><value>1</value></field>
</x>
</feature>
</message>
]]></example>
<p>Both parties MUST then consider the chat session to be ended.</p>
<p>The other party's client MAY explicitly acknowledge the termination of the chat by sending a &MESSAGE; containing a data form of type "result", and the value of the "terminate" field set to "1" or "true". The client MUST mirror the &THREAD; value it received.</p>
<example caption="Other party acknowledges chat termination"><![CDATA[
<message type='normal'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'>
<thread>ffd7076498744578d10edabfe7f4a866</thread>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/chatneg</value>
</field>
<field var='terminate'><value>1</value></field>
</x>
</feature>
</message>
]]></example>
</section2>
</section1>
<section1 topic='Mapping to SIP' anchor='sip'>
<p>When mapping instant messaging flows to SIP, implementations SHOULD adhere to &xmppsimple;.</p>
<p>In addition, the following mappings apply to chat session negotiation:</p>
<ul>
<li>Initiation of a negotiated chat session maps to the semantics of the SIP INVITE method.</li>
<li>Renegotiation of a negotiated chat session also maps to the semantics of the SIP INVITE method.</li>
<li>Termination of a negotiated chat session maps to the semantics of the SIP BYE method.</li>
<li>The XMPP &THREAD; value maps to the semantics of the SIP Call-ID attribute.</li>
</ul>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<section2 topic='Auto Accept or Reject' anchor='impl-auto'>
<p>A client MAY require a human user to approve each chat session negotiation request, however it is RECOMMENDED that it accepts or rejects automatically as many requests as possible, based on a set of user-configurable policies (see <link url='#secure-leak'>Presence Leaks</link>).</p>
</section2>
<section2 topic='Persisting Sessions' anchor='impl-close'>
<p>Chat session negotiation sometimes requires the involvement of either or both human users, and if human input is required but the user is away then session establishment may be delayed indefinitely. So, in order to minimise the number of user interruptions and delays, clients SHOULD reuse existing chat sessions whenever possible. For example, a client SHOULD NOT terminate chat sessions unless the user is going offline, even if its user closes a chat window.</p>
</section2>
<section2 topic='Unavailable Presence' anchor='impl-unavail'>
<p>If a party receives an XMPP presence stanza 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 SHOULD assume that the other client will still be able 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).</p>
<p>However, the receiving party MAY assume that the other client will <em>not</em> be able to continue the session. <note>In general, if a party is not subscribing to the other party's presence then it will never assume the other party is is unable to continue a session.</note> In that case it MUST explicitly terminate the session (see <link url='#terminate'>Terminating a Chat</link>) - since its assumption could be incorrect. If after terminating the session 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, then it MUST initiate a new chat session (including a newly-generated ThreadID) with the other party. It MUST NOT renegotiate parameters for the terminated session. (Note: This is consistent with the handling of chat states as specified in <cite>XEP-0085</cite>.)</p>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<section2 topic='Presence Leaks' anchor='secure-leak'>
<p>If a contact accepts a user's chat session negotiation request or returns an error to the user, the user will effectively discover the presence of the contact's resource. 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 <em>automatically</em> (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). Note: There should be no need for the contact's client to consult the contact's block list, since if the user is on the list then the contact would not receive any request messages from the user anyway.</p>
</section2>
<section2 topic='Localization' anchor='secure-local'>
<p>If a client is configured to show a request &lt;form/&gt; to a human user instead of responding automatically, the client SHOULD replace the content of the &lt;title/&gt; element and of all label attributes of the &lt;field/&gt; and &lt;option/&gt; elements with it's own localised versions before showing the form to the client - even if the form already appears to be in the correct language. Note: If a client fails to localize the form then a malicious contact might, for examples, either switch the labels on the 'security' and 'otr' fields, or use the &lt;title/&gt; to mislead the user regarding the identity of the contact.</p>
</section2>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Service Discovery Features' anchor='registrar-features'>
<p>The &REGISTRAR; shall include 'http://jabber.org/protocol/chatneg' in its registry of Service Discovery features.</p>
<code caption='Registry Submission'><![CDATA[
<var>
<name>http://jabber.org/protocol/chatneg</name>
<desc>Support for Chat Session Negotiation and its FORM_TYPE</desc>
<doc>XEP-0155</doc>
</var>
]]></code>
</section2>
<section2 topic='Field Standardization' anchor='registrar-formtype'>
<p>&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:</p>
<code caption='Registry Submission'><![CDATA[
<form_type>
<name>http://jabber.org/protocol/chatneg</name>
<doc>XEP-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='continue'
type='text-single'
label='Another resource with which to continue the session'/>
<field
var='http://jabber.org/protocol/chatstates'
type='list-single'
label='Whether to enable Chat State Notifications per XEP-0085'>
<option label='Disable'>
<value>false</value>
</option>
<option label='Enable'>
<value>true</value>
</option>
</field>
<field
var='http://jabber.org/protocol/xhtml-im'
type='list-single'
label='Whether to enable XHTML-IM formatting per XEP-0071'/>
<option label='Disable'>
<value>false</value>
</option>
<option label='Enable'>
<value>true</value>
</option>
</field>
<field
var='language'
type='list-single'
label='Primary written language of the chat (each value appears in order of preference and conforms to RFC 4646 and the IANA registry)'/>
<field
var='otr'
type='list-single'
label='Off-The-Record'>
<option label='Allow message logging'>
<value>false</value>
</option>
<option label='Disable absolutely all message logging including automatic archiving - see XEP-0136'>
<value>true</value>
</option>
</field>
<field
var='security'
type='list-single'
label='Minimum security level'>
<option label='Secure connections not required'>
<value>none</value>
</option>
<option label='Both parties must be securely connected to their servers'>
<value>c2s</value>
</option>
<option label='Both parties must be securely connected to each other'>
<value>e2e</value>
</option>
</field>
<field
var='terminate'
type='boolean'
label='Whether to terminate the session'/>
</form_type>
]]></code>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>This proposal re-uses the format defined in XEP-0020 and therefore does not require a separate schema.</p>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Thomas Charron and Jean-Louis Seguineau for their feedback.</p>
</section1>
</xep>