<?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>Jingle DTMF</title>
  <abstract>This specification defines an XML format for encapsulating Dual Tone Multi-Frequency (DTMF) events in informational messages sent within the context of Jingle audio sessions, e.g. to be used in the context of Interactive Voice Response (IVR) systems. Note well that this format is not to be used in the context of RTP sessions, where native RTP methods are to be used instead.</abstract>
  &LEGALNOTICE;
  <number>0181</number>
  <status>Experimental</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0166</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>NOT_YET_ASSIGNED</shortname>
  &stpeter;
  &seanegan;
  <revision>
    <version>0.11</version>
    <date>2008-09-23</date>
    <initials>psa</initials>
    <remark><p>Clarified that use of this protocol is discouraged for RTP-aware applications and is designed only for communication with endpoints that do not support RTP.</p></remark>
  </revision>
  <revision>
    <version>0.10</version>
    <date>2008-05-30</date>
    <initials>psa</initials>
    <remark><p>Simplified syntax by removing button-down and button-up actions (all actions are assumed to be button-down) and setting 100ms default value for duration.</p></remark>
  </revision>
  <revision>
    <version>0.9</version>
    <date>2008-04-18</date>
    <initials>psa</initials>
    <remark><p>Removed negotiation flow so that this specification describes only the XMPP transport of DTMF events; added error flows to be used if the code is not understood or if a non-XMPP method is preferred.</p></remark>
  </revision>
  <revision>
    <version>0.8</version>
    <date>2008-03-20</date>
    <initials>psa</initials>
    <remark><p>Clarified negotiation flow; added payload-types per RFC 4733.</p></remark>
  </revision>
  <revision>
    <version>0.7</version>
    <date>2007-11-27</date>
    <initials>psa</initials>
    <remark><p>Editorial review and consistency check; corrected the schema.</p></remark>
  </revision>
  <revision>
    <version>0.6</version>
    <date>2007-06-20</date>
    <initials>psa</initials>
    <remark><p>Corrected several errors and updated to reflect changes to core Jingle spec.</p></remark>
  </revision>
  <revision>
    <version>0.5</version>
    <date>2006-12-21</date>
    <initials>psa</initials>
    <remark><p>Defined schema for error namespace; modified spec to use provisional namespace before advancement to Draft (per XEP-0053).</p></remark>
  </revision>
  <revision>
    <version>0.4</version>
    <date>2006-10-31</date>
    <initials>se/psa</initials>
    <remark><p>Specified error handling and service discovery.</p></remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2006-07-12</date>
    <initials>se/psa</initials>
    <remark><p>Updated syntax to use action and code attributes rather than tone element in order to provide real-time interaction; specified how to negotiate use of the RFC 4733 format via content-info messages.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2006-06-29</date>
    <initials>psa</initials>
    <remark><p>Allowed characters A, B, C, and D; updated schema.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2006-03-23</date>
    <initials>psa</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2006-03-21</date>
    <initials>psa</initials>
    <remark>First draft.</remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>Traditional telephony systems such as the public switched telephone network (PSTN) use Dual Tone Multi-Frequency (DTMF) events for dialing and to issue commands such as those used in interactive voice response (IVR) applications. Internet telephony systems also use DTMF tones, usually for interoperability with the PSTN but sometimes also in native Internet services.</p>
  <p>XMPP applications that use &xep0166; and the Real-time Transport Protocol (&rfc3550;) for voice chat as described in &xep0167; MUST support and prefer native RTP methods of communicating DTMF information, in particular the "audio/telephone-event" and "audio/tone" media types. Such applications SHOULD NOT use the protocol described herein for communicating DTMF information with RTP-aware endpoints.</p>
  <p>However, XMPP applications MAY support and use the protocol described herein for communicating DTMF information with endpoints that are not RTP-aware, such as gateways to the PSTN.</p>
