<?xml version="1.0" encoding="US-ASCII"?>
<!-- New document created at Fri May 12 13:24:15 BST 2006 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes" strict="yes"?>
<rfc 
 category="info"
 ipr="pre5378Trust200902"
 obsoletes=""
 updates=""
 xml:lang="en">
  <front>
    <title abbrev="Streaming Internet Messaging Attachments">Streaming Internet
    Messaging Attachments</title>

    <author fullname="Neil L Cook" initials="N.L." surname="Cook">
      <organization abbrev="Cloudmark">Cloudmark</organization>

      <address>
        <email>neil.cook@noware.co.uk</email>
      </address>
    </author>

    <date month="May" year="2009" />

    <area>Applications</area>

    <workgroup>Lemonade</workgroup>

    <abstract>
      <t>This document describes a method for streaming multimedia attachments
      received by a resource constrained and/or mobile device from an IMAP
      server. It allows such clients, which often have limits in storage space
      and bandwidth, to play video and audio e-mail content.</t>

      <t>The document describes a profile for making use of the
      URLAUTH authorized IMAP URLs (RFC 5092), the Network
      Announcement SIP Media Service (RFC 4240), and the Media Server
      Control Markup Language (RFC 5022).</t>
    </abstract>

  </front>

  <middle>
    <section anchor="intro" title="Introduction" toc="default">
      <t>Email clients on resource and/or network constrained devices, such as
      mobile phones, may have difficulties in retrieving and/or storing large
      attachments received in a message. For example, on a poor network link,
      the latency required to download the entire attachment before
      displaying any of it may not be acceptable to the
      user. Conversely, even on a high-speed network, the device may
      not have enough storage space to secure the attachment once
      retrieved.</t>

      <t>For certain media, such as audio and video, there is a solution: the
      media can be streamed to the device, using protocols such as <xref target="RTP">
      RTP</xref>. Streaming can be initiated and controlled using protocols such as
      <xref target="SIP">SIP</xref> and particularly the media server profiles as
      specified in <xref target="NETANN">RFC 4240</xref> or <xref
      target="MSCML"> MSCML</xref>. Streaming the media to the device
      addresses both the latency issue, since the client can start playing the
      media relatively quickly, and the storage issue, since the client does not need
      to store the media locally. A tradeoff is that the media cannot be
      viewed/played when the device is offline.</t>

      <t>Examples of the types of media that would benefit from the ability to
      stream such media to the device include: <list style="symbols">
          <t>Voice or Video mail messages received as an attachment</t>

          <t>Audio clips such as ring tones received as an attachment</t>

          <t>Video clips, such as movie trailers, received as an
          attachment</t>
        </list></t>

      <t>The client may wish to present the user with the ability to use
      simple "VCR"-style controls such as pause, fast-forward and rewind. In
      consideration of this, the document presents two alternatives for
      streaming media - a simple mechanism which makes use of the announcement
      service of RFC 4240, and a more complex mechanism which allows VCR
      controls, based on <xref target="MSCML">MSCML (RFC 5022)</xref>. The
      choice of which mechanism to use is up to the client, for
      example it may be
      based on limitations of the client or the configured media server. This
      document presents suggestions for determining which of these
      streaming services are available.</t>
    </section>

    <section title="Conventions Used in this Document">
      <t>
	The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
	NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and
	"OPTIONAL" in this document are to be interpreted as described in
      <xref target="KEYWORDS">RFC 2119</xref>.
      </t>

      <t>
	In examples, "C:" and "S:" indicate lines sent by the client and
	server respectively. If a single "C:" or "S:" label applies to multiple
	lines, then some of the line breaks between those lines are for editorial
      clarity only and may not be part of the actual protocol exchange.</t>
    </section>

    <section anchor="mechanism" title="Mechanism" toc="default">
      <section anchor="overview" title="Overview of Mechanism" toc="default">
        <t>The proposed mechanism for streaming media to messaging clients is
        a profile for making use of several existing mechanisms,
	namely: 
	<list style="numbers">
            <t>IMAP URLAUTH Extension <xref target="URLAUTH">URLAUTH</xref>
	    - Providing the ability to generate an IMAP URL that
	    allows access by external entities to 
            specific message parts, e.g. an audio clip.</t>

            <t>URLFETCH Binary Extension <xref target="URLFETCH_BINARY"></xref> 
	    - Providing the ability to specify BINARY and 
            BODYPARTSTRUCTURE arguments to the URLFETCH command. </t>

            <t>Media Server Announcement Service <xref target="NETANN">(RFC
            4240)</xref> - Providing the ability for a media server to stream
            media using a reference provided by the media server client in a
            URL.</t>

            <t>Media Server Interactive Voice Response (IVR) Service <xref
            target="MSCML">(RFC 5022)</xref> - Providing the ability to stream
            media as above, but with VCR-style controls.</t>
          </list></t>

        <figure anchor="overview_mechanism" title="">
          <preamble>The approach is shown in the following figure:</preamble>

          <artwork align="left" alt="" height="" name="" type="" width=""
                   xml:space="preserve"><![CDATA[

+--------------+
|              |
| Email Client |^
|              | \
+--------------+  \
    ^           ^  \
    |            \  \ (5)
    | (1),        \  \
    | (2)          \  \
    |           (3),\  \
    |           (6)  \  \
    |                 \  \
    v                  v  v
+--------------+       +----------------+
|              |  (4)  |                |
| IMAP Server  |<----->|  Media Server  |
|              |       |                |
+--------------+       +----------------+
            
          ]]></artwork>
        </figure>

        <t>The proposed mechanism has the following steps: <list
            style="numbers">
            <t>Client determines from MIME headers of a particular message that a
            particular message part (attachment) should be streamed to the
            user. Note that no assumptions are made about how/when/if the
            client contacts the user of the client about this decision. User
            input may be required in order to initiate the proposed
            mechanism.</t>

            <t>Client constructs an IMAP URL referencing the message part, and
            uses the <xref target="URLAUTH">GENURLAUTH</xref> command to
            generate a URLAUTH authorized IMAP URL.</t>

            <t>Client connects to a SIP Media Server using the Announcement
            Service as specified in <xref target="NETANN">RFC 4240</xref>, or
            the IVR Service as specified in <xref target="MSCML">RFC
            5022</xref>, and passes the URLAUTH authorized URL to the media
            server.</t>

            <t>Media Server connects to the IMAP Server specified in the
            referenced URL, and uses the IMAP <xref
            target="URLAUTH">URLFETCH</xref> command to retrieve the message
            part.</t>

            <t>Media server streams the retrieved message part to the client
            using <xref target="RTP">RTP</xref>.</t>

            <t>The media server or the client terminate the media streaming, or the streaming ends
              naturally. The SIP session is terminated by either client or server.</t>
          </list></t>

        <t>It should be noted that the proposed mechanism makes several
        assumptions about the mobile device, as well as available network services,
        namely: <list style="symbols">
            <t>Mobile device is provisioned with, or obtains via some
	    dynamic mechanism (see Section <xref target="discovery"
	    format="counter"/>), the location of a media
	    server which supports either <xref target="NETANN">RFC
	    4240</xref> and/or <xref target="MSCML">RFC 5022</xref>.</t>

            <t>Media Server(s) used by the mobile device support the <xref
            target="IMAPURL">IMAP URL</xref> scheme for the announcement
            and/or IVR services</t>

            <t>IMAP Server used by the mobile device supports generating
            anonymous IMAP URLs using the URLAUTH mechanism as well as
	    the IMAP <xref target="URLFETCH_BINARY">URLFETCH BINARY</xref> extension</t>
          </list></t>

      </section>

      <section anchor="discovery"
               title="Media Server Discovery"
               toc="default">
        <t>This section discusses possibilities for the automatic
	discovery of suitable media servers to perform streaming
	operations, and provides for such a mechanism using the IMAP
	<xref target="METADATA">METADATA</xref> extension.</t>
        <t>
        There are two possibilities for clients with regard to determining
        the hostname and port number information of a suitable media server:
        <list style="numbers">
            <t>No discovery of media servers is required: clients are
            configured with suitable media server information in an
            out-of-band manner.</t>

            <t>Discovery of media servers is required: clients use a
            discovery mechanism to determine a
            suitable media server that will be used for streaming multimedia 
	    message parts.</t>
          </list></t>

        <t>There are several scenarios where media server discovery would be a
        requirement for streaming to be successful: <list style="symbols">
            <t>Client is not configured with the address of any media
            servers.</t>

            <t>Client is configured with the address of one or more media
            servers, but the IMAP server is configured to only accept URLFETCH
            requests from specific media servers (for security or site policy
            reasons), and thus streaming would fail due to the media server
            not being able to retrieve the media from the IMAP server.</t>
          </list></t>

        <t>There is also a scenario where media server discovery would improve
        the security of the streaming mechanism, by avoiding the use of
        completely anonymous URLs. For example, the client could
        discover a media server address that was an authorised user of the IMAP
	server for streaming purposes, which would allow the client to generate a URL,
	which was secure in that it could *only* be accessed by an
	entity that is trusted by the IMAP Server to retrieve
	content. The issue of trust in media servers is discussed more
	fully in <xref target="security"></xref>.</t>

        <t>This document describes using the IMAP <xref
        target="METADATA">METADATA</xref> extension, via the use of a server entry
        that provides the contact information for suitable media servers for
        use with the IMAP server. Media Server discovery is optional: clients
        are free to use pre-configured information about media servers, or to
        fall back to pre-configured information if they encounter IMAP servers
        that do not support either the METADATA extension or the proposed
        entry, or that do not provide a value for the entry.</t>

        <t>A METADATA entry with the name of "/shared/mediaServers" is
	used to store the locations of suitable media servers known to
	the IMAP server. The entry is formatted
        according to the formalSyntax specified in <xref
        target="formalsyntax"></xref>. This consists of a tuple of a URI
        and optional "stream" string, where the URI is surrounded by &lt;&gt; symbols,
        the URI and "stream" are separated using a colon ":", and
	tuples are separated using a ";".</t>

	<t>The "stream" string (c.f. the "stream" access 
	identifier from <xref target="ACCESSID"></xref>) is
	used to identify media servers capable of connecting to the
	IMAP server as users authorized to retrieve URLs constructed
	using the "stream" access identifier. It indicates that the client MUST 
	create the content URI using the "stream" access identifier. See <xref
	target="genurlauth"></xref> for a description of how the
	client should make use of the access identifier when generating IMAP
	URLs.)</t>

        <t>Example values of the /shared/mediaServers METADATA entry
	(N.B. Any line wrapping below is for the purpose of clarity):<vspace blankLines="1" />
        "&lt;sip:ivr@ms.example.net:5060&gt;:stream;&lt;sip:annc@ms1.example.net:5060&gt;;&lt;sips:ivr@ms2.example.net:5061&gt;"
        <vspace blankLines="1" />
        "&lt;sip:ivr@192.0.2.40:5060&gt;;&lt;sip:192.0.2.41:5060&gt;;&lt;sips:annc@192.0.2.42:5060&gt;:stream"</t>

        <t>
          It should be noted that the URI specified in the ABNF is
	  generic, i.e. not restricted to SIP URIs; however
	  this document only specifies how to make use of SIP
	  URIs. Additionally, the "userinfo" (known as the "service
	  indicator" in RFC 4240 and RFC 4722) component of the URI is
          optional; if specified it gives the client additional
	  information about the media server capabilities. For
	  example, a userinfo component of "annc" indicates that the
	  media server supports RFC 4240, and "ivr" indicates support
	  for RFC 4722. <xref target="clientdecision"></xref>
	  further describes how clients should behave if the
	  "userinfo" component is not present.
        </t>

        <t>Clients SHOULD parse the value of the /shared/mediaServers
	entry, and contact a media server using one of the returned 
        URIs. The servers are returned in order of preference as suggested 
        by the server, however it is left to the client to decide if a
        different order is more appropriate when selecting the media server(s) 
        to contact, as well as the selection of alternates under
	failure conditions.</t> 

        <t>Administrators configuring the values of the /shared/mediaServers
	entry, who do not know the capabilities of the media servers
	being configured, SHOULD NOT include a userinfo component as part of 
	of the URI, in which case the client will determine which
	service to use as specified in Section <xref
	target="clientdecision" format="counter"></xref>. Note that
	if a media server supports multiple services, a URI with the
	appropriate userinfo component SHOULD be configured for each
	service. </t>

	<t>
	  Note that even though the media server address can be discovered
	  dynamically, it is assumed that the necessary security arrangements 
	  between the client and the media server already exist. For example,
	  the media server could use SIP digest authentication to provide
	  access only to authenticated clients; in this case, it is assumed
	  the username and password have already been set up.  Likewise, if
	  the client wants to authenticate the media server using e.g. TLS
	  and certificates, it is assumed the necessary arrangements (trust
	  anchors and so on) already exist.  In some deployments, the clients
	  and media servers may even be willing to rely on the security of
	  the underlying network, and omit authentication between the client
	  and the media server entirely. See Section <xref
	  target="security" format="counter"/> for more details.
	</t>
    </section>

      <section anchor="genurlauth" title="Client use of GENURLAUTH Command"
	       toc="default">
        <t>The decision to make use of streaming services for a message part
        will usually be predicated on the content type of the message part.
        Using the capabilities of the IMAP FETCH command, clients determine
        the <xref target="MIME">MIME</xref> Content-Type of particular message
        parts and based on local policies or heuristics, decide that streaming
        for that message part will be attempted.</t>

        <t>Once the client has determined that a particular message part
        requires streaming, the client generates an IMAP URL that refers to
        the message part according to the method described in <xref
        target="IMAPURL">RFC 5092</xref>. The client then begins the process
        of generating an URLAUTH URL, by appending ";EXPIRE=&lt;datetime&gt;"
        and ";URLAUTH=&lt;access&gt;" to the initial URL.</t>

        <t>The ";EXPIRE=&lt;datetime&gt;" parameter is optional, however it
        SHOULD be used, since the use of anonymous URLAUTH authorized URLs is
        a security risk (see <xref target="security"></xref>, and
	doing so ensures that at some point in the 
        future, permission to access that URL will cease. IMAP server
	implementors may choose to reject anonymous URLs that are
	considered insecure (for example with an EXPIRE date too far
	in the future), as a matter of local security policy. To
	prevent this causing interoperability problems, IMAP servers
	that implement this profile MUST NOT reject GENURLAUTH commands
	for anonymous URLs on the basis of the EXPIRE time, if that
	time is equal to, or less than 1 hour in the future.</t>

        <t>The &lt;access&gt; portion of the URLAUTH URL MUST be
        'stream' (see <xref target="ACCESSID"></xref>) if an out of
	band mechanism or the media server discovery mechanism
	discussed in <xref target="discovery"/> specifies that the
	media server is an authorized user of the IMAP server for the purposes of
	retrieving content via URLFETCH. Without specific prior knowledge 
        of such a configuration (either through the discovery
	mechanism described in this document, or by an out of band
	mechanism), the client SHOULD 
	use the 'stream' access identifier, which will cause
	streaming to fail if the media server is not an authorized
	user of the IMAP server for the purposes of streaming. 
	</t>
	<t>However, if the client wishes to take
	the risk associated with generating a URL that can be used by
	any media server (see <xref target="security"></xref>), it MAY
	use 'anonymous' as the  &lt;access&gt; portion of the URLAUTH
	URL passed to the GENURLAUTH command. For example, the client
	may have been preconfigured with the address of media servers
	in the local administrative domain, (thus implying a level of
	trust in those media servers), without knowing whether those
	media servers have a pre-existing trust relationship with the
	IMAP server to be used (which may well be in a different
	administrative domain). See <xref target="security"></xref>
	for a full discussion of the security issues.</t>

        <t>The client uses the URL generated as a parameter to the GENAUTHURL
        command, using the INTERNAL authorization mechanism. The URL returned
        by a successful response to this command will then be passed to the
        media server. If no successful response to the GENURLAUTH command is
        received, then no further action will be possible with respect to
        streaming media to the client.</t>

        <t>Examples:</t>
        
        <t>C: a122 UID FETCH 24356 (BODYSTRUCTURE) <vspace blankLines="0" /> S:
        * 26 FETCH (BODYSTRUCTURE (("TEXT" "PLAIN" <vspace blankLines="0" /> S:
        ("CHARSET" "US-ASCII") NIL<vspace blankLines="0" /> S:
          NIL "7BIT" 1152 23)("VIDEO" "MPEG" <vspace blankLines="0" />
        NIL NIL "BASE64" 655350)) UID 24356)<vspace blankLines="0" />
        S: a122 OK FETCH completed. <vspace blankLines="0" /> C: a123 GENURLAUTH
        "imap://joe@example.com/INBOX/;uid=24356/;<vspace />
        section=1.2;expire=2006-12-19T16:39:57-08:00;<vspace />
        urlauth=anonymous" INTERNAL <vspace blankLines="0" /> S: * GENURLAUTH
        "imap://joe@example.com/INBOX/;uid=24356/;<vspace />
        section=1.2;expire=2006-12-19T16:39:57-08:00;<vspace />
        urlauth=anonymous:<vspace />
        internal:238234982398239898a9898998798b987s87920" <vspace
        blankLines="0" /> S: a123 OK GENURLAUTH completed <vspace
        blankLines="1" /></t>

        <t>C: a122 UID FETCH 24359 (BODYSTRUCTURE) <vspace blankLines="0" /> S:
          * 27 FETCH (BODYSTRUCTURE (("TEXT" "PLAIN" <vspace blankLines="0" /> S:
          ("CHARSET" "US-ASCII") NIL<vspace blankLines="0" /> S:
          NIL "7BIT" 1152 23)("AUDIO" "G729"<vspace blankLines="0" />
          NIL NIL "BASE64" 87256)) UID 24359)<vspace blankLines="0" />
          S: a122 OK FETCH completed. <vspace
        blankLines="0" /> C: a123 GENURLAUTH
        "imap://joe@example.com/INBOX/;uid=24359/;<vspace />
        section=1.3;expire=2006-12-19T16:39:57-08:00;<vspace />
        urlauth=stream" INTERNAL <vspace blankLines="0" /> S: * GENURLAUTH
        "imap://joe@example.com/INBOX/;uid=24359/;<vspace />
        section=1.3;expire=2006-12-20T18:31:45-08:00;<vspace />
        urlauth=stream:<vspace />
        internal:098230923409284092384092840293480239482" <vspace
        blankLines="0" /> S: a123 OK GENURLAUTH completed</t>
      </section>

      <section anchor="clientdecision"
               title="Client Determination of Media Server Capabilities"
               toc="default">
        <t>Once an authorized IMAP URL has been generated, it is up to the
        client to pass that URL to a suitable media server that is capable of
        retrieving the URL via IMAP, and streaming the content to the client
        using the <xref target="RTP">RTP</xref> protocol.</t>
        
        <t>
          This section specifies the behaviour of clients that have not determined,
          (either statically through configuration, or dynamically
	  through a discovery process as discussed in Section <xref
	  target="discovery" format="counter"></xref>), the
	  capabilities of the media server with respect to the
	  services (i.e. RFC 4240 or 5022) supported by that media
	  server. Clients that have determined those capabilities
	  should use the mechanisms described in Section <xref
	  target="netanninvite" format="counter"></xref> 
          or Section <xref target="mscmlinvite"
	  format="counter"></xref>, as appropriate. 
        </t>

        <t>
	  If the client supports the MSCML IVR service, then it SHOULD attempt
	  to contact the media server using the MSCML protocol by sending a SIP
	  INVITE which has the service indicator "ivr".
	</t> 

        <t>
	  Assuming the media server responds to the INVITE without error, the
	  client can carry on using the MSCML IVR service as specified in <xref
	  target="mscmlinvite"></xref>. If the media server responds with an
	  error indicating that the "ivr" service is not supported, then if the
	  client supports it, the client SHOULD attempt to contact the media
	  server using the Announcement Service, as described in <xref
	  target="netanninvite"></xref>. 
	</t>

        <t>
	  The following example shows an example SIP INVITE using the "ivr"
	  service indicator: <vspace blankLines="1" /> 
	  C: INVITE sip:ivr@ms2.example.com SIP/2.0 <vspace />
	&lt; SIP Header fields omitted for reasons of brevity &gt;
	</t>
      </section>

      <section anchor="netanninvite"
               title="Client Use of the Media Server Announcement Service"
               toc="default">
        <t>
	  Assuming the client or media server does not support use of the
	  MSCML protocol, the media server announcement service is used, as
	  described in <xref target="NETANN">RFC 4240</xref>. This service
	  allows the client to send a SIP INVITE to a special username ('annc')
	  at the media server (the "announcement" user), supplying the URL
	  obtained as per <xref target="genurlauth"></xref>.
	</t>

        <t>
	  The SIP INVITE is constructed as shown in the examples below; note
	  that as per RFC 4240, the play parameter is mandatory, and specifies
	the authorized IMAP URL to be played.
	</t>

        <t>
	  Examples of valid SIP INVITE URIs sent to the media server
	  announcement service:
	</t>

        <t>
	  C: sip:annc@ms2.example.net;<vspace/>
	  play=imap:%2F%2Fjoe@example.com%2FINBOX%2F%3Buid%3D24356%2F%3Bsection<vspace/>
	  %3D1.2%3Bexpire%3D2006-12-19T16:39:57-08:00%3Burlauth%3Danonymous:<vspace/>
	  internal:238234982398239898a9898998798b987s87920<vspace/>
	  <vspace blankLines="1"/>
	  C: sip:annc@ms1.example.net;<vspace/>
	  play=imap:%2F%2Ffred@example.com%2FINBOX%2F%3Buid%3D24359%2F%3Bsection<vspace/>
	  %3D1.3%3Bexpire%3D2006-12-20T18:31:45-08:00%3Burlauth%3Dstream:<vspace/>
	  internal:098230923409284092384092840293480239482<vspace/>
	</t>

	<t>
	  Notice that many of the characters that are used as parameters of
	  the IMAP URI are escaped, as otherwise they would change the
	  meaning of the enclosing SIP URI, by being regarded as SIP
	  URI parameters instead of IMAP URL parameters. 
	</t> 

        <t>
	  If the client receives a 200 (OK) response, the media server has
	  successfully retrieved the content from the IMAP server and the
	  negotiated RTP stream will shortly begin.
	</t>

        <t>
	  There are many possible response codes, however a response code of 404
	  received from the media server 
	  indicates that the content could not be found or could not be
	  retrieved for some reason. For example, the media server may not
	  support the use of IMAP URLs. At this point, there are several options
	  to the client, such as using alternate media servers, or giving up in
	  attempting to stream the required message part.
	</t>
      </section>

      <section anchor="transcoding" title="Media Negotiation and Transcoding">
        <t>
	  This document uses standards and protocols from two traditionally
	  separate application areas: Mobile Email (primarily IMAP) and Internet
	  Telephony/Streaming (e.g. SIP/RTP). Since the document primarily
	  addresses enhancing the capabilities of mobile email, it is felt
	  worthwhile to give some examples of simple SIP/SDP exchanges, and
	  discussing capabilities such as media negotiation (using SDP) and
	  media transcoding.
	</t>

        <t>
	  In the below example, the client contacts the media server using
	  the SIP INVITE command to contact the Announcement service (see <xref
	  target="netanninvite"></xref>), advertising support for a range of
	  audio and video codecs (using <xref target="SDP">SDP</xref>), and in
	  response the media server advertises only a set of audio codecs. This
	  process is identical for the IVR service, except that the IVR service
	  does not use the SIP Request-URI to indicate the content to be played;
	  instead this is carried in a subsequent SIP INFO request.
	</t>

	<t>
	  The client and server now know from the SDP advertised by both
	  client and server that communication must be using the subset of audio
	  codecs supported by both client and server (in the example SDP, it is
	  clear that the server does not support any video codecs). The media
	  server may perform transcoding (i.e. converting between codecs) on the
	  media received from the IMAP server in order to satisfy the codecs
	  supported by the client: for example the media server may downgrade
	  the video retrieved from the IMAP server to the audio component
	  only.
	</t>

        <t>
	  For clients using the Announcement service, the media server MUST
	  return an error to the INVITE if it cannot find a common codec between
	  the client, server and media, or it cannot transcode to a suitable
	  codec. Similarly, for clients using the MSCML IVR service, the media
	  server MUST return a suitable error response to the
	  &lt;playcollect&gt; request.
	</t>

        <t>
	  Example SIP INVITE and SDP Media Negotiation
	</t>

        <t>
	  C: INVITE sip:annc@ms2.example.com;  <vspace />
	  play=imap:%2F%2Fjoe@example.com%2FINBOX%2F%3Buid%3D24356%2F%3B <vspace />
	  section%3D1.2%3Bexpire%3D2006-12-19T16:39:57-08:00%3Burlauth%3D <vspace />
	  anonymous:internal:238234982398239898a9898998798b987s87920 SIP/2.0 <vspace />
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  C: To: NetAnn &lt;sip:annc@ms2.example.com&gt;<vspace />
	  C: Call-ID: 8204589102@example.com<vspace />
	  C: CSeq: 1 INVITE <vspace />
	  C: Contact: &lt;sip:UAA@192.0.2.40&gt; <vspace />
	  C: Content-Type: application/sdp <vspace />
	  C: Content-Length: 481 <vspace />
	  C: <vspace />
	  C: v=0 <vspace />
	  C: o=UserA 2890844526 2890844526 IN IP4 192.0.2.40 <vspace />
	  C: s=Session SDP <vspace />
	  C: c=IN IP4 192.0.2.40 <vspace />
	  C: t=3034423619 0 <vspace />
	  C: m=audio 9224 RTP/AVP 0 8 3 98 101 <vspace />
	  C: a=alt:1 1 : 01BB7F04 6CBC7A28 192.0.2.40 9224 <vspace />
	  C: a=fmtp:101 0-15<vspace />
	  C: a=rtpmap:98 ilbc/8000<vspace />
	  C: a=rtpmap:101 telephone-event/8000<vspace />
	  C: a=recvonly<vspace />
	  C: m=video 9226 RTP/AVP 105 34 120<vspace />
	  C: a=alt:1 1 : 01BCADB3 95DFFD80 192.0.2.40 9226<vspace />
	  C: a=fmtp:105 profile=3;level=20<vspace />
	  C: a=fmtp:34 CIF=2 QCIF=2 MAXBR=5120<vspace />
	  C: a=rtpmap:105 h263-2000/90000<vspace />
	  C: a=rtpmap:120 h263/90000<vspace />
	  C: a=recvonly<vspace /> 
	  <vspace blankLines="1"/> 
	  S: SIP/2.0 200 OK<vspace />
	  S: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  S: To: NetAnn &lt;sip:annc@ms2.example.com&gt;<vspace />
	  S: Call-ID: 8204589102@example.com<vspace />
	  S: CSeq: 1 INVITE<vspace />
	  S: Contact: &lt;sip:netann@192.0.2.41&gt;<vspace />
	  S: Content-Type: application/sdp<vspace />
	  S: Content-Length: 317<vspace />
	  S: <vspace />
	  S: v=0<vspace />
	  S: o=NetAnn 2890844527 2890844527 IN IP4 192.0.2.41<vspace />
	  S: s=Session SDP<vspace />
	  S: c=IN IP4 192.0.2.41<vspace />
	  S: t=3034423619 0<vspace />
	  S: m=audio 17684 RTP/AVP 0 8 3 18 98 101<vspace />
	  S: a=rtpmap:0 PCMU/8000<vspace />
	  S: a=rtpmap:8 PCMA/8000<vspace />
	  S: a=rtpmap:3 GSM/8000<vspace />
	  S: a=rtpmap:18 G729/8000<vspace />
	  S: a=fmtp:18 annexb=no<vspace />
	  S: a=rtpmap:98 iLBC/8000<vspace />
	  S: a=rtpmap:101 telephone-event/8000<vspace />
	  S: a=fmtp:101 0-16<vspace />
	  <vspace blankLines="1"/>
	  C: ACK sip:netann@192.0.2.41 SIP/2.0<vspace />
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  C: To: NetAnn &lt;sip:annc@ms2.example.com&gt;<vspace />
	  C: Call-ID: 8204589102@example.com<vspace /> 
	  C: CSeq: 1 ACK<vspace />
	  C: Content-Length: 0<vspace />
	</t>
      </section>

      <section anchor="mscmlinvite"
               title="Client Use of the Media Server MSCML IVR Service"
               toc="default">
        <t>
	  Once the client has determined that the media server supports the
	  IVR service, it is up to the client to generate a suitable MSCML
	  request to initiate streaming of the required media.
	</t>

        <t>
	  When using the IVR service, the initial SIP invite is used only to
	  establish that the media server supports the MSCML IVR service, and to
	  negotiate suitable media codecs. Once the initial SIP INVITE and
	  response to that INVITE have been completed successfully, the client
	  must generate a SIP INFO request with MSCML in the body of the request
	  to initiate streaming.
	</t>

        <t>
	  The &lt;playcollect&gt; request is used, as this allows the use of
	  DTMF digits to control playback of the media, such as fast-forward or
	  rewind.
	</t>

	<t>
	  Since the playcollect request is used purely for its VCR
	  capabilities, there is no need for the media server to perform DTMF
	  collection, therefore the playcollect attributes "firstdigittimer",
	  "interdigittimer" and "extradigittimer" SHOULD all be set to "0ms",
	  which will have the effect of causing digit collection to cease
	  immediately after the media has finished playing.
	</t>

        <t>
	  The "ffkey" and "rwkey" attributes of &lt;playcollect&gt; are used
	  to control fast forward and rewind behaviour, with the "skipinterval"
	  attribute being used to control the 'speed' of these actions.
	</t>

        <t>
	  The &lt;prompt&gt; tag is used to specify the media to be played,
	  and SHOULD have a single &lt;audio&gt; tag that gives the URL of the
	  media, as per the <xref target="genurlauth"></xref>. The
	  audio-specific name of the tag is historical, as the tag can be used
	  for video as well as audio content. The "stoponerror" attribute SHOULD
	  be set to "yes", as then meaningful error messages will be returned by
	  the media server in the event of problems such as retrieving the media
	  from the IMAP server.
	</t>

	<t>
	  An example SIP INFO request using the &lt;playcollect&gt; request
	  is shown at the end of this section.
	</t>

        <t>
	  It should be noted that under normal (i.e. non-error) conditions,
	  the response to the &lt;playcollect&gt; request is a SIP 200 (OK)
	  response. The media server then streams the media, and only when the
	  media has finished playing (naturally or due to a user request), does
	  the media server send a &lt;playcollect&gt; response, which includes
	  details of the media played, such as length, and any digits
	  collected.
	</t>

        <t>
	  The client may suspend playback of the media at any time by either
	  sending the DTMF escape key (specified as an attribute to the
	  &lt;playcollect&gt; request) or by sending a &lt;stop&gt; request to
	  the media server in a SIP INFO request. Upon receipt of the request,
	  the media server will acknowledge it, and then cease streaming of the
	  media, followed by a SIP INFO request containing the
	  &lt;playcollect&gt; response.
	</t>

        <t>
	  If the media server cannot play the media for any reason, for
	  example if it cannot retrieve the media from the IMAP server,
	  streaming will not take place, and the &lt;playcollect&gt; response
	  will be sent, usually with meaningful values in the &lt;error_info&gt;
	  element.
	</t>
	
        <t>
	  The following gives an example dialog between a client and media
	  server, including a rewind request, and termination of the playback by
	  use of the escape key. Some elements of the SIP dialog such as full
	  SIP header fields and SDP are omitted for reasons of brevity. (The protocol
	  diagram in <xref target="mscml_protocol"></xref> shows the high-level
	  message flow between all the components, including the IMAP
	  server.)
	</t>

        <t>
	  C: INVITE sip:ivr@ms.example.com SIP/2.0<vspace />
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace /> 
	  C: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace /> 
	  C: Call-ID: 3298420296@example.com<vspace />
	  C: CSeq: 1 INVITE <vspace />
	  C: Contact: &lt;sip:UAA@192.0.2.40&gt; <vspace />
	  C: Content-Type: application/sdp <vspace />
	  C: Content-Length: XXX <vspace />
	  C: <vspace />
	  C: &lt;SDP Here&gt; <vspace />
	  <vspace blankLines="1" /> 
	  S: SIP/2.0 200 OK<vspace />
	  S: From: UserA &lt;sip:UAA@example.com&gt;<vspace /> 
	  S: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace /> 
	  S: Call-ID: 3298420296@example.com<vspace /> 
	  S: CSeq: 1 INVITE<vspace /> 
	  S: Contact: &lt;sip:ivr@192.0.2.41&gt;<vspace /> 
	  S: Content-Type: application/sdp<vspace /> 
	  S: Content-Length: XXX<vspace />
	  S: <vspace />
	  S: &lt;SDP Here&gt; <vspace /> 
	  <vspace blankLines="1"/>
	  C: ACK sip:ivr@ms.example.com SIP/2.0<vspace /> 
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  C: To: IVR &lt;sip:ivr@ms2.example.com&gt;<vspace /> 
	  C: Call-ID: 3298420296@example.com<vspace /> 
	  C: CSeq: 1 ACK<vspace /> 
	  C: Content-Length: 0<vspace />
	  <vspace blankLines="1"/>
	  C: INFO sip:ivr@192.0.2.41 SIP/2.0<vspace />
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  C: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace />
	  C: Call-ID: 3298420296@example.com<vspace /> 
	  C: CSeq: 2 INFO<vspace /> 
	  C: Content-Type: application/mediaservercontrol+xml<vspace /> 
	  C: Content-Length: 423 <vspace />
	  C: <vspace />
	  C: &lt;?xml version="1.0"?&gt;<vspace />
	  C: &lt;MediaServerControl version="1.0"&gt;<vspace />
	  C: &lt;request&gt;<vspace />
	  C: &lt;playcollect id="332985001"<vspace />
	  C: firstdigittimer="0ms" interdigittimer="0ms" extradigittimer="0ms"<vspace />
	  C: skipinterval="6s" ffkey="6" rwkey="4" escape="*"&gt;<vspace /> 
	  C: &lt;prompt stoponerror="yes" <vspace />
	  C: locale="en_US" offset="0" gain="0" rate="0"<vspace />
	  C: delay="0" duration="infinite" repeat="0"&gt;<vspace />
	  C: &lt;audio url="imap://joe@example.com/INBOX/;uid=24356/;section=1.2; <vspace />
	  expire=2006-12-19T16:39:57-08:00;urlauth=anonymous:<vspace />
	  internal:238234982398239898a9898998798b987s87920"/&gt;<vspace />
	  C: &lt;/prompt&gt;<vspace /> 
	  C: &lt;/playcollect&gt;<vspace />
	  C: &lt;/request&gt;<vspace />
	  C: &lt;/MediaServerControl&gt;<vspace blankLines="1" /> 
	  S: SIP/2.0 200 OK<vspace /> 
	  S: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  S: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace /> 
	  S: Call-ID: 3298420296@example.com<vspace />
	  S: CSeq: 2 INFO<vspace /> 
	  S: Contact: &lt;sip:ivr@192.0.2.41&gt;<vspace />
	  S: Content-Length: 0<vspace blankLines="1" />
	  S: &lt;Media Server retrieves media from IMAP Server and streams to client&gt; <vspace blankLines="1" /> 
	  C: &lt;Client streams 6 key&gt;<vspace blankLines="1" /> 
	  S: &lt;Media Server fast forwards media by 6 seconds&gt; <vspace blankLines="1" />
	  C: &lt;Client streams * key&gt;<vspace blankLines="1" />
	  S: &lt;Media Server stops streaming&gt; <vspace blankLines="1" /> 
	  S: INFO sip:UAA@192.0.2.40 SIP/2.0<vspace /> 
	  S: From: IVR &lt;sip:ivr@ms.example.com&gt;<vspace />
	  S: To: UserA &lt;sip:UAA@example.com&gt;<vspace /> 
	  S: Call-ID: 3298420296@example.com<vspace />
	  S: CSeq: 5 INFO<vspace /> 
	  S: Contact: &lt;sip:ivr@192.0.2.41&gt;<vspace /> 
	  S: Content-Type: application/mediaservercontrol+xml<vspace />
	  S: Content-Length: XXX<vspace />
	  S: <vspace />
	  S: &lt;?xml version="1.0"?&gt;<vspace />
	  S: &lt;MediaServerControl version="1.0"&gt;<vspace /> 
	  S: &lt;response id="332985001" request="playcollect" code="200" <vspace />
	  S: reason="escapekey" playduration="34s"<vspace /> 
	  S: playoffset="34s" digits="" /&gt; <vspace />
	  S: &lt;/MediaServerControl&gt;<vspace blankLines="1" /> 
	  C: SIP/2.0 200 OK <vspace /> 
	  C: From: IVR &lt;sip:ivr@ms.example.com&gt;<vspace />
	  C: To: UserA &lt;sip:UAA@example.com&gt;<vspace /> 
	  C: Call-ID: 3298420296@example.com<vspace /> 
	  C: CSeq: 5 INFO<vspace />
	  C: Content-Length: 0<vspace /> 
	  <vspace blankLines="1"/>
	  C: BYE sip:ivr@192.0.2.41 SIP/2.0 <vspace /> 
	  C: From: UserA &lt;sip:UAA@example.com&gt;<vspace /> 
	  C: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace /> 
	  C: Call-ID: 3298420296@example.com<vspace /> 
	  C: CSeq: 6 BYE<vspace /> 
	  C: Content-Length: 0<vspace blankLines="1" />
	  S: SIP/2.0 200 OK<vspace />
	  S: From: UserA &lt;sip:UAA@example.com&gt;<vspace />
	  S: To: IVR &lt;sip:ivr@ms.example.com&gt;<vspace /> 
	  S: Call-ID: 3298420296@example.com<vspace /> 
	  S: CSeq: 6 BYE<vspace /> 
	  S: Contact: &lt;sip:ivr@192.0.2.41&gt;<vspace /> 
	  S: Content-Length: 0
	</t>
      </section>

      <section anchor="urlfetch" title="Media Server Use of IMAP Server">
        <t>
	  This section describes how the media server converts the IMAP URL
	  received via the announcement or IVR service into suitable IMAP
	  commands for retrieving the content.
	</t>

        <t>
	  The media server first connects to the IMAP server specified in the
	  URL. Once connected, the media server SHOULD use <xref
	  target="TLS">TLS</xref> to encrypt the communication path.
	</t>
	  
	<t>
	  If the media server has a user identity on the IMAP server, the media
	  server SHOULD authenticate itself to the IMAP server using the media
	  server's user identity.
	</t>

        <t>
	  If the media server is not configured as an authorized user of the
	  IMAP server, then the behaviour specified in <xref target="IMAPURL">
	  IMAP URL bis4</xref> MUST be followed. That is, if the
	  server advertises AUTH=ANONYMOUS IMAP capability, the media
	  server MUST use the AUTHENTICATE command with <xref
	  target="ANONYMOUS">ANONYMOUS</xref> SASL mechanism.  If SASL
	  ANONYMOUS is not available, the user name "anonymous" is
	  used with the "LOGIN" command and the password is supplied
	  as the Internet e-mail address of the administrative contact
	  for the media server.
	</t> 

        <t>
	  Once authenticated, the media server issues the URLFETCH command,
	  using the URL supplied in the 'play' parameter of the SIP INVITE (or
	  audio tag of the MSCML). If the IMAP server does not advertise URLAUTH=BINARY in its
	  post-authentication capability string, then the media server returns a
	  suitable error code to the client.
	</t>
	
	<t>
	  The additional parameters to the URLFETCH command
	  specified in <xref target="URLFETCH_BINARY">(URLFETCH
	  BINARY)</xref> are used by the media server to tell the IMAP
	  server to remove any transfer encoding and return the content
	  type of the media (as content type information is not
	  contained in the IMAP URL).
	</t>
	<t> 
	  A successful URLFETCH command will return the message part
	  containing the media to be streamed.
	  If the URLFETCH was unsuccessful, then the media server MUST return an
	  appropriate error response to the client.
	</t>
	
        <t>
	  Assuming the content is retrieved successfully, the
	  media server returns a 200 (OK) response code to the client. After an
	  ACK is received, an RTP stream is delivered to the client using the
	  parameters negotiated in the SDP.
	</t>
	
	<t>
	  If appropriate, the media server MAY choose to implement connection
	  caching, in which case connection and disconnection from the IMAP
	  server are handled according to whatever algorithm the media server
	  chooses. For example, the media server may know, a priori, that it
	  will always access the same IMAP server using the same login
	  credentials with an access pattern that would benefit from connection
	  caching, without unduly impacting server resources.
	</t>

        <t>Examples:</t>

        <t>
	  C: a001 LOGIN anonymous null <vspace /> 
	  S: a001 OK LOGIN completed. <vspace /> 
	  C: a002 URLFETCH
	  ("imap://joe@example.com/INBOX/;uid=24356/;section=1.2;<vspace/>
	  expire=2006-12-19T16:39:57-08:00;urlauth=anonymous:<vspace />
	  internal:238234982398239898a9898998798b987s87920" BODYPARTSTRUCTURE BINARY) <vspace /> 
	  S: * URLFETCH "imap://joe@example.com/INBOX/;uid=24356/;<vspace />
	  section=1.2;expire=2006-12-19T16:39:57-08:00;urlauth=anonymous:<vspace />
	  internal:238234982398239898a9898998798b987s87920" <vspace />
	  (BODYPARTSTRUCTURE ("VIDEO" "MPEG" () NIL NIL "BINARY" 655350)) 
	  (BINARY ~{655350} <vspace /> 
	  S: [ ~655350 octets of binary data, containing NUL octets ]) <vspace />
	  S: a002 OK URLFETCH completed. <vspace />
	  C: a003 LOGOUT <vspace />
	  S: a003 OK LOGOUT completed.
	</t>
      </section>

      <section title="Protocol Diagrams">
        <t>
	  This section gives examples of using the mechanism described in the
	  document to stream media from a media server to a client, fetching the
	  content from an IMAP server. In all of the examples, the IMAP, SIP and
	  RTP protocols use the line styles "-", "=", and "+",
	  respectively. 
	</t>

        <section anchor="netann_protocol"
                 title="Announcement Service Protocol Diagram">
          <figure>
            <preamble>
	      The following diagram shows the protocol interactions
	      between the email client, the IMAP server and the media
	      server when the client uses the Announcement Service.
	    </preamble>

            <artwork><![CDATA[
Client                     IMAP Server                   Media Server
  |   FETCH (BODYSTRUCTURE)     |                              |
  |---------------------------->|                              |
  |           OK                |                              |
  |<----------------------------|                              |
  |   GENURLAUTH                |                              |
  |---------------------------->|                              |
  |           OK                |                              |
  |<----------------------------|                              |
  |                             |                              |
  |                          SIP INVITE                        | 
  |===========================================================>| 
  |                             |                              |
  |                             |          URLFETCH            |
  |                             |<-----------------------------|
  |                             |             OK               |
  |                             |----------------------------->|
  |                             |                              |
  |                          200 OK                            |
  |<===========================================================|
  |                          ACK                               |
  |===========================================================>|
  |                             |                              |
  |                    Stream Message Part (RTP)               |
  |<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  |                             |                              |
  |                            BYE                             |
  |<===========================================================|
  |                          200 OK                            |
  |===========================================================>|
          
          ]]></artwork>
          </figure>
        </section>

        <section anchor="mscml_protocol" title="IVR Service Protocol Diagram">
          <figure>
            <preamble>
	      The following diagram shows a simplified view of the
	      protocol interactions between the email client, the IMAP server
	      and the media server when the client uses the MSCML IVR
	      Service.
	    </preamble>

            <artwork><![CDATA[
Client                     IMAP Server                   Media Server
  |   FETCH (BODYSTRUCTURE)     |                              |
  |---------------------------->|                              |
  |           OK                |                              |
  |<----------------------------|                              |
  |   GENURLAUTH                |                              |
  |---------------------------->|                              |
  |           OK                |                              |
  |<----------------------------|                              |
  |                             |                              |
  |                          SIP INVITE                        | 
  |===========================================================>| 
  |                             |                              |
  |                          200 OK                            |
  |<===========================================================|
  |                          ACK                               |
  |===========================================================>|
  |                             |                              |
  |                          SIP INFO (playcollect)            |
  |===========================================================>|
  |                             |                              |
  |                          200 OK                            |
  |<===========================================================|
  |                             |                              |
  |                             |          URLFETCH            |
  |                             |<-----------------------------|
  |                             |             OK               |
  |                             |----------------------------->|
  |                             |                              |
  |                    Stream Message Part (RTP)               |
  |<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  |                             |                              |
  |                          SIP INFO (e.g., DTMF ff)          |
  |===========================================================>|
  |                          200 OK                            |
  |<===========================================================|
  |                             |                              |
  |                    Continue streaming (RTP)                |
  |<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
  |                             |                              |
  |                (Streaming Ends or is terminated)           |
  |                             |                              |
  |                     SIP INFO (playcollect response)        |
  |<===========================================================|
  |                            BYE                             |
  |===========================================================>|
  |                           200 OK                           |
  |<===========================================================|
          
          ]]></artwork>
          </figure>
        </section>
      </section>
      </section>


    <section anchor="security" title="Security Considerations" toc="default">
      <t>
	This document proposes the use of <xref target="URLAUTH">URLAUTH</xref>
	"pawn tickets", received over <xref target="IMAP">IMAP</xref>, and transmitted 
	over <xref target="SIP">SIP</xref>, possibly within the MSCML payload of 
	<xref target="MSCML">RFC 5022</xref>, in order to stream media received in messages.
	As such, the security considerations in all these documents apply to this specification.
      </t>
      <t>
	In summary, as the authorized URLs may grant access to data, implementors of this 
	specification need to consider the following with respect to
	the security implications of using IMAP URLs:
        <list style="symbols">
          <t>
	    Use of an anonymous pawn ticket grants
            access to any client of the IMAP server without requiring any
            authentication credentials. The security mechanisms 
            referenced above (with the caveats specified below) SHOULD
	    be used to prevent unauthorized access to the pawn ticket. 
          </t>  
	  <t>
	    Use of pawn tickets that contain the "stream" access identifier
	    restricts access to the content to those entities that are
	    authorized users of the IMAP server for the purposes of
	    streaming retrieved content. Use of such pawn tickets is thus
	    desirable and so implementors should consult <xref
	    target="genurlauth"></xref>, which
	    describes when such pawn tickets should be used.
	  </t>
          <t>
	    If the announcement service is used to set up streaming, then 
	    <xref target="NETANN">RFC 4240</xref> specifies that the
	    pawn ticket is passed in the Request-URI, and so untrusted
	    third-parties may be able to intercept the pawn
	    ticket. Thus, the SIP communication channel SHOULD be
	    secured with TLS (xref target="TLS"/>) as described in
	    <xref target="SIP"/>. Using TLS in this situation
	    protects the pawn ticket from untrusted third-parties,
	    however, it still allows proxies access to the pawn
	    ticket.
          </t>
          <t>
            If the IVR service (<xref target="MSCML">RFC 5022</xref>)
	    is used to setup and control streaming, then MSCML is used
	    to carry the pawn ticket in the body of the request. This
	    SHOULD be secured with TLS as described above. However,
	    use of TLS only secures the data between the client and
	    media server if no proxies are used. Clients operating in
	    an environment with proxies may wish to
	    secure the pawn ticket using end-to-end encryption;
	    in which case, the information on how to use S/MIME to
	    protect SIP payloads found in <xref target="SIP"></xref>
	    may be useful.
          </t>

        </list>
      </t>

      <t>
	This document describes a mechanism that makes use of two
	separate servers to achieve the goal of streaming the content
	desired by the client. A major security implication of this is
	that the media server and IMAP server may well be located in
	separate administrative domains. This leads us to consider the
	security implications of a three-way protocol exchange, and
	the potential trust model implicit in that tripartate
	relationship. The security implications of the individual
	protocols have already been referenced, therefore this section
	describes the security considerations specific to the
	three-way data exchange, specifically:
	<list style="symbols">
	  <t>
	    The client grants the media server full access to the
	    potentially-private media content specified by the IMAP URL.  As a
	    result, the client is responsible for verifying the authenticity of
	    the media server to a degree it finds acceptable for the
	    content (we can refer to this process as determining the
	    "trust" that the client has in a particular media server).
	    The security mechanisms provided by SIP <xref
	    target="SIP"></xref> and RTP <xref target="RTP"></xref> may be
	    used for this purpose, as well as out of band
	    mechanisms such as pre-configuration.
	  </t>
	  <t>
	    However, since the media server will retrieve content
	    from an IMAP server on the user's behalf, the issue of
	    security between the IMAP server and the media server 
	    also needs to be considered. A client has no way of
	    determining (programatically at least) the security of the
	    exchanges between the media server and the IMAP
	    server. However, it can determine, using the "stream" token
	    that is part of the media server
	    discovery mechanism described in <xref
	    target="discovery"></xref>, that the media server has a
	    pre-existing authentication relationship with the IMAP
	    server for the purposes of retrieving content using IMAP
	    URLs. The IMAP server administrator may put pre-requisites
	    on media server administrator before this
	    relationship can be established, for example to guarantee
	    the security of the communication between the media server
	    and the IMAP server.
	  </t>
	  <t>
	    The above two security considerations will influence the decision
	    the client makes with regards to generation of the pawn ticket
	    that is subsequently passed to the media server. This
	    document mandates the use of URLs protected with the
	    "stream" access identifier where the client knows in advance
	    that the "stream" authentication relationship 
	    between media server and IMAP server exists. However, it
	    does allow the use of anonymous pawn tickets where the
	    possibility exists that use of "stream" would cause
	    streaming to fail.
	  </t>
	  <t> 
	    There exists the possibility of an attack by a malicious
	    media server against pawn tickets protected with the
	    "stream" access identifier. In this attack, the client
	    contacts a media server, MS1 (note this is not a
	    man-in-the-middle attack per-se, as the client is
	    intentionally contacting the media server in question),
	    and that media server MS1 then proxies the streaming request
	    to a second media server, MS2, that it has determined or guessed to
	    have "stream" authorization credentials with the IMAP server
	    specified in the pawn ticket. While this attack would
	    technically defeat the protection of the "stream" access
	    identifier, the security mechanisms inherent in SIP, such as
	    authentication, would be expected to prevent unauthorized
	    access to MS2 by malicious clients such as MS1.
          </t>
	</list>
      </t>
      <t>
	Media servers handling streaming requests will be making use
	of pawn ticket URLs for the period of time required to process
	the streaming request, after which the URL will be
	forgotten. However, media servers may log the URLs received from
	clients, in which case the private data contained in
	the IMAP server could be accessed by a malicious or curious
	media server administrator. Even URLs protected with EXPIRE
	may be accessed within the period of expiry. Therefore, media
	servers SHOULD remove or anonymize the internal portion of the
	IMAP URL when logging that URL.
      </t>
      <t>
	Additionally, many of the security considerations in the
	Message Submission BURL Extension apply to this document,
	particularly around the use of pawn tickets and prearranged trust
	relationships such as those described above.
      </t>
      <t>
	Message parts that are encrypted using mechanisms
	such as <xref target="SMIME">S/MIME</xref>, are designed to
	prevent third-parties from accessing the data, thus media
	servers will not be able to fulfil streaming requests for
	messages parts that are encrypted.
      </t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      
      <t>
	IANA is requested to register the following [METADATA]
	server entry to be used for media server discovery, using the
	[METADATA] registry.<vspace
	blankLines="1" /> 
	To: iana@iana.org <vspace blankLines="1" /> 
	Subject: IMAP METADATA Entry Registration <vspace blankLines="1"/> 
	Type: Server<vspace blankLines="1" />
	Name: /shared/mediaServers <vspace blankLines="1" />
        Description: Defines a set of URIs containing the locations of
	suitable media servers for streaming multimedia content 
	<vspace	blankLines="1" /> 
	Content-type: text/plain;charset=utf-8
        <vspace blankLines="1" />
	Contact: neil.cook@noware.co.uk 
      </t>
      
    </section>
    
    <section anchor="drm" title="Digital Rights Management (DRM) Issues">
      <t>
	This document does not specify any Digital Rights Management (DRM)
	mechanisms for controlling access to and copying of the media to be
	streamed. This is intentional. A reference to a piece of media content
	is created using the <xref target="URLAUTH">URLAUTH</xref> command; 
	any DRM required thus should be implemented within the media itself, 
	as implementing checks within URLAUTH could affect any use of the URLAUTH
	command, such as the <xref target="BURL">BURL</xref> command for message
	submission.
      </t>
      
      <t>
	The use of URLAUTH in this specification is believed to be pursuant with,
	and used only for, the execution of those rights to be expected when media
	is sent via traditional internet messaging, and causes no duplication of 
	media content which is not essentially provided by the action of sending the 
	message; that is, the use of the content for downloading and viewing, which 
	*is* implicitly granted by the sender of the message, in as much as the sender
	has the right to grant such rights.
      </t>
      
      <t>
	The document author believes that if DRM is a requirement for Internet
	messaging, then a suitable DRM mechanism should be created. How such a
	mechanism would work is outside the scope of this document.
      </t>
    </section>

    <section anchor="deployment" title="Deployment Considerations">
        <t>
	  This document assumes an Internet deployment where there are no
	  network restrictions between the different components. Specifically,
	  it does not address issues that can occur when network policies
	  restrict the communication between different components, especially
	  between the media server and the IMAP server, and between the client
	  the media server. In particular, RFC 5022 states that "It is unlikely, 
	  but not prohibited, for end-user SIP UACs to have a direct signaling 
	  relationship with a media server." This caveat makes it likely
	  that firewalls and other network security mechanisms will be configured
	  to block direct end-user access to media servers.
        </t>
        <t>
	  In order for either of the streaming mechanisms described in this document
	  to work, local administrators MUST relax firewalls policies such that appropriate
	  SIP UACs running on mobile devices are permitted to access the media servers
	  directly using the SIP protocol. The detail of how the restrictions are
	  relaxed, (for example, only allowing clients connecting from
	  the network space owned/maintained by the operator of the
	  media server) is a matter of local policy, and so is outside
	  the scope of this document.
	</t>
    </section>

    <section anchor="formalsyntax" title="Formal Syntax">
      <t>
	The following syntax specification for the mediaServer METADATA entry
	value uses the Augmented Backus-Naur Form (ABNF) notation as specified
	in <xref target="ABNF">RFC 5234</xref> and the "absolute-URI" definition from
	<xref target="RFC3986">RFC 3986</xref>.
      </t>

      <t>
	Except as noted otherwise, all alphabetic characters are case-
	insensitive. The use of upper or lower case characters to define token
	strings is for editorial clarity only. Implementations MUST accept these
	strings in a case-insensitive fashion.
      </t>

      <t>
	media-servers = ms-tuple *(";" ms-tuple) <vspace blankLines="1" />
        ms-tuple = "&lt;" absolute-URI "&gt;" [":" "stream"] <vspace/>
	blankLines="1" />
      </t>
    </section>

    <section anchor="contrib" title="Contributors" toc="default">
      <t>Eric Burger, eburger@standardstrack.com</t>

      <t>
	Eric Burger provided the initial inspiration for this document, along
	with advice and support on aspects of the media server IVR and
	Announcement services, as well as help with the IETF process.
      </t>

      <t>
	Many people made helpful comments on the document, including
	Alexey Melnikov, Dave Cridland, Martijn Koster, and a variety
	of folks in the Lemonade and Sipping WGs. 
      </t>
    </section>
    
  </middle>

  <back>
    <references title="Normative References">
      <reference anchor="NETANN">
        <front>
          <title>Basic Network Media Services with SIP</title>

          <author fullname="Eric Burger" initials="E."
		  surname="Burger">
	    <organization></organization>
          </author>

          <author initials="J." surname="Van Dyke">
	      <organization></organization>
          </author>

          <author initials="A." surname="Spitzer">
	      <organization></organization>
          </author>

          <date month="December" year="2005" />
        </front>

        <seriesInfo name="RFC" value="4240" />
      </reference>

      <reference anchor="IMAP">
        <front>
          <title>Internet Message Access Protocol - Version 4rev1</title>

          <author fullname="Mark Crispin" initials="M." surname="Crispin">
            <organization>University of Washington</organization>
          </author>

          <date month="March" year="2003" />
        </front>

        <seriesInfo name="RFC" value="3501" />
      </reference>
      
      <reference anchor="URLAUTH">
        <front>
          <title>Internet Message Access Protocol (IMAP) - URLAUTH Extension</title>
          
          <author initials="M." surname="Crispin">
            <organization>University of Washington</organization>
          </author>
          
          <date month="May" year="2006" />
        </front>
        
        <seriesInfo name="RFC" value="4467" />
      </reference>

      <reference anchor="IMAPURL">
        <front>
          <title>IMAP URL Scheme</title>
          
          <author initials="C." surname="Newman">
            <organization>Sun Microsystems</organization>
          </author>
          
          <author initials="A." surname="Melnikov">
            <organization>Isode Ltd.</organization>
          </author>
          
          <date month="Oct" year="2007" />
        </front>
        
        <seriesInfo name="RFC" value="5092" />
      </reference>

      <reference anchor="SIP">
        <front>
          <title>SIP: Session Initiation Protocol</title>

          <author initials="J." surname="Rosenberg">
            <organization></organization>
          </author>

          <author initials="H." surname="Schulzrinne">
            <organization></organization>
          </author>

          <author initials="G." surname="Camarillo">
            <organization></organization>
          </author>

          <author initials="A." surname="Johnston">
            <organization></organization>
          </author>

          <author initials="J." surname="Peterson">
            <organization></organization>
          </author>

          <author initials="R." surname="Sparks">
            <organization></organization>
          </author>

          <author initials="M." surname="Handley">
            <organization></organization>
          </author>

          <author initials="E." surname="Schooler">
            <organization></organization>
          </author>

          <date month="June" year="2002" />
        </front>

        <seriesInfo name="RFC" value="3261" />
      </reference>

      <reference anchor="SMIME">
        <front>
          <title>S/MIME Version 3.1 Message Specification"</title>

          <author surname="Ramsdell" initials="B.">
            <organization></organization>
          </author>
          
          <author surname="Ramsdell" initials="B.">
            <organization></organization>
          </author>

          <date month="July" year="2004" />
        </front>

        <seriesInfo name="RFC" value="3851" />
        
      </reference>

      <reference anchor="RTP">
        <front>
          <title>RTP: A Transport Protocol for Real-Time Applications</title>

          <author initials="H." surname="Schulzrinne">
            <organization></organization>
          </author>

          <author initials="S." surname="Casner">
            <organization></organization>
          </author>

          <author initials="R." surname="Frederick">
            <organization></organization>
          </author>

          <author initials="V." surname="Jacobson">
            <organization></organization>
          </author>

          <date month="July" year="2003" />
        </front>

        <seriesInfo name="RFC" value="3550" />
      </reference>

      <reference anchor="KEYWORDS">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement
          Levels</title>

          <author initials="S." surname="Bradner">
            <organization></organization>
          </author>

          <date month="March" year="1997" />
        </front>

        <seriesInfo name="RFC" value="2119" />

        <seriesInfo name="BCP" value="14" />
      </reference>

      <reference anchor="MIME">
        <front>
          <title>Multipurpose Internet Mail Extensions (MIME)</title>

          <author initials="N." surname="Freed">
            <organization></organization>
          </author>

          <author initials="N." surname="Borenstein">
            <organization></organization>
          </author>

          <author initials="K." surname="Moore">
            <organization></organization>
          </author>

          <author initials="J." surname="Klensin">
            <organization></organization>
          </author>

          <author initials="J." surname="Postel">
            <organization></organization>
          </author>

          <date month="November" year="1996" />
        </front>

        <seriesInfo name="RFC" value="2045" />

        <seriesInfo name="RFC" value="2046" />

        <seriesInfo name="RFC" value="2047" />

        <seriesInfo name="RFC" value="2048" />

        <seriesInfo name="RFC" value="2049" />
      </reference>

      <reference anchor="TLS">
        <front>
          <title>The TLS Protocol</title>

          <author initials="T." surname="Dierks">
            <organization></organization>
          </author>

          <author initials="E." surname="Rescorla">
            <organization></organization>
          </author>

          <date month="August" year="2008" />
        </front>

        <seriesInfo name="RFC" value="5246" />
      </reference>

      <reference anchor="SDP">
        <front>
          <title>SDP: Session Description Protocol</title>

          <author initials="M." surname="Handley">
            <organization></organization>
          </author>

          <author initials="V." surname="Jacobson">
            <organization></organization>
          </author>
          
          <author initials="C." surname="Perkins">
            <organization></organization>
          </author>

          <date month="July" year="2006" />
        </front>

        <seriesInfo name="RFC" value="4566" />
      </reference>

      <reference anchor="MSCML">
        <front>
          <title>Media Server Control Markup Language</title>

          <author initials="J." surname="Van Dyke">
            <organization></organization>
          </author>

          <author initials="E." surname="Burger">
            <organization></organization>
          </author>

          <author initials="A." surname="Spitzer">
            <organization></organization>
          </author>

          <date month="Sep" year="2007" />
        </front>

        <seriesInfo name="RFC" value="5022" />
      </reference>

      <reference anchor="URLFETCH_BINARY">
        <front>
          <title>Extended URLFETCH for Binary and Converted Parts</title>
          
          <author initials="D." surname="Cridland">
            <organization></organization>
          </author>
          
          <date month="May" year="2009" />
        </front>
        
        <seriesInfo name="RFC" value="5524" />
      </reference>
      
      <reference anchor="ACCESSID">
        <front>
          <title>Internet Message Access Protocol (IMAP) - URL Access Identifier Extension</title>
          
          <author initials="N." surname="Cook">
            <organization></organization>
          </author>
          
          <date month="March" year="2009" />
        </front>
        
        <seriesInfo name="draft-ncook-urlauth-accessid-02.txt (Work in Progress)" value="" />
      </reference>

      <reference anchor="METADATA">
        <front>
          <title>IMAP METADATA Extension</title>
          
          <author initials="C." surname="Daboo">
            <organization>Apple</organization>
          </author>
          
          <date month="July" year="2008" />
        </front>
        
        <seriesInfo name="RFC" value="5464" />
      </reference>

      <reference anchor="ABNF">
        <front>
          <title>Augmented BNF for Syntax Specifications: ABNF</title>
          <author initials="D." surname="Crocker">
            <organization></organization>
          </author>

          <author initials="P." surname="Overell">
            <organization></organization>
          </author>

          <date month="Jan" year="2008" />

	</front>
        <seriesInfo name="RFC" value="5234" />
      </reference>
      
      <reference anchor="RFC3986">
        <front>
          <title>Generic URI Syntax</title>
          
          <author initials="T." surname="Berners-Lee">
            <organization></organization>
          </author>
          
          <author initials="R." surname="Fielding">
            <organization></organization>
          </author>
          
          <author initials="L." surname="Masinter">
            <organization></organization>
          </author>
          
          <date month="Jan" year="2005" />
	</front>
	<seriesInfo name="RFC" value="3986" />
      </reference>

      <reference anchor="ANONYMOUS">
        <front>
          <title>Anonymous SASL Mechanism
</title>
          
          <author initials="K." surname="Zeilenga">
            <organization>OpenLDAP Foundation</organization>
          </author>
          
          <date month="June" year="2006" />
	</front>
	<seriesInfo name="RFC" value="4505" />
      </reference>


    </references>
    <references title="Informative References">

      <reference anchor="BURL">
        <front>
          <title>Message Submission BURL Extension</title>
          
          <author initials="C." surname="Newman">
            <organization></organization>
          </author>
          
          <date month="May" year="2006" />
        
	</front>
	<seriesInfo name="RFC" value="4468" />

      </reference>
      
    </references>
  </back>
</rfc>