\documentclass[11pt]{article}
\usepackage{times}
\usepackage{graphics,html}
\usepackage{ifthen}
\usepackage{i-d}
%\usepackage{rfc}
\usepackage{html}
\usepackage{txtpsfig}
\usepackage{tight}
\usepackage[dvips]{changebar}
\usepackage{multibib}
\newcites{norm,inform}{Normative References,Informative References}

\title{is-composing Indication for Instant Messaging Using the Session
Initiation Protocol (SIP)}
\author{H. Schulzrinne}
\shorttitle{is-composing}
\filename{draft-schulzrinne-simple-iscomposing-01}
\wg{}
\expires{August 2003}
\address{Columbia U.}
\pubdate{\today}
\input{../defs}

\begin{document}
\maketitle
\begin{abstract}
In instant messaging systems, it is useful to know that the other party
is composing a message, e.g., typing. This document defines a new
content type and XML namespace that conveys information about a message
being composed. The message could be of any type, including text, voice
or video.
\end{abstract}

\tableofcontents

\section{Introduction}
\label{sec:intro}

By definition, instant messaging is message-based, i.e., a user composes
a message by typing, speaking or recording a video clip.  This message
is then sent.  Unlike email, instant messaging is often conversational,
so that the other party is waiting for a response.  If no response is
forthcoming, an IM participant side may erroneously assume that either
the communication partner has left or that it is her turn to type again,
leading to messaging ``crossing on the wire''. A number of commercial
instant messaging systems feature an ``is typing'' indication that is
set as soon as one party starts typing a message. In this document, we
describe a generalized version of this indication. It applies to the
composition of any media type, not just text. For example, it might be
used if somebody is recording an audio or video clip.

This indication can be considered somewhat analogous to the comfort
noise packets that are transmitted in silence-suppressed interactive
voice conversations.

The mechanism described here aims to satisfy the requirements in
\citeinform{draft-rosenberg-simple-messaging-requirements}.

\section{Terminology and Conventions}
\label{sec:terminology}

This memo makes use of the vocabulary defined in the IMPP Model document
\citenorm{rfc2778}.  Terms such as CLOSED, INSTANT MESSAGE, OPEN,
PRESENCE SERVICE, PRESENTITY, WATCHER, and WATCHER USER AGENT in the
memo are used in the same meaning as defined therein.  The key words
{\MUST}, {\MUST NOT}, {\REQUIRED}, {\SHOULD}, {\SHOULD NOT},
{\RECOMMENDED}, {\MAY}, and {\OPTIONAL} in this document are to be
interpreted as described in BCP XX, RFC 2119 \citenorm{rfc2119}.

\section{Description}
\label{sec:description}

There are two modes of operation, a keep-alive and two-state mode.  In
keep-alive mode, an IM terminal where the user is actively composing a
message sends an update every few seconds if there has been activity
such as typing.  The messages cease if there is no sign of activity
during the last interval.  This mode has the advantage that the rate of
is-composing indications is constant, but it adds unnecessary overhead
for the common case that a message is composed in one uninterrupted
activity. The keep-alive mode would be useful if the is-composing
indication can convey additional information, such as the amount of
content that has been produced. Such fine-grained information seems of
little practical use, however.

We choose a two-state mode with the states Idle and Active.  When the
user first starts composing, the state becomes Active and an ``active''
is-composing message is sent.  As long as the user produces message
content, the user remains in state Active.  The user {\MAY} specify a
time-out interval measured in seconds, using the \xmlelement{timeout}
element, after which the is-composing message is resent to refresh the
state.  The refresh period {\SHOULD} be no shorter than 60 seconds. If
the element is omitted, the receiver should assume that no refresh
messages will be sent. Receivers {\MUST} be able to handle multiple
is-composing messages with ``active'' state regardless of the refresh
interval.

\motivation{The refresh mechanism deals with the case that the user logs
off or the application crashes before the message is completed.}

If the user stops composing for more than a configured time interval,
the idle interval, the state transitions to Idle and an ``idle'' message
is sent.  When the user starts composing again while in Idle state, the
state transitions to Active, with the corresponding message.