</section1>
<section1 topic='Format' anchor='format'>
  <p>The format for the representation of DTMF events over XMPP is as follows &VNOTE;:</p>
  <code><![CDATA[
<dtmf xmlns='urn:xmpp:jingle:dtmf:0'
      code='0-9,#,*,A-D'
      duration='milliseconds'
      volume='0-63'/>
  ]]></code>
  <p>The &lt;dmtf/&gt; element MUST be empty.</p>
  <p>The attributes of the &lt;dmtf/&gt; element are as follows.</p>
  <table caption='Defined Attributes'>
    <tr>
      <th>Attribute</th>
      <th>Definition</th>
      <th>Example</th>
      <th>Inclusion</th>
    </tr>
    <tr>
      <td>code</td>
      <td>The tone to be generated. The value of the 'code' attribute SHOULD be one the following characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, #, and * (however, the characters A, B, C, and D MAY be sent as well <note>Although A, B, C, and D were originally defined as part of DTMF, they were never deployed to telephony consumers and were used only for control purposes at private branch exchanges (PBXs) and central office operator stations; however, they are used in certain non-telephony applications of DTMF, such as ham radio.</note>).</td>
      <td>#</td>
      <td>REQUIRED</td>
    </tr>
    <tr>
      <td>duration</td>
      <td>The duration of the event, in milliseconds, expressed as a non-negative integer. The receiver SHOULD ignore the event if the value is zero. The default value is 100 (i.e., 100ms).</td>
      <td>400</td>
      <td>RECOMMENDED</td>
    </tr>
    <tr>
      <td>volume</td>
      <td>The power level of the tone, expressed in dBm0 after dropping the sign. Power levels range from 0 to -63 dBm0. Thus, a larger value denotes a lower volume.</td>
      <td>37</td>
      <td>OPTIONAL</td>
    </tr>
  </table>
  <p>The &lt;dtmf&gt; element SHOULD be sent as the payload of a Jingle session-info message as illustrated in the following example.</p>
  <example caption="Entity sends DTMF message"><![CDATA[
<iq from='juliet@capulet.com/balcony'
    id='dtmf1'
    to='ivr.shakespeare.lit'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:0'
          action='session-info'
          initiator='juliet@capulet.com/balcony'
          sid='a73sjjvkla37jfea'>
    <dtmf xmlns='urn:xmpp:jingle:dtmf:0'
          code='7'
          duration='400'
          volume='42'/>
  </jingle>
</iq>
  ]]></example>
  <p>The receiving entity MUST send an IQ result if it can process the DTMF:</p>
  <example caption="Receiving entity acknowledges DTMF message"><![CDATA[
<iq from='ivr.shakespeare.lit'
    id='dtmf1'
    to='juliet@capulet.com/balcony'
    type='result'/>
  ]]></example>
  <p>If the receiving entity does not support this protocol, it MUST return a &unavailable; stanza error.</p>
  <example caption="Receiving entity does not support DTMF protocol"><![CDATA[
<iq from='ivr.shakespeare.lit'
    id='dtmf1'
    to='juliet@capulet.com/balcony'
    type='error'>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
  ]]></example>
  <p>If the receiving entity does not understand the specified code, it MUST return a &feature; stanza error.</p>
  <example caption="Receiving does not understand code"><![CDATA[
<iq from='ivr.shakespeare.lit'
    id='dtmf1'
    to='juliet@capulet.com/balcony'
    type='error'>
  <error type='cancel'>
    <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
  ]]></example>
  <p>If the receiving entity is using or wishes to use a different method for exchanging DTMF events (e.g., the methods specified in &rfc2833; or its successor &rfc4733;), it MUST return a &notacceptable; stanza error.</p>
  <example caption="Receiving prefers non-XMPP DTMF method"><![CDATA[
<iq from='ivr.shakespeare.lit'
    id='dtmf1'
    to='juliet@capulet.com/balcony'
    type='error'>
  <error type='cancel'>
    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
  ]]></example>
</section1>

<section1 topic='Determining Support' anchor='support'>
  <p>If an entity supports Jingle DTMF (i.e., sending of DTMF in the XMPP signalling channel as specified herein), it MUST return a &xep0030; feature of "urn:xmpp:jingle:dtmf:0" in response to service discovery information requests.</p>
  <p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
</section1>

<section1 topic='Security Considerations' anchor='security'>
  <p>This document introduces no known security vulnerabilities.</p>
</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='Protocol Namespaces' anchor='registrar-ns'>
    <p>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:jingle:dtmf:0</li>
    </ul>
    <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  </section2>
  <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
    <p>If the protocol defined in this specification undergoes a major revision that is not fully backward-compatible with an older version, or that contains significant new features, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
  </section2>
</section1>

<section1 topic='XML Schema' anchor='schema'>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:jingle:dtmf:0'
    xmlns='urn:xmpp:jingle:dtmf:0'
    elementFormDefault='qualified'>

  <xs:element name='dtmf'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='code'
                        type='DTMFString'
                        use='required'/>
          <xs:attribute name='duration'
                        type='xs:nonNegativeInteger'
                        use='optional'
                        default='100'/>
          <xs:attribute name='volume'
                        type='VolumeDigit'
                        use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="DTMFString">
    <xs:restriction base="xs:string">
      <xs:pattern value="(#|\*|0|1|2|3|4|5|6|7|8|9|A|B|C|D)*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="VolumeDigit">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="63"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
  ]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
  <p>Thanks to Diana Cionoiu, Olivier Cr&#234;te, Robert McQueen, and Paul Witty for their feedback. Several sentences were borrowed from <cite>RFC 4733</cite>.</p>
</section1>
</xep>