If a message is sent before the idle threshold expires, no idle state
indication is needed.  Thus, in most cases, only one message is needed. 
The message rate is limited to one message per idle threshold interval.

The \xmlelement{contenttype} element indicates what type of media the IM
terminal is currently composing.  It can contain either just a MIME
media type, such as ``audio'' or ``text'', or a media type and subtype,
such as ``text/html''.

The idle threshold {\SHOULD} be ten seconds.

The XML schema can be extended in the future.

\motivation{We chose XML since this also makes it possible to
easily turn this into event notification. This is likely only useful for
third-party notifications, i.e., notifying event recipients other than
the recipient of the {\MESSAGE}.}

\motivation{Events were also considered, but have a number of
disadvantages.  They add more overhead, since an explicit and periodic
subscription is required.  For page-mode delivery, subscribing to the
right user agent and set of messages may not be easy.  An in-band,
message-based mechanism is also easier to gateway into non-SIP systems.}

The is-composing indicator {\MAY} be carried in CPIM message
\citenorm{draft-ietf-impp-cpim-msgfmt}. 

\motivation{Such a wrapper is particularly useful if messages are
relayed by a conference server since the CPIM message maintains the
identity of the original composer.}

\section{Using the Indicator}
\label{sec:using}

The is-composing indicator can be used with either SIP page mode or
session mode, although it is a more natural fit with session mode.  In
session mode, the indicator is sent as part of the messaging stream. 
Its usage is negotiated just like support for any other media type in a
stream is negotiated, i.e., through SDP.  Sending the indicators within
the messaging stream has many benefits.  First, it ensures proper
sequencing and synchronization with the actual messages being composed. 
Secondly, end-to-end security can be applied to the messages.  Thirdly,
SDP negotiation mechanisms can be used to turn it on and off at any
time, and even negotiate its use in a single direction at a time.

Usage with the page mode is also straightforward. The indicator would be
carried as the body of a page mode message. Unfortunately, there is no
way to negotiate its usage, turn it on or off, or even be sure that the
indicator gets delivered before the actual content being composed. 

\section{Example}
\label{sec:example}

\begin{verbatim}
<?xml version="1.0" encoding="UTF-8"?>
  <isComposing xmlns="urn:ietf:params:xml:ns:sip-iscomposing"
    <state>active</active>
    <contenttype>text/plain</contenttype>
    <timeout>90</timeout>
    <lastactivity>2003-01-27T10:43:00Z</lastactivity>
  </isComposing>
\end{verbatim}

\begin{verbatim}
<?xml version="1.0" encoding="UTF-8"?>
  <isComposing xmlns="urn:ietf:params:xml:ns:sip-iscomposing"
    <state>idle</active>
    <contenttype>audio</contenttype>
    <lastactivity>2003-01-27T10:43:00Z</lastactivity>
  </isComposing>
\end{verbatim}

\section{XML Schema Definitions}
\label{sec:schema}

\begin{verbatim}
  <?xml version="1.0" encoding="UTF-8"?>
  <xs:schema targetNamespace="urn:ietf:params:xml:ns:sip-iscomposing"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:tns="urn:ietf:params:xml:ns:sip-iscomposing"
     elementFormDefault="qualified"
     attributeFormDefault="unqualified">

     <!-- This import brings in the XML language attribute xml:lang-->
     <xs:import namespace="http://www.w3.org/XML/1998/namespace"
     schemaLocation="http://www.w3.org/2001/xml.xsd"/>

    <xs:element name="isComposing">
      <xs:sequence>
        <xs:element name="status" type="tns:status"
          minOccurs="1"/>
        <xs:element name="lastactive" type="xs:dateTime"
          minOccurs="0"/>
        <xs:element name="contenttype" type="xs:string" minOccurs="0"
          maxOccurs="1"/>
        <xs:element name="timeout" type="xs:positiveInteger" minOccurs="0"
          maxOccurs="1"/>
        <xs:any namespace="##other" processContents="lax" minOccurs="0"
          maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:element>

    <xs:simpleType name="status">
      <xs:restriction base="xs:string">
        <xs:enumeration value="active"/>
        <xs:enumeration value="idle"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:schema>
\end{verbatim}

\section{Security Considerations}
\label{sec:security}

The is-composing indication provides a fine-grained view of the activity
of the entity composing and thus deserves particularly careful
confidentiality protection so that only the intended destination of the
message will receive the is-composing indication.

\section{IANA Considerations}
\label{sec:iana}

\subsection{Content-Type Registration for
'application/sip-iscomposing+xml'}

\begin{description}
\item[To:] ietf-types@iana.org
\item[Subject:] Registration of MIME media type application/sip-iscomposing+xml
\item[MIME media type name:]  application
\item[MIME subtype name:]  sip-iscomposing+xml
\item[Required parameters:]   (none)
\item[Optional parameters:]   charset; 
Indicates the character encoding of enclosed XML.  Default is
UTF-8.
        
\item[Encoding considerations:] Uses XML, which can employ 8-bit
characters, depending on the character encoding used.  See RFC 3023 [RFC
3023], section 3.2.
   
\item[Security considerations:] This content type is designed to carry
information about current user activity, which may be considered private
information.  Appropriate precautions should be adopted to limit
disclosure of this information.

\item[Interoperability considerations:] This content type provides a
common format for exchange of composition activity information.

\item[Published specification:] RFCXXXX (this document)

\item[Applications which use this media type:]
Instant messaging systems.
   
\item[Additional information:] none

\item[Person \& email address to contact for further information:]
Henning Schulzrinne\\
E-mail: \textsf{hgs@cs.columbia.edu}

\item[Intended usage:] LIMITED USE

\item[Author/Change controller:] This specification is a work item of
the IETF SIMPLE working group, with mailing list address
\xmlelement{simple@ietf.org}.

\item[Other information:] This media type is a specialization of
application/xml [RFC 3023], and many of the considerations described
there also apply to application/sip-iscomposing+xml.

\end{description}
      
\subsection{URN Sub-Namespace Registration for
'urn:ietf:params:xml:ns:sip-iscomposing'}

\begin{description}
\item[URI:] urn:ietf:params:xml:ns:sip-iscomposing

\item[Description:] This is the XML namespace for XML elements defined
by RFCXXXX to describe composition activity by SIP-based instant message
client using the 
\begin{flushleft}
\verb|application/sip-iscomposing+xml| 
\end{flushleft}
content type.

\item[Registrant Contact:] 
IETF, SIMPLE working group, \xmlelement{simple@ietf.org},\\
Henning Schulzrinne, \xmlelement{hgs@cs.columbia.edu}

\item[XML:] 
\begin{verbatim}
 BEGIN
   <?xml version="1.0"?>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
   "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml
   <head>
        <meta http-equiv="content-type"
        content="text/html;charset=iso-8859-1"/>
        <title>Is-composing Indication for Instant Messaging Using the
        Session Initiation Protocol (SIP)</title>
   </head>
   <body>
       <h1>Namespace for SIMPLE iscomposing extension</h1>
       <h2>application/sip-iscomposing+xml</h2>
       <p>See <a href="[[[URL of published RFC]]]">RFCXXXX</a>.</p>
    </body>
    </html>
   END
\end{verbatim}

\end{description}

\section{Acknowledgements}
\label{sec:ack}

Ben Campbell, Jonathan Rosenberg and Xiaotao Wu provided helpful comments.

\section{References}
\label{sec:references}

\bibliographystylenorm{ieeetr_url}
\bibliographynorm{string,rfc,i-d}
\bibliographystyleinform{ieeetr_url}
\bibliographyinform{string,rfc,i-d}

\section{Authors' and Editor's Addresses}
\label{sec:authors}

\begin{flushleft}
Henning Schulzrinne\\
Dept. of Computer Science\\
Columbia University\\
1214 Amsterdam Avenue\\
New York, NY 10027\\
USA\\
Email: \textsf{schulzrinne@cs.columbia.edu}
\end{flushleft}

\copyrightnotice
\end{document}
