SIPPING                                                        E. Burger
Internet-Draft                               Brooktrout Technology, Inc.
Expires: January 13, 2005                                       M. Dolly
                                                               AT&T Labs
                                                           July 15, 2004


    A Session Initiation Protocol (SIP) Event Package for Key Press
                            Stimulus (KPML)
                       draft-ietf-sipping-kpml-04

Status of this Memo

   This document is an Internet-Draft and is subject to all provisions
   of section 3 of RFC 3667.  By submitting this Internet-Draft, each
   author represents that any applicable patent or other IPR claims of
   which he or she is aware have been or will be disclosed, and any of
   which he or she become aware will be disclosed, in accordance with
   RFC 3668.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as
   Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at http://
   www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on January 13, 2005.

Copyright Notice

   Copyright (C) The Internet Society (2004).  All Rights Reserved.

Abstract

   The Key Press Stimulus Event Package is a component of the
   Applications Interaction Framework for the Session Initiation
   Protocol (SIP).  The event package defines a Key Press Markup
   Language (KPML) that describes filter specifications for reporting
   key presses entered at a presentation-free user interface SIP User



Burger & Dolly          Expires January 13, 2005                [Page 1]


Internet-Draft                    KPML                         July 2004


   Agent (UA).  The scope of this package is for collecting supplemental
   key presses or mid-call key presses (triggers).

   This capability allows an Application Server service provider to
   monitor (filter) for a set of DTMF patterns at a SIP User Agent,
   either at an end user device or a gateway.  The capability eliminates
   the need for hairpinning through a Media Server or duplicating all
   the DTMF events, when an Application Server needs to trigger mid-call
   service processing on DTMF digit patterns.

Conventions used in this document

   RFC2119 [1] provides the interpretations for the key words "MUST",
   "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
   "RECOMMENDED", "MAY", and "OPTIONAL" found in this document.

   The Application Interaction Framework [23] provides the
   interpretations for the terms "User Device", "SIP Application", and
   "User Input".  This document uses the term "Application" and
   "Requesting Application" interchangeably with "SIP Application".

   The Application Interaction Framework discusses User Device Proxies.
   A common instantiation of a User Device Proxy is a Public-Switched
   Telephone Network (PSTN) gateway.  Because the normative behavior of
   a presentation-free user interface is identical for a
   presentation-free SIP User Agent and a presentation-free User Device
   Proxy, this document uses "User Device" for both cases.
























Burger & Dolly          Expires January 13, 2005                [Page 2]


Internet-Draft                    KPML                         July 2004


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  5
     1.1   Protocol Translation Needs . . . . . . . . . . . . . . . .  6
     1.2   Complex Call Control . . . . . . . . . . . . . . . . . . .  6
   2.  Key Press Stimulus Operation . . . . . . . . . . . . . . . . .  8
     2.1   Model  . . . . . . . . . . . . . . . . . . . . . . . . . .  8
     2.2   Stream to Monitor  . . . . . . . . . . . . . . . . . . . . 10
     2.3   Operation  . . . . . . . . . . . . . . . . . . . . . . . . 10
   3.  Event Package Operation  . . . . . . . . . . . . . . . . . . . 11
     3.1   Event Package Name . . . . . . . . . . . . . . . . . . . . 11
     3.2   Event Package Parameters . . . . . . . . . . . . . . . . . 12
     3.3   SUBSCRIBE Bodies . . . . . . . . . . . . . . . . . . . . . 13
     3.4   Subscription Duration  . . . . . . . . . . . . . . . . . . 13
     3.5   NOTIFY Bodies  . . . . . . . . . . . . . . . . . . . . . . 14
     3.6   Notifier Processing of SUBSCRIBE Requests  . . . . . . . . 14
     3.7   Notifier Generation of NOTIFY Requests . . . . . . . . . . 15
       3.7.1   SIP Protocol-Generated . . . . . . . . . . . . . . . . 15
       3.7.2   Match  . . . . . . . . . . . . . . . . . . . . . . . . 15
       3.7.3   Inter-Digit Timeout No Match . . . . . . . . . . . . . 16
       3.7.4   Dialog Terminated  . . . . . . . . . . . . . . . . . . 16
       3.7.5   Dialog Not Present . . . . . . . . . . . . . . . . . . 17
       3.7.6   Bad Document . . . . . . . . . . . . . . . . . . . . . 17
       3.7.7   One-Shot vs. Persistent Requests . . . . . . . . . . . 17
     3.8   Subscriber Processing of NOTIFY Requests . . . . . . . . . 18
       3.8.1   No KPML Body . . . . . . . . . . . . . . . . . . . . . 18
       3.8.2   KPML Body  . . . . . . . . . . . . . . . . . . . . . . 18
     3.9   Handling of Forked Requests  . . . . . . . . . . . . . . . 18
     3.10  Rate of Notifications  . . . . . . . . . . . . . . . . . . 18
     3.11  State Agents . . . . . . . . . . . . . . . . . . . . . . . 19
   4.  Message Format - KPML  . . . . . . . . . . . . . . . . . . . . 19
     4.1   KPML Request . . . . . . . . . . . . . . . . . . . . . . . 19
       4.1.1   User Input Buffer Behavior . . . . . . . . . . . . . . 19
       4.1.2   Pattern Matching . . . . . . . . . . . . . . . . . . . 21
       4.1.3   Digit Suppression  . . . . . . . . . . . . . . . . . . 24
       4.1.4   One-Shot and Persistent Triggers . . . . . . . . . . . 26
       4.1.5   Multiple Patterns  . . . . . . . . . . . . . . . . . . 26
       4.1.6   Monitoring Direction . . . . . . . . . . . . . . . . . 27
       4.1.7   Multiple, Simultaneous Subscriptions . . . . . . . . . 27
     4.2   KPML Reports . . . . . . . . . . . . . . . . . . . . . . . 28
       4.2.1   Pattern Match Reports  . . . . . . . . . . . . . . . . 28
       4.2.2   KPML No Match Reports  . . . . . . . . . . . . . . . . 29
   5.  DRegex . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
     5.1   Overview . . . . . . . . . . . . . . . . . . . . . . . . . 29
     5.2   Operation  . . . . . . . . . . . . . . . . . . . . . . . . 31
   6.  Formal Syntax  . . . . . . . . . . . . . . . . . . . . . . . . 32
     6.1   DRegex . . . . . . . . . . . . . . . . . . . . . . . . . . 32
     6.2   KPML Request . . . . . . . . . . . . . . . . . . . . . . . 32



Burger & Dolly          Expires January 13, 2005                [Page 3]


Internet-Draft                    KPML                         July 2004


     6.3   KPML Response  . . . . . . . . . . . . . . . . . . . . . . 35
   7.  Enumeration of KPML Status Codes . . . . . . . . . . . . . . . 36
   8.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 37
     8.1   SIP Event Package Registration . . . . . . . . . . . . . . 37
     8.2   MIME Media Type application/kpml-request+xml . . . . . . . 37
     8.3   MIME Media Type application/kpml-response+xml  . . . . . . 38
     8.4   URN Sub-Namespace Registration for
           urn:ietf:xml:ns:kpml-request . . . . . . . . . . . . . . . 38
     8.5   URN Sub-Namespace Registration for
           urn:ietf:xml:ns:kpml-response  . . . . . . . . . . . . . . 39
     8.6   KPML Request Schema Registration . . . . . . . . . . . . . 40
     8.7   KPML Response Schema Registration  . . . . . . . . . . . . 40
   9.  Security Considerations  . . . . . . . . . . . . . . . . . . . 40
   10.   Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 41
     10.1  Monitoring for Octothorpe  . . . . . . . . . . . . . . . . 41
     10.2  Dial String Collection . . . . . . . . . . . . . . . . . . 41
   11.   Call Flow Examples . . . . . . . . . . . . . . . . . . . . . 42
     11.1  Supplemental Digits  . . . . . . . . . . . . . . . . . . . 42
     11.2  Multiple Applications  . . . . . . . . . . . . . . . . . . 46
   12.   References . . . . . . . . . . . . . . . . . . . . . . . . . 54
   12.1  Normative References . . . . . . . . . . . . . . . . . . . . 54
   12.2  Informative References . . . . . . . . . . . . . . . . . . . 55
       Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 56
   A.  Contributors . . . . . . . . . . . . . . . . . . . . . . . . . 57
   B.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 57
       Intellectual Property and Copyright Statements . . . . . . . . 59

























Burger & Dolly          Expires January 13, 2005                [Page 4]


Internet-Draft                    KPML                         July 2004


1.  Introduction

   This document describes the Key Press Stimulus Event Package.  The
   Key Press Stimulus Package is a SIP Event Notification Package [5]
   that uses the SUBSCRIBE and NOTIFY methods of SIP.  The subscription
   filter and notification report bodies use the Keypad Markup Language,
   KPML.  KPML is a markup [21] that enables presentation-free user
   interfaces as described in the Application Interaction Framework
   [23].

   In particular, KPML enables "dumb phones" and gateways to dumb phones
   to report user key-press events.  Colloquially, this mechanism
   provides for "digit reporting" or "Dual-Tone Multi-Frequency (DTMF)
   reporting."

   A goal of KPML is to fit in an extremely small memory and processing
   footprint.

   The name of the markup, KPML, reflects its legacy support role.  The
   public switched telephony network (PSTN) accomplished end-to-end
   signaling by transporting DTMF tones in the bearer channel.  This is
   in-band signaling.

   Voice-over-IP networks transport in-band signaling with actual DTMF
   waveforms or RFC2833 [12] packets.  In RFC2833, the signaling
   application inserts RFC2833 named signal packets as well as or
   instead of generating tones in the media path.  The receiving
   application gets the signal information in the media stream.

   RFC2833 correlates the time the end user pressed a digit with the
   user's media.  However, out-of-band signaling methods, as are
   appropriate for User Device to application signaling, do not need
   millisecond accuracy.  On the other hand, they do need reliability,
   which RFC2833 does not provide.

   RFC2833 tones are ideal for conveying telephone-events point-to-point
   in an RTP stream, as in the context of straightforward sessions like
   a 2-party call or simple, centrally mixed conference.  However, there
   are other environments where additional or alternative requirements
   are needed.  These other environments include protocol translation
   and complex call control.

   An interested application could request notifications of every key
   press.  However, many of the use cases for such signaling has the
   application interested in only one or a few keystrokes.  Thus we need
   a mechanism for specifying to the User Device what stimulus the
   application would like notification of.




Burger & Dolly          Expires January 13, 2005                [Page 5]


Internet-Draft                    KPML                         July 2004


1.1  Protocol Translation Needs

   Protocol translators between SIP and other IP protocols which use
   RTP, especially H.323 [18], are frequently implemented as a
   signaling-only entity which arranges for RTP media streams to travel
   directly between the final endpoints.  This is an efficient
   arrangement in terms of limiting jitter and latency in the media, and
   allows the translator to support many more simultaneous sessions than
   if the translator terminated media as well.

   Protocol translators may receive telephony-related events (especially
   signaled digits) via signaling.  Likewise, a SIP 3pcc[10] controller,
   or a protocol translator which uses a traditional CTI (Computer
   Telephony Integration) protocol for control (ex: TAPI, TSAPI, JTAPI),
   may receive CTI commands to "insert" digits which may have originated
   from another application (for example, a desktop call control
   application).  As the protocol translator or controller are not in
   the RTP path, it will want to send SIP signaled digits.

   RTP implementations must be able to receive media from more than one
   source on the same receive port, so it would seem straightforward to
   send RTP to the target User Agent.  This proposal has two problems
   however.  If the target translator and SIP User Agent are separated
   by a firewall, then it is likely that this traffic from a different
   IP address will be discarded.

   It is also unlikely that most low-end RTP implementations (IP phones,
   and software User Agents) will render this additional media
   correctly.  What is more problematic is that there is no mechanism to
   determine if a SIP User Agent can properly insert telephony events
   received in an RTP stream separate from their other audio media.

   This issue is particularly apparent for H.323-SIP interworking
   scenarios where the H.323 network signals digits in the signaling
   plane using H.245 [19].  Ideally, a protocol translator should be
   able to signal the H.323 digits in the SIP network in the signaling
   plane, as well.

1.2  Complex Call Control

   Some applications are interested in the telephony signals represented
   by telephony tones, but do not desire to be a party to the speech
   portion of the audio media.  This document addresses the transport
   requirements of these signals in this context.  Synchronizing speech
   is a non-issue in these topologies, as there is no audio media with
   which to synchronize; and SIP provides its own reliability mechanism
   to prevent loss.




Burger & Dolly          Expires January 13, 2005                [Page 6]


Internet-Draft                    KPML                         July 2004


   For example, in some application scenarios, a user contacts an
   application, places a new call in the context of the application (an
   "outcall"), and returns to the application after the new call is
   finished.  Examples of such scenarios include: Calling card systems,
   Voicemail or Messaging systems which allows outgoing calls, and Voice
   Browsers or Voice Portals which allow outgoing calls.

   All of these applications require a way for the user to get back to
   the application if something has gone wrong with the outgoing call
   (ex: wrong number), or if the user changes his or her mind.  If the
   originating user is using a TDM telephone, or a simple IP endpoint,
   the application will typically expect a sequence of signaled digits
   (ex: a pound or hash (#) of long duration, three stars (*) in a row,
   etc.)

                    +-------------+
                    |             |
                    | Originating |
                    |    User     |
                    |             |
                    +-------------+
                     |         ^ ^
                               | |
              NOTIFY |     SIP | | RTP
                               | |
                     |         | |
                     v         v v
         +-------------+      +-------------+
         |             |      |             |
         | Waiting for |      | Target User |
         |   trigger   |      |  or Service |
         |             |      |             |
         +-------------+      +-------------+

   Below are several possible SIP topologies that would enable this type
   of behavior.  Most of these approaches fall into two categories: the
   application could receive DTMF media corresponding to the signaled
   digits, or it could receive the signaled digits using SIP.

   Below are three approaches to encoding this information as media.
   None of these approaches are very attractive.
   o  The application could relay all the media itself.  This wastes
      network resources and is inefficient for the application.
   o  The application could setup a conference and INVITE itself to the
      conference.  This method requires setting up a complex set of call
      legs and wastes network and conferencing resources.  It also
      requires that the application verify that the tone media
      originated exclusively from desired source, which may be



Burger & Dolly          Expires January 13, 2005                [Page 7]


Internet-Draft                    KPML                         July 2004


      impossible.
   o  The application could request "forked-media" (multi-unicast) from
      RFC3264 [13] of just the RFC2833 media.  While the best
      media-related proposal, this method requires rather complex
      functionality in the "forking" UAs; requires 3pcc, and is
      problematic for firewalls because of the complexity of the SDP
      session description from RFC2327 [10]].  Also, experience at
      interoperability tests shows that most current SDP implementations
      are much less robust than their SIP counterparts.

2.  Key Press Stimulus Operation

2.1  Model

   The Key Press Stimulus reporting model is that key presses, or
   detected digits, are events at the User Device.  The subscription
   installs an event filter.  That event filter specifies the User Input
   strings, for which, if matched, causes the User Device to send a
   notification.

   There are three usage models for the event package.  Functionally,
   they are equivalent.  However, it is useful to understand the use
   cases.

   The principal model is that of a third-party application that is
   interested in the User Input.  Figure 2 shows an established SIP
   dialog between the User Device and a SIP UA.  The Requesting
   Application addresses the particular media stream (From RTP [9] port
   B to RTP port Y) by referencing the dialog identifier referring to
   the dialog between SIP ports A and X.





















Burger & Dolly          Expires January 13, 2005                [Page 8]


Internet-Draft                    KPML                         July 2004


                 +-------------+
                 | Requesting  |
             /---| Application |
            /    +-------------+
           /
      SIP / (SUBSCRIBE/NOTIFY)
         /
        /
   +---M----+    SIP (INVITE)    +-----+
   |        A--------------------X     |
   |  User  |                    | SIP |
   | Device |        RTP         | UA  |
   |        B--------------------Y     |
   +--------+                    +-----+

                      Figure 2: Third-Party Model

   The second scenario is when the Application is co-resident with the
   remote SIP User Agent (UA).  Note the application creates a separate,
   SUBSCRIBE-initiated dialog, as diagrammed in Figure 3.  This scenario
   represents, for example, a toll by-pass situation where the User
   Device is an ingress gateway and the SIP UA is an egress gateway.

   +--------+    SIP (INVITE)    +-----+
   |        A--------------------X SIP |
   |        |   SIP (SUBSCRIBE)  | UA  |
   |  User  A'-------------------X'    |
   | Device |        RTP         |(App)|
   |        B--------------------Y     |
   +--------+                    +-----+

                        Figure 3: Endpoint Model

   The third model is that of a User Device Proxy, as described by App
   Interaction [23].  The User Device in Figure 4 is a media relay in
   the terminology of RFC1889 [9].  However, in addition to the RTP
   forwarding capability of a RFC1889 media relay, the media proxy can
   also do light media processing, such as tone detection, tone
   transcoding (tones to RFC2833 [12]), and so on.

   The Requesting Application uses dialog identifiers to identify the
   stream to monitor.  The default is to monitor the media entering the
   User Device.  For example, if the Requesting Application in Figure 4
   refers to the dialog represented by SIP ports V-C, then the media
   coming from SIP UAa RTP port W gets monitored.  Likewise, the dialog
   represented by A-X directs the User Device to monitor the media
   coming from SIP UAb RTP Port Y.




Burger & Dolly          Expires January 13, 2005                [Page 9]


Internet-Draft                    KPML                         July 2004


                                            +-------------+
                                            | Requesting  |
                                        /---| Application |
                                       /    +-------------+
                                      /
                                 SIP / (SUBSCRIBE/NOTIFY)
                                    /
                                   /
   +-----+        SIP         +---M----+        SIP         +-----+
   |     V--------------------C        A--------------------X     |
   | SIP |                    |  User  |                    | SIP |
   | UAa |        RTP         | Device |        RTP         | UAb |
   |     W--------------------D        B--------------------Y     |
   +-----+                    +--------+                    +-----+

                      Figure 4: Media Proxy Model


2.2  Stream to Monitor

   The default media stream to monitor is the stream represented by the
   first m= line of the SDP referenced by the dialog with the local tag
   of the SIP dialog at the monitoring User Device.  The User Device MAY
   offer other streams for monitoring.  One possibility is the remote
   stream representing the state of the device at the other end of the
   SIP dialog.

   The User Device MUST be able to report on local User Input.  In the
   case where the User Device is a gateway, that is, it is a User Device
   Proxy, local User Input is the media stream that emanates from the
   User Device.

   If the requesting application wishes to monitor multiple streams at a
   given User Device, the application MUST establish multiple
   subscriptions, one for each stream.

2.3  Operation

   The Key Press Stimulus Event Package uses explicit subscription
   notification requests, using the SUBSCRIBE/NOTIFY [5] mechanism.

   The User Device MUST return a Contact URI that has GRUU [26]
   properties in the Contact header of a SIP INVITE, 1xx, or 2xx
   response.

   Following the semantics of SUBSCRIBE, if the User Device receives a
   second subscription on the same dialog, including id, if present, the
   User Device MUST terminate the existing KPML subscription and replace



Burger & Dolly          Expires January 13, 2005               [Page 10]


Internet-Draft                    KPML                         July 2004


   it with the new subscription.

   An Application MAY register multiple User Input patterns in a single
   KPML subscription.

   If the User Device supports multiple, simultaneous KPML
   subscriptions, the Application installs the subscriptions either in a
   new SUBSCRIBE-initiated dialog or on an existing SUBSCRIBE-initiated
   dialog with a new event id tag.

   If the User Device does not support multiple, simultaneous KPML
   subscriptions, the User Device MUST respond with a KPML status code.

   A KPML subscription can be persistent or one-shot.  Persistent
   requests are active until either the dialog terminates, including
   normal subscription expiration, the Application replaces them, the
   Application deletes them by sending a null document on the dialog, or
   the Application deletes the subscription by sending a SUBCRIBE with
   an expires of zero (0).

   Standard SUBSCRIBE processing dictates the User Device sends a NOTIFY
   response if it receives a SUBSCRIBE with an expires of zero.

   One-shot requests terminate themselves once a match occurs.  The
   "persist" KPML element specifies whether the subscription remains
   active for the duration specified in the SUBSCRIBE message or if it
   automatically terminates after a pattern matches.

   KPML subscriptions route to the User Device using standard SIP
   request routing.  A KPML subscription identifies the media stream by
   referencing its dialog identifiers.

   Notifications are KPML documents.  If the User Device matched a digit
   map, the response indicates the User Input detected and whether the
   User Device suppressed User Input.  If the User Device had an error,
   such as a timeout, it will indicate that instead.

3.  Event Package Operation

   The following sub-sections are the formal specification of the KPML
   SIP-specific event notification package.

3.1  Event Package Name

   The name for the Key Press Stimulus Event Package is "kpml".






Burger & Dolly          Expires January 13, 2005               [Page 11]


Internet-Draft                    KPML                         July 2004


3.2  Event Package Parameters

   SIP identifies dialogs by their dialog identifier.  The dialog
   identifier is the remote-tag, local-tag, and Call-ID entities.

   To identify a specific dialog, all three of these parameters MUST be
   present.  Usually, the local-tag is the To: entity with the To tag,
   the remote-tag is the From: entity including tag, and the call-id
   matches the Call-ID.

   There may be ambiguity in specifying only the SIP dialog to monitor.
   The dialog may specify multiple SDP streams that could carry key
   press events.  For example, a dialog may have multiple audio streams.
   Wherever possible, the User Device MAY apply local policy to
   disambiguate which stream or streams to monitor.  In order to have an
   extensible mechanism for identifying streams, the mechanism for
   specifying streams is as an element content to the <stream> tag.  The
   only content defined today is the <stream>reverse</stream> tag.

   For most situations, such as a monaural point-to-point call with a
   single codec, the stream to monitor is obvious.  In such situations
   the Application need not specify which stream to monitor.

   The BNF for these parameters is as follows.  The definitions of
   callid, token, EQUAL, and DQUOTE are from RFC3261 [4].

   call-id   =  "call-id" EQUAL DQUOTE callid DQUOTE
   from-tag  =  "from-tag" EQUAL token
   to-tag    =  "to-tag" EQUAL token

   The call-id parameter is a quoted string.  This is because the BNF
   for word (which is used by callid) allows for characters not allowed
   within token.  One usually just copies these elements from the
   Call-Id, to, and from fields of the SIP INVITE.

   One can use any method of determining the dialog identifier.  One
   method available, particularly for third-party applications, is the
   SIP Dialog Package [27].

   Figure 6 Shows a subscription that identifies the dialog labled with
   the To Tag "jfg777666bc", From Tag "002993bbcdc", and Call ID
   "12@example.com".  Note the pretty-printing.  The parameters to the
   kpml event go on the same line as the event specification.








Burger & Dolly          Expires January 13, 2005               [Page 12]


Internet-Draft                    KPML                         July 2004


   SUBSCRIBE sip:a-real-gruu@ud.example.net SIP/2.0
   From: <sip:app@example.com>;tag=023948asdcn
   To: <sip:a-real-gruu@ud.example.net>;tag=jfq498489qb
   Call-Id: 349f8jasdvn@example.com
   ...
   Event: kpml
          ; to-tag=jfg777666bc
          ; from-tag=002993bbcdc
          ; call-id=12@example.com
   ...

                     Figure 6: Identifying a Dialog


3.3  SUBSCRIBE Bodies

   KPML specifies key press event notification filters.  The MIME type
   for KPML requests is application/kpml-request+xml.

   The KPML request document MUST be well-formed and SHOULD be valid.
   KPML documents MUST conform to XML 1.0 [21] and MUST use UTF-8
   encoding.

   Because of the potentially sensitive nature of the information
   reported by KPML, subscribers SHOULD use sips: and SHOULD consider
   the use of S/MIME on the content.

   Subscribers MUST be prepared for the notifier to insist on
   authentication at a minimum and to expect encryption on the
   documents.

3.4  Subscription Duration

   The "persist" attribute to the <pattern> tag in the KPML subscription
   body affects the lifetime of the subscription.

   If the persist attribute is "one-shot", then once there is a match
   (or no match is possible), the subscription ends after the User
   Device notifies the Application.

   If the persist attribute is "persist" or "single-notify", then the
   subscription ends when the Application explicitly ends it or the User
   Device terminates the subscription.

   The subscription lifetime MUST NOT be longer than the negotiated
   expires time, per RFC3265 [5].

   The subscription lifetime should be longer than the expected call



Burger & Dolly          Expires January 13, 2005               [Page 13]


Internet-Draft                    KPML                         July 2004


   time.  The default subscription lifetime (Expires value) MUST be 7200
   seconds.

   Subscribers MUST be able to handle the User Device returning an
   Expires value smaller than the requested value.  Per RFC3265 [5], the
   subscription duration is the value returned by the User Device in the
   200 OK Expires entity.

3.5  NOTIFY Bodies

   KPML specifies the key press notification report format.  The MIME
   type for KPML reports is application/kpml-response+xml.  The default
   MIME type for the kpml event package is application/
   kpml-response+xml.

   If the requestor is not using a secure transport protocol such as TLS
   (e.g., by using a sips: URI), the User Device SHOULD use S/MIME to
   protect the user information in responses.

3.6  Notifier Processing of SUBSCRIBE Requests

   The user information transported by KPML is potentially sensitive.
   For example, it could include calling card or credit card numbers.
   Thus the first action of the User Device (notifier) SHOULD be to
   authenticate the requesting party.

   User Devices MUST support digest authentication at a minimum.

   User Devices MUST support the sips: scheme and TLS.

   Upon authenticating the requesting party, the User Device determines
   if the requesting party has authorization to monitor the user's key
   presses.  Determining authorization policies and procedures is beyond
   the scope of this specification.
      NOTE:  While it would be good to require both authorization and
      user notification for KPML, some uses, such as lawful intercept
      pen registers, have very strict authorization requirements yet
      have a requirement of no user notification.  Conversely, pre-paid
      applications running on a private network may have no
      authorization requirements and already have implicit user
      acceptance of key press monitoring.  Thus we cannot give any
      normative rules here.

   After authorizing the request (RECOMMENDED), the User Device checks
   to see if the request is to terminate a subscription.  If the request
   will terminate the subscription, the User Device does the appropriate
   processing, including the procedures described in Section 3.7.4.




Burger & Dolly          Expires January 13, 2005               [Page 14]


Internet-Draft                    KPML                         July 2004


   If the request has no KPML body, then any KPML document running on
   that dialog, and addressed by the event id, if present, immediately
   terminates.  This is a mechanism for unloading a KPML document while
   keeping the SUBSCRIBE-initiated dialog active.  This can be important
   for secure sessions that have high costs for session establishment,
   such as TLS.  The User Device follows the procedures described in
   Section 3.7.1.

   If the dialog referenced by the kpml subscription does not exist, the
   User Device follows the procedures in Section 3.7.5  Note the User
   Device MUST issue a 200 OK before issuing the NOTIFY, as the
   SUBSCRIBE itself is well-formed.

   If the request has a KPML body, the User Device parses the KPML
   document.  The User Device SHOULD validate the XML document against
   the schema presented in Section 6.2.  If the document is not valid,
   the User Device performs the procedures described in Section 3.7.6.
   If there is a loaded KPML document on the dialog (and given event id,
   if present), the User Device unloads the document.

   In addition, if there is a loaded KPML document on the dialog (with
   the given event id, if present), the end device unloads the document.

3.7  Notifier Generation of NOTIFY Requests

3.7.1  SIP Protocol-Generated

   The User Device (notifier in SUBSCRIBE/NOTIFY parlance) generates
   NOTIFY requests based on the requirements of RFC3265 [5].
   Specifically, unless a SUBSCRIBE request is not valid, all SUBSCRIBE
   requests will result in an immediate NOTIFY.

   The KPML payload distinguishes between a NOTIFY that RFC3265 mandates
   and a NOTIFY informing of key presses.  If there is no User Input
   buffered at the time of the SUBSCRIBE (see Section 4.1 below) or the
   buffered User Input does not match the new KPML document, then the
   immediate NOTIFY MUST NOT contain a KPML body.  If User Device has
   User Input buffered that result in a match using the new KPML
   document, then the NOTIFY MUST return the appropriate KPML document.

   All subscriptions MUST be authenticated, particularly  those that
   match on buffered input.

3.7.2  Match

   During the subscription lifetime, the User Device may detect a key
   press stimulus that triggers a KPML event.  In this case, the User
   Device (notifier) MUST return the appropriate KPML document.



Burger & Dolly          Expires January 13, 2005               [Page 15]


Internet-Draft                    KPML                         July 2004


3.7.3  Inter-Digit Timeout No Match

   Once a user starts to enter stimulus, it is highly likely they will
   enter all of the key presses of interest within a specific time
   period.  There is a temporal locality of reference for key presses.
   It is possible for users to accidentally press a key, however.
   Moreover, users may start pressing a key and then be lost as to what
   to do next.  For applications to handle this situation, KPML allows
   applications to request notification if the user starts to enter
   stimulus but then stops before a match.

   Once the User Device detects a key press that matches the first
   character of a digit map, the User Device starts the interdigit timer
   specified in the <pattern> tag.  Every subsequent key press detected
   restarts the interdigit timer.  If the interdigit timer expires, the
   User Device generates a KPML report with the KPML status code 423,
   Timer Expired.  The report also includes the User Input collected up
   to the time the timer expired.  This could be the null string.  After
   sending the NOTIFY, the User Device will resume quarantining
   additional detected User Input.

   Applications may have different requirements for the interdigit
   timer.  For example, applications targeted to user populations that
   tend to key in information slowly may require longer interdigit
   timers.  The specification of the interdigit timer is in
   milliseconds.  The default value is 4000, for 4 seconds.  A value of
   zero indicates disabling the interdigit timer.  The User Device MUST
   round up the requested interdigit timer to the nearest time increment
   it is capable of detecting.

3.7.4  Dialog Terminated

   It is possible for a dialog to terminate during key press collection.
   The cases enumerated here are explicit subscription termination,
   automatic subscription termination, and underlying (INVITE-initiated)
   dialog termination.

   If a SUBSCRIBE request has an expires of zero (explicit SUBSCRIBE
   termination), includes a KPML document, and there is buffered User
   Input, then the User Device attempts to process the buffered digits
   against the document.  If there is a match, the User Device MUST
   generate the appropriate KPML report with the KPML status code of
   200.  The SIP NOTIFY body terminates the subscription by setting the
   subscription state to "terminated" and a reason of "timeout".

   If the SUBSCRIBE request has an expires of zero and no KPML body or
   the expires timer on the SUBSCRIBE-initiated dialog fires at the User
   Device (notifier), then the User Device MUST issue a KPML report with



Burger & Dolly          Expires January 13, 2005               [Page 16]


Internet-Draft                    KPML                         July 2004


   the KPML status code 487, Subscription Expired.  The report also
   includes the User Input collected up to the time the expires timer
   expired or when the subscription with expires equal to zero was
   processed.  This could be the null string.

   Per the mechanisms of RFC3265 [5], the User Device MUST terminate the
   SIP SUBSCRIBE dialog.  The User Device does this via the SIP NOTIFY
   body transporting the final report described in the preceding
   paragraph.  In particular, the subscription state will be
   "terminated" and a reason of "timeout".

   Terminating the subscription when a dialog terminates ensures
   reauthorization (if necessary) for attaching to subsequent
   subscriptions.

3.7.5  Dialog Not Present

   If a SUBSCRIBE request references a dialog that is not present at the
   User Device, the User Device MUST generate a KPML report with the
   KPML status code 481, Dialog Not Found.  The User Device terminates
   the subscription by setting the subscription state to "terminated".

3.7.6  Bad Document

   If the KPML document is not valid, the User Device generates a KPML
   report with the KPML status code 501, Bad Document.  The User Device
   terminates the subscription by setting the subscription state to
   "terminated".

   If the document is valid but the User Device does not support a
   namespace in the document, the User Device MUST respond with a KPML
   status code 502, Namespace Not Supported.

3.7.7  One-Shot vs. Persistent Requests

   There are two types of subscriptions: one-shot and persistent.
   Persistent subscriptions have two sub-types: continuous notify and
   single-notify.

   One-shot subscriptions terminate after a pattern match and report.
   If the User Device detects a key press stimulus that triggers a
   one-shot KPML event, then the User Device (notifier) MUST set the
   "Subscription-State" in the NOTIFY message to "terminated".  At this
   point the User Device MUST consider the subscription destroyed.

   Persistent subscriptions remain active at the User Device, even after
   a match.  For continuous notify persistent subscriptions, the User
   Device will emit a notification whenever the User Input matches a



Burger & Dolly          Expires January 13, 2005               [Page 17]


Internet-Draft                    KPML                         July 2004


   pattern.  For single-notify persistent subscriptions, the User Device
   will emit a notification at the first match, but will not emit
   further notifications until the Application issues a new document on
   the subscription dialog.

      NOTE:  The single-notify persistent subscription enables lock-step
      (race-free) quarantining of User Input between different digit
      maps.

3.8  Subscriber Processing of NOTIFY Requests

3.8.1  No KPML Body

   If there is no KPML body, it means the SUBSCRIBE was successful.
   This establishes the dialog if there is no buffered User Input to
   report.

3.8.2  KPML Body

   If there is a KPML document, and the KPML status code is 200, then a
   match occurred.

   If there is a KPML document, and the KPML status code is 4xx, then an
   error occurred with User Input collection.  The most likely cause is
   a timeout condition.

   If there is a KPML document, and the KPML status code is 5xx, then an
   error occurred with the subscription.  See Section 7 for more on the
   meaning of KPML status codes.

   The subscriber MUST be mindful of the subscription state.  The User
   Device may terminate the subscription at any time.

3.9  Handling of Forked Requests

   The SUBSCRIBE behavior described in Section 3.6 ensures that it is
   only possible to have a subscription where there is an active (e.g.,
   voice) dialog.  Thus the case of multiple subscription installation
   cannot occur.

3.10  Rate of Notifications

   The User Device MUST NOT generate messages faster than 25 messages
   per second, or one message every 40 milliseconds.  This is the
   minimum time period for MF digit spills.  Even 30-millisecond DTMF,
   as one sometimes finds in Japan, has a 20-millisecond off time,
   resulting in a 50-millisecond interdigit time.  This document
   strongly RECOMMENDS AGAINST using KPML for digit-by-digit messaging,



Burger & Dolly          Expires January 13, 2005               [Page 18]


Internet-Draft                    KPML                         July 2004


   such as would be the case if the only <regex> is "x".

   The sustained rate of notification shall be no more than 100 Notifies
   per minute.

   The User Device MUST reliably deliver notifications.  Because there
   is no meaningful metric for throttling requests, the User Device
   SHOULD send NOTIFY messages over a congestion-controlled transport,
   such as TCP or SCTP.

   User Devices MUST at a minimum implement SIP over TCP.

3.11  State Agents

   Not applicable.

4.  Message Format - KPML

   The Key Press Markup Language (KPML) consists of two schemas, the
   kpml-request and kpml-response.

4.1  KPML Request

   A KPML request document contains a <pattern> element with a series of
   <regex> tags.  The <regex> element specifies a pattern for the User
   Device to report on.  Section 5 describes the DRegex, or digit
   regular expression, language.

4.1.1  User Input Buffer Behavior

   User Devices MUST NOT buffer USER input prior to an authenticated
   subscription, unless the INVITE establishing the dialog includes
   "Require: kpml".
      NOTE:  This is a first stab at some sort of programmatic method of
      starting buffering without buffering everything all the time.

   User Devices MUST buffer User Input upon receipt of an authenticated
   and accepted subscription.  Subsequent KPML documents apply their
   patterns against the buffered User Input.  Some applications use
   modal interfaces where the first few key presses determine what the
   following key presses mean.  For a novice user, the application may
   play a prompt describing what mode the application is in.  However,
   "power users" often barge through the prompt.

   KPML provides a <flush> tag in the <pattern> element.  The default is
   not to flush User Input.  Flushing User Input has the effect of
   ignoring key presses entered before the installation of the KPML
   subscription.  To flush User Input, include the tag



Burger & Dolly          Expires January 13, 2005               [Page 19]


Internet-Draft                    KPML                         July 2004


   <flush>yes</flush>
   in the KPML subscription document.  Note that this directive affects
   only the current subscription dialog/id combination.

   Lock-step processing of User Input is where the User Device issues a
   notification, the Application processes the notification while the
   User Device buffers additional User Input, the Application requests
   more User Input, and only then does the User Device notify the
   Application based on the collected User Input.  To direct the User
   Device to operate in lock-step mode, set the <pattern> attribute
   persist="single-notify".

   The User Device MUST be able to process <flush>no</flush>.  This
   directive is effectively a no-op.

   Other string values for <flush> may be defined in the future.  If the
   User Device receives a string it does not understand, it MUST treat
   the string as a no-op.

   If the user presses a key that cannot match any pattern within a
   <regex> tag, the User Device MUST discard all buffered key presses up
   to and including the current key press from consideration against the
   current or future KPML documents on a given dialog.  However, as
   described above, once there is a match, the User Device buffers any
   key presses the user entered subsequent to the match.

      NOTE:  This behavior allows for applications to only receive User
      Input that interest them.  For example, a pre-paid application
      only wishes to monitor for a long pound.  If the user enters other
      stimulus, presumably for other applications, the pre-paid
      application does not want notification of that User Input.  This
      feature is fundamentally different than the behavior of TDM-based
      equipment where every application receives every key press.

   To limit reports to only complete matches, set the "nopartial"
   attribute to the <pattern> tag to "true".  In this case, the User
   Device attempts to match a rolling window over the collected User
   input.

   KPML subscriptions are independent.  Thus it is not possible for the
   current document to know if a following document will enable barging
   or want User Input flushed.  Therefore, the User Device MUST buffer
   all User Input, subject to the forced_flush caveat described below.

   On a given SUBSCRIBE dialog with a given id, the User Device MUST
   buffer all User Input detected between the time of the report and the
   receipt of the next document, if any.  If the next document indicates
   a buffer flush, then the interpreter MUST flush all collected User



Burger & Dolly          Expires January 13, 2005               [Page 20]


Internet-Draft                    KPML                         July 2004


   Input from consideration from KPML documents received on that dialog
   with the given event id.  If the next document does not indicate
   flushing the buffered User Input, then the interpreter MUST apply the
   collected User Input (if possible) against the digit maps presented
   by the script's <regex> tags.  If there is a match, the interpreter
   MUST follow the procedures in Section 3.7.2.  If there is no match,
   the interpreter MUST flush all of the collected User Input.

   Given the potential for needing an infinite buffer for User Input,
   the User Device MAY discard the oldest User Input from the buffer.
   If the User Device discards digits, when the User Device issues a
   KPML notification, it MUST set the forced_flush attribute of the
   <response> tag to "true".  For future use, the Application MUST
   consider any non-null value, other than "false" that it does not
   understand, to be the same as "true".
      NOTE:  The requirement to buffer all User Input for the entire
      length of the session is not really onerous under normal
      operation.  For example, if one has a gateway with 8,000 sessions,
      and the gateway buffers 50 key presses on each session, the
      requirement is only 400,000 bytes, assuming one byte per key
      press.

   Unless there is a suppress indicator in the digit map, it is not
   possible to know if the User Input is for local KPML processing or
   for other recipients of the media stream.  Thus, in the absence of a
   suppression indicator, the User Device transmits the User Input to
   the far end in real time, using either RFC2833, generating the
   appropriate tones, or both.

   The section Digit Suppression (Section 4.1.3) describes the operation
   of the suppress indicator.

4.1.2  Pattern Matching

4.1.2.1  Inter-Digit Timing

   The pattern matching logic works as follows.  KPML User Devices MUST
   follow the logic presented in this section so that different
   implementations will perform deterministically on the same KPML
   document given the same User Input.

   The pattern match algorithm matches the longest regular expression.
   This is the same mode as H.248.1 [16] and not the mode presented by
   MGCP [15].  The pattern match algorithm choice has an impact on
   determining when a pattern matches.  Consider the following KPML
   document.





Burger & Dolly          Expires January 13, 2005               [Page 21]


Internet-Draft                    KPML                         July 2004


   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern>
       <regex>0</regex>
       <regex>011</regex>
     </pattern>
   </kpml-request>

                       Figure 8: Greedy Matching

   In Figure 8, if we were to match on the first found pattern, the
   string "011" would never match.  This happens because the "0" rule
   would match first.

   While this behavior is what most applications desire, it does come at
   a cost.  Consider the following KPML document snippet.

     <regex>x{7}</regex>
     <regex>x{10}</regex>

                       Figure 9: Timeout Matching

   Figure 9 is a typical North American dial plan.  From an application
   perspective, users expect a seven-digit number to respond quickly,
   not waiting the typical inter-digit critical timer (usually four
   seconds).  Conversely, the User does not want the system to cut off
   their ten-digit number at seven digits because they did not enter the
   number fast enough.

   One approach to this problem is to have an explicit dial string
   terminator.  Typically, it is the pound key (#).  Now, consider the
   following snippet.

   <regex>x{7}#</regex>
   <regex>x{10}#</regex>

                 Figure 10: Timeout Matching with Enter

   The problem with the approach in Figure 10 is that the digit
   collector will still look for a digit after the "#" in the
   seven-digit case.  Worse yet, the "#" will appear in the returned
   dial string.

   The approach used in KPML is to have an explicit "Enter Key", as



Burger & Dolly          Expires January 13, 2005               [Page 22]


Internet-Draft                    KPML                         July 2004


   shown in the following snippet.

   <pattern enterkey="#">
     <regex>x{7}</regex>
     <regex>x{10}</regex>
   </pattern>

               Figure 11: Timeout Matching with Enter Key

   In Figure 11, the enterkey attribute to the <pattern> tag specifies a
   string that terminates a pattern.  In this situation, if the user
   enters seven digits followed by the "#" key, the pattern matches (or
   fails) immediately.  KPML indicates a terminated nomatch with a KPML
   status code 402.
      NOTE:  The enterkey is a string.  The enterkey can be a sequence
      of key presses.

   To address the various key press collection scenarios, we define
   three timers.  The timers are the critical timer (criticaltimer), the
   inter-digit timer (interdigittimer), and the extra digit timer
   (extradigittimer).  The critical timer is the time to wait for
   another digit if the collected digits can match a pattern.  The extra
   timer is the time to wait after the longest match has occurred
   (presumably for the Enter key).  The inter-digit timer is the time to
   wait between digits in all other cases.  Note there is no start
   timer, as that concept does not apply in the KPML context.

   The User Device MAY support an inter-digit timeout value.  This is
   the amount of time the User Device will wait for User Input before
   returning a timeout error result on a partially matched pattern.  The
   application can specify the inter-digit timeout as an integer number
   of milliseconds by using the "interdigittimer" attribute to the
   <pattern> tag.  The default is 4000 milliseconds.  If the User Device
   does not support the specification of an inter-digit timeout, the
   User Device MUST silently ignore the specification.  If the User
   Device supports the specification of an inter-digit timeout, but not
   to the granularity specified by the value presented, the User Device
   MUST round up the requested value to the closest value it can
   support.

   The User Device MAY support an extra-digit timeout value.  This is
   the amount of time the User Device will wait for another key press
   when it already has a matched <regex>.  The application can specify
   the extra-digit timeout as an integer number of milliseconds by using
   the "extradigittimer" attribute to the <pattern> tag.  The default is
   500 milliseconds.

   The User Device MAY support a critical-digit timeout value.  This is



Burger & Dolly          Expires January 13, 2005               [Page 23]


Internet-Draft                    KPML                         July 2004


   the amount of time the User Device will wait for another key press
   when it already has a matched <regex> but there is another, longer
   <regex> that may also match the pattern.  The application can specify
   the critical-digit timeout as an integer number of milliseconds by
   using the "criticaldigittimer" attribute to the <pattern> tag.  The
   default is 1000 milliseconds.

4.1.2.2  Intra-Digit Timing

   Some patterns look for long duration key presses.  For example, some
   applications look for long "#" or long "*".

   KPML uses the "L" modifier to <regex> characters to indicate long key
   presses.  The following KPML document looks for a long pound of at
   least 3 seconds.

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern long="3000">
       <regex>L#</regex>
     </pattern>
   </kpml-request>

   The request can specify what constitutes "long" by setting the long
   attribute to the <pattern>.  This attribute is an integer
   representing the number of milliseconds.  If the user presses a key
   for longer than "long" milliseconds, the Long modifier is true.  The
   default length of the long attribute is 2500 milliseconds.

   Some User Devices are unable to present long key presses.  An example
   is an old private branch exchange (PBX) phone set that emits
   fixed-length tones when the user presses a key.  To address this
   issue, the User Device MAY interpret a success of a single key press
   to be equivalent to a long key press of the same key.  The
   Application indicates it wants this behavior by setting the
   "longrepeat" attribute tot he <pattern> to "true".

4.1.3  Digit Suppression

   Under basic operation, a KPML User Device will transmit in-band tones
   (RFC2833 [12] or actual tone) in parallel with User Input reporting.

      NOTE: If KPML did not have this behavior, then a User Device
      executing KPML could easily break called applications.  For



Burger & Dolly          Expires January 13, 2005               [Page 24]


Internet-Draft                    KPML                         July 2004


      example, take a personal assistant that uses "*9" for attention.
      If the user presses the "*" key, KPML will hold the digit, looking
      for the "9".  What if the user just enters a "*" key, possibly
      because they accessed an IVR system that looks for "*"?  In this
      case, the "*" would get held by the User Device, because it is
      looking for the "*9" pattern.  The user would probably press the
      "*" key again, hoping that the called IVR system just did not hear
      the key press.  At that point, the User Device would send both "*"
      entries, as "**" does not match "*9".  However, that would not
      have the effect the user intended when they pressed "*".

   On the other hand, there are situations where passing through tones
   in-band is not desirable.  Such situations include call centers that
   use in-band tone spills to effect a transfer.

   For those situations, KPML adds a suppression tag, "pre", to the
   <regex> tag.  There MUST NOT be more than one <pre> in any given
   <regex>.

   If there is only a single <pattern> and a single <regex>, suppression
   processing is straightforward.  The end-point passes User Input until
   the stream matches the regular expression <pre>.  At that point, the
   User Device will continue collecting User Input, but will suppress
   the generation or pass-through of any in-band User Input.

   If the User Device suppressed stimulus, it MUST indicate this by
   including the attribute "suppressed" with a value of "true" in the
   notification.

   Clearly, if the User Device is processing the KPML document against
   buffered User Input, it is too late to suppress the transmission of
   the User Input, as the User Device has long sent the stimulus.  This
   is a situation where there is a <pre> specification, but the
   "suppressed" attribute will not be "true" in the notification.  If
   there is a <pre> tag that the User Device matched and the User Device
   is unable to suppress the User Input, it MUST set the "suppressed"
   attribute to "false".

   A KPML User Device MAY perform suppression.  If it is not capable of
   suppression, it ignores the suppression attribute.  It MUST set the
   "suppressed" attribute to "false".  In this case, the pattern to
   match is the concatenated pattern of pre+value.

   At some point in time, the User Device will collect enough User Input
   to the point it hits a <pre> pattern.  The interdigittimer attribute
   indicates how long to wait once the user enters stimulus before
   reporting a time-out error.  If the interdigittimer expires, the User
   Device MUST issue a time-out report, transmit the suppressed User



Burger & Dolly          Expires January 13, 2005               [Page 25]


Internet-Draft                    KPML                         July 2004


   Input on the media stream, and stop suppression.

   Once the User Device detects a match and it sends a NOTIFY request to
   report the User Input, the User Device MUST stop suppression.
   Clearly, if subsequent User Input matches another <pre> expression,
   then the User Device MUST start suppression.

   After suppression begins, it may become clear that a match will not
   occur.  For example, take the expression
   <regex><pre>*8</pre>xxx[2-9]xxxxxx</regex>
   At the point the User Device receives "*8", it will stop forwarding
   stimulus.  Let us say that the next three digits are "408".  If the
   next digit is a zero or one, the pattern will not match.

      NOTE: It is critically important for the User Device to have a
      sensible inter-digit timer.  This is because an errant dot (".")
      may suppress digit sending forever.  See Section 4.1 for setting
      the inter-digit timer.

   Applications should be very careful to indicate suppression only when
   they are fairly sure the user will enter a digit string that will
   match the regular expression.  In addition, applications should deal
   with situations such as no-match or time-out.  This is because the
   User Device will hold digits, which will have obvious user interface
   issues in the case of a failure.

4.1.4  One-Shot and Persistent Triggers

   The KPML document specifies if the patterns are to be persistent by
   setting the "persist" attribute to the <pattern> tag to "persist" or
   "single-notify".  Any other value, including "one-shot", indicates
   the request is a one-shot subscription.  If the User Device does not
   support persistent subscriptions, it returns a KPML document with the
   KPML status code set to 531.  If there are digits in the buffer and
   the digits match an expression in the KPML document, the User Device
   prepares the appropriate KPML document.

   Note the values of the persistent attribute are case sensitive.

4.1.5  Multiple Patterns

   Some User Devices may support multiple regular expressions in a given
   pattern request.  In this situation, the application may wish to know
   which pattern triggered the event.

   KPML provides a "tag" attribute to the <regex> tag.  The "tag" is an
   opaque string that the User Device sends back in the notification
   report upon a match in the digit map.  In the case of multiple



Burger & Dolly          Expires January 13, 2005               [Page 26]


Internet-Draft                    KPML                         July 2004


   matches, the User Device MUST chose the longest match in the KPML
   document.  If multiple matches match the same length, the User Device
   MUST chose the first expression listed in the subscription KPML
   document based on KPML document order.

   If the User Device does not support multiple regular expressions in a
   pattern request, the User Device MUST return a KPML document with the
   KPML status code set to 532.

4.1.6  Monitoring Direction

   By default, the User Device monitors key presses emanating from the
   User Device.  Given a dialog identifier of Call-ID, local-tag, and
   remote-tag, the User Device monitors the key presses associated with
   the local-tag.

   In the media proxy case, and potentially other cases, there is a need
   to monitor the key presses arriving from the remote user agent.  The
   optional <stream> element to the <request> tag specifies which stream
   to monitor.  The only legal value is "reverse", which means to
   monitor the stream associated with the remote-tag.  The User Device
   MUST ignore other values.
      NOTE:  The reason this is a tag is so individual stream selection,
      if needed, can be addressed in a backwards-compatible way.
      NOTE:  Further specification of the stream to monitor is the
      subject of future standardization.  The current thoughts revolve
      around negotiating MIME parameters that describe namespaces
      declaring the filters specification of the stream.

4.1.7  Multiple, Simultaneous Subscriptions

   Some User Devices may support multiple key press event notification
   subscriptions at the same time.  In this situation, the User Device
   honors each subscription individually and independently.

   A SIP user agent may request multiple subscriptions on the same
   SUBSCRIBE dialog, using the id parameter to the kpml event request.

   One or more SIP user agents may request independent subscriptions on
   different SIP dialogs.  Section 3.2 describes the dialog addressing
   mechanism in detail.

   If the User Device does not support multiple, simultaneous
   subscriptions, the User Device MUST return a KPML document with the
   KPML status code set to 533 on the dialog that requested the second
   subscription.  The User Device MUST NOT modify the state of the first
   subscription on account of the second subscription attempt.




Burger & Dolly          Expires January 13, 2005               [Page 27]


Internet-Draft                    KPML                         July 2004


4.2  KPML Reports

   When the user enters key press(es) that match a <regex> tag, the User
   Device will issue a report.

   After reporting, the interpreter terminates the KPML session unless
   the subscription has a persistence indicator.  If the subscription
   does not have a persistence indicator, the User Device MUST set the
   state of the subscription to "terminated" in the NOTIFY report.

   If the subscription does not have a persistence indicator, to collect
   more digits the requestor must issue a new request.

      NOTE: This highlights the "one shot" nature of KPML, reflecting
      the balance of features and ease of implementing an interpreter.
      If your goal is to build an IVR session, we strongly suggest you
      investigate more appropriate technologies.

   KPML reports have two mandatory attributes, code and text.  These
   attributes describe the state of the KPML interpreter on the User
   Device.  Note the KPML status code is not necessarily related to the
   SIP result code.  An important example of this is where a legal SIP
   subscription request gets a normal SIP 200 OK followed by a NOTIFY,
   but there is something wrong with the KPML request.  In this case,
   the NOTIFY would include the KPML status code in the KPML report.
   Note that from a SIP perspective, the SUBSCRIBE and NOTIFY were
   successful.  Also, if the KPML failure is not recoverable, the User
   Device will most likely set the Subscription-Sate to "terminated".
   This lets the SIP machinery know the subscription is no longer
   active.

4.2.1  Pattern Match Reports

   If a pattern matches, the User Device will emit a KPML report.  Since
   this is a success report, the code is "200" and the text is "OK".

   The KPML report includes the actual digits matched in the digit
   attribute.  The digit string uses the conventional characters '*' and
   '#' for star and octothorpe respectively.  The KPML report also
   includes the tag attribute if the regex that matched the digits had a
   tag attribute.

   If the subscription requested digit suppression (Section 4.1.3) and
   the User Device suppressed digits, the suppressed attribute indicates
   "true".  The default value of suppressed is "false".

      NOTE: KPML does not include a timestamp.  There are a number of
      reasons for this.  First, what timestamp would in include?  Would



Burger & Dolly          Expires January 13, 2005               [Page 28]


Internet-Draft                    KPML                         July 2004


      it be the time of the first detected key press?  The time the
      interpreter collected the entire string?  A range?  Second, if the
      RTP timestamp is a datum of interest, why not simply get RTP in
      the first place?  That all said, if it is really compelling to
      have the timestamp in the response, it could be an attribute to
      the <response> tag.

4.2.2  KPML No Match Reports

   There are a few circumstances in which the User Device will emit a no
   match report.  They are an immediate NOTIFY in response to SUBSCRIBE
   request (no digits detected yet), a request for service not supported
   by User Device, or a failure of a digit map to match a string
   (timeout).

4.2.2.1  Immediate NOTIFY

   The NOTIFY in response to a SUBSCRIBE request has no KPML if there
   are no matching buffered digits.  An example of this is in Figure 14.

   If there are buffered digits in the SUBSCRIBE request that match a
   pattern, then the NOTIFY message in response to the SUBSCRIBE request
   MUST include the appropriate KPML document.

   NOTIFY sip:application@example.com SIP/2.0
   Via: SIP/2.0/UDP proxy.example.com
   Max-Forwards: 70
   To: <sip:application@example.com>
   From: <sip:endpoint@example.net>
   Call-Id: 439hu409h4h09903fj0ioij
   Subscription-State: active; expires=7200
   CSeq: 49851 NOTIFY
   Event: kpml

                  Figure 14: Immediate NOTIFY Example


5.  DRegex

5.1  Overview

   This subsection is informative in nature.

   The Digit REGular EXpression (DRegex) syntax is a telephony-oriented
   mapping of POSIX Extended Regular Expressions (ERE) [17].

   KPML does not use full POSIX ERE for the following reasons.




Burger & Dolly          Expires January 13, 2005               [Page 29]


Internet-Draft                    KPML                         July 2004


   o  KPML will often run on high density or extremely low power and
      memory footprint devices.
   o  Telephony application convention uses the star symbol ("*") for
      the star key and "x" for any digit 0-9.  Requiring the developer
      to escape the star ("\*") and expand the "x" ("[0-9]") is error
      prone.  This also leads DRegex to using the dot (".") to indicate
      repetition, which was the function of the unadorned star in POSIX
      ERE.
   o  POSIX ERE has clear, unambiguous rules for the precedence of the
      alternation operator ("|").  However, a few people in the SIPPING
      Work Group thought we should not allow them.  This was due to
      implementers not getting precedence right in MGCP [15] and H.248.1
      [16].

   The following table shows the mapping from DRegex to POSIX ERE.

                         +--------+-----------+
                         |        | POSIX ERE |
                         | DRegex |           |
                         +--------+-----------+
                         | *      | \*        |
                         | .      | *         |
                         | x      | [0-9]     |
                         | [xc]   | [0-9c]    |
                         +--------+-----------+

                  Table 1: DRegex to POSIX ERE Mapping

   The first substitution, which replaces a star for an escaped star, is
   because telephony application designers are used to using the star
   for the (very common) star key.  Requiring an escape sequence for
   this common pattern would be error prone.  In addition, the usage
   found in DRegex is the same as found in MGCP [15] and H.248.1 [16].

   Likewise, the use of the dot instead of star is common usage from
   MGCP and H.248.1, and reusing the star in this context would also be
   confusing and error prone.

   The "x" character is a common indicator of a dialed digit.  We use it
   here, continuing the convention.

   Users need to take care not to confuse the DRegex syntax with POSIX
   EREs.  They are NOT identical.  In particular there are many features
   of POSIX EREs that DRegex does not support.

   As an implementation note, if one makes the substitutions described
   in the above table, then a standard POSIX ERE engine can parse the
   digit string.  However, the mapping does not work in the reverse



Burger & Dolly          Expires January 13, 2005               [Page 30]


Internet-Draft                    KPML                         July 2004


   (POSIX ERE to DRegex) direction.  DRegex only implements the
   Normative behavior described below.

5.2  Operation

   White space is removed before parsing DRegex.  This enables sensible
   pretty printing in XML without affecting the meaning of the DRegex
   string.

   The following rules demonstrate the use of DRegex in KPML.

   +---------------------------------+---------------------------------+
   | Entity                          | Matches                         |
   +---------------------------------+---------------------------------+
   | character                       | digits 0-9 and A-D (case        |
   |                                 | insensitive)                    |
   | *                               | *                               |
   | #                               | #                               |
   | [character selector]            | Any character in selector       |
   | [^digit selector]               | Any digit (0-9) NOT in selector |
   | [range1-range2]                 | Any digit (0-9) in range from   |
   |                                 | range1 to range2, inclusive     |
   | x                               | Any digit 0-9                   |
   | {m}                             | m repetitions of previous       |
   |                                 | pattern                         |
   | {m,}                            | m or more repetitions of        |
   |                                 | previous pattern                |
   | {,n}                            | At most n (including zero)      |
   |                                 | repetitions of previous pattern |
   | {m,n}                           | at least m and at most n        |
   |                                 | repetitions of previous pattern |
   | Lc                              | Match the character c if it is  |
   |                                 | "long"; c is a digit 0-9 and    |
   |                                 | A-D, #, or *.                   |
   +---------------------------------+---------------------------------+
















Burger & Dolly          Expires January 13, 2005               [Page 31]


Internet-Draft                    KPML                         July 2004


        +------------+-----------------------------------------+
        | Example    | Description                             |
        +------------+-----------------------------------------+
        | 1          | Matches the digit 1                     |
        | [179]      | Matches 1, 7, or 9                      |
        | [^01]      | Matches 2, 3, 4, 5, 6, 7, 8, 9          |
        | [2-9]      | Matches 2, 3, 4, 5, 6, 7, 8, 9          |
        | x          | Matches 0, 1, 2, 3, 4, 5, 6, 7, 8, 9    |
        | *6[179#]   | Matches *61, *67, *69, or *6#           |
        | x{10}      | Ten digits (0-9)                        |
        |            | 011 followed by seven to fifteen digits |
        | 011x{7,15} |                                         |
        | L*         | Long star                               |
        +------------+-----------------------------------------+


6.  Formal Syntax

6.1  DRegex

   The following definition follows RFC2234 [2].  The definition of
   DIGIT is from the CORE specification of RFC2234, namely the
   characters "0" through "9".  Note the DRegexCharacater is not a
   HEXDIG from RFC2234.  In particular, DRegexCharacter neither includes
   "E" nor "F".  Moreover DRegexCharacter is case insensitive, unlike
   HEXDIG.

   DRegex           = 1*( DRegexPosition [ RepeatCount ] )
   DRegexPosition   = DRegexSymbol / DRegexSet
   DRegexSet        = ( "[" DRegexSetList "]" ) /
                      ( "[^" DigitList "]" )
   DRegexSetList    = 1*( (DIGIT "-" DIGIT) / DRegexSymbol )
   DigitList        = 1*( (DIGIT "-" DIGIT) / DIGIT )
   DRegexSymbol     = DRegexCharacter / ( "L" DRegexCharacter )
   RepeatCount      = "." / "{" RepeatRange "}"
   RepeatRange      = Count / ( Count "," Count ) /
                              ( Count "," ) / ( "," Count )
   Count            = 1*(DIGIT)
   DRegexCharacter  = DIGIT / "*" / "#" / "A" / "a" / "B" / "b" /
                              "x" / "X" / "C" / "c" / "D" / "d"

   Note that future extensions to this document may introduce other
   characters for DRegexCharacter, in the scheme of H.248.1 [16] or
   possibly as named strings or XML namespaces.

6.2  KPML Request

   The following syntax for KPML requests uses the XML Schema [8].



Burger & Dolly          Expires January 13, 2005               [Page 32]


Internet-Draft                    KPML                         July 2004


   <?xml version="1.0" encoding="UTF-8"?>
   <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)
        by Eric Burger (Brooktrout Technology, Inc.) -->
   <xs:schema targetNamespace="urn:ietf:params:xml:ns:kpml-request"
    xmlns="urn:ietf:params:xml:ns:kpml-request"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
     <xs:element name="kpml-request">
       <xs:annotation>
         <xs:documentation>IETF Keypad Markup Language Request
         </xs:documentation>
       </xs:annotation>
       <xs:complexType>
         <xs:sequence>
           <xs:element name="stream" minOccurs="0">
             <xs:complexType>
               <xs:choice>
                 <xs:element name="reverse" minOccurs="0"/>
                 <xs:any namespace="##other"/>
               </xs:choice>
             </xs:complexType>
           </xs:element>
           <xs:element name="pattern">
             <xs:complexType>
               <xs:sequence>
                 <xs:element name="flush" minOccurs="0">
                   <xs:annotation>
                     <xs:documentation>
                       Default is to not flush buffer
                     </xs:documentation>
                   </xs:annotation>
                   <xs:complexType>
                     <xs:simpleContent>
                       <xs:extension base="xs:string"/>
                     </xs:simpleContent>
                   </xs:complexType>
                 </xs:element>
                 <xs:element name="regex" maxOccurs="unbounded">
                   <xs:annotation>
                     <xs:documentation>
                       Key press notation is a string to allow
                       for future extension of non-16 digit
                       keypads or named keys
                     </xs:documentation>
                   </xs:annotation>
                   <xs:complexType mixed="true">
                     <xs:choice>



Burger & Dolly          Expires January 13, 2005               [Page 33]


Internet-Draft                    KPML                         July 2004


                       <xs:element name="pre" minOccurs="0">
                         <xs:complexType>
                           <xs:simpleContent>
                             <xs:extension base="xs:string"/>
                           </xs:simpleContent>
                         </xs:complexType>
                       </xs:element>
                       <xs:any namespace="##other"/>
                     </xs:choice>
                     <xs:attribute name="tag" type="xs:string"
                                   use="optional"/>
                   </xs:complexType>
                 </xs:element>
               </xs:sequence>
               <xs:attribute name="persist" use="optional">
                 <xs:annotation>
                   <xs:documentation>Default is "one-shot"
                   </xs:documentation>
                 </xs:annotation>
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
                     <xs:enumeration value="one-shot"/>
                     <xs:enumeration value="persist"/>
                     <xs:enumeration value="single-notify"/>
                   </xs:restriction>
                 </xs:simpleType>
               </xs:attribute>
               <xs:attribute name="interdigittimer"
                             type="xs:integer"
                             use="optional">
                 <xs:annotation>
                   <xs:documentation>Default is 4000 (ms)
                   </xs:documentation>
                 </xs:annotation>
               </xs:attribute>
               <xs:attribute name="criticaldigittimer"
                             type="xs:integer"
                             use="optional">
                 <xs:annotation>
                   <xs:documentation>Default is 1000 (ms)
                   </xs:documentation>
                 </xs:annotation>
               </xs:attribute>
               <xs:attribute name="extradigittimer"
                             type="xs:integer"
                             use="optional">
                 <xs:annotation>
                   <xs:documentation>Default is 500 (ms)



Burger & Dolly          Expires January 13, 2005               [Page 34]


Internet-Draft                    KPML                         July 2004


                   </xs:documentation>
                 </xs:annotation>
               </xs:attribute>
               <xs:attribute name="long" type="xs:integer"
                             use="optional"/>
               <xs:attribute name="longrepeat" type="xs:boolean"
                             use="optional"/>
               <xs:attribute name="nopartial" type="xs:boolean"
                             use="optional">
                 <xs:annotation>
                   <xs:documentation>Default is false
                   </xs:documentation>
                 </xs:annotation>
               </xs:attribute>
               <xs:attribute name="enterkey" type="xs:string"
                             use="optional">
                 <xs:annotation>
                   <xs:documentation>No default enterkey
                   </xs:documentation>
                 </xs:annotation>
               </xs:attribute>
             </xs:complexType>
           </xs:element>
         </xs:sequence>
         <xs:attribute name="version" type="xs:string"
                       use="required"/>
       </xs:complexType>
     </xs:element>
   </xs:schema>

                Figure 16: XML Schema for KPML Requests


6.3  KPML Response

   The following syntax for KPML responses uses the XML Schema [8].

   <?xml version="1.0" encoding="UTF-8"?>
   <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)
        by Eric Burger (Brooktrout Technology, Inc.) -->
   <xs:schema targetNamespace="urn:ietf:params:xml:ns:kpml-response"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="urn:ietf:params:xml:ns:kpml-response"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
     <xs:element name="kpml-response">
       <xs:annotation>
         <xs:documentation>IETF Keypad Markup Language Response



Burger & Dolly          Expires January 13, 2005               [Page 35]


Internet-Draft                    KPML                         July 2004


         </xs:documentation>
       </xs:annotation>
       <xs:complexType>
         <xs:attribute name="version" type="xs:string"
                       use="required"/>
         <xs:attribute name="code" type="xs:string"
                       use="required"/>
         <xs:attribute name="text" type="xs:string"
                       use="required"/>
         <xs:attribute name="suppressed" type="xs:boolean"
                       use="optional"/>
         <xs:attribute name="forced_flush" type="xs:string"
                       use="optional">
           <xs:annotation>
             <xs:documentation>
               String for future use for e.g., number of digits lost.
             </xs:documentation>
           </xs:annotation>
         </xs:attribute>
         <xs:attribute name="digits" type="xs:string"
                       use="optional"/>
         <xs:attribute name="tag" type="xs:string" use="optional">
           <xs:annotation>
             <xs:documentation>Matches tag from regex in request
             </xs:documentation>
           </xs:annotation>
         </xs:attribute>
       </xs:complexType>
     </xs:element>
   </xs:schema>


7.  Enumeration of KPML Status Codes

   KPML status codes broadly follow their SIP counterparts.  Codes that
   start with a 2 indicate success.  Codes that start with a 4 indicate
   failure.  Codes that start with a 5 indicate a server failure,
   usually a failure to interpret the document or to support a requested
   feature.

   KPML clients MUST be able to handle arbitrary status codes by
   examining the first digit only.

   Any text can be in a KPML report document.  KPML clients MUST NOT
   interpret the text field.






Burger & Dolly          Expires January 13, 2005               [Page 36]


Internet-Draft                    KPML                         July 2004


      +------+--------------------------------------------------+
      |      | Text                                             |
      | Code |                                                  |
      +------+--------------------------------------------------+
      | 200  | Success                                          |
      | 402  | User Terminated Without Match                    |
      | 423  | Timer Expired                                    |
      | 481  | Dialog Not Found                                 |
      | 487  | Subscription Expired                             |
      | 501  | Bad Document                                     |
      | 502  | Namespace Not Supported                          |
      | 531  | Persistent Subscriptions Not Supported           |
      | 532  | Multiple Regular Expressions Not Supported       |
      | 533  | Multiple Subscriptions on a Dialog Not Supported |
      +------+--------------------------------------------------+

                       Table 4: KPML Status Codes


8.  IANA Considerations

   This document registers a new SIP Event Package, two new MIME types,
   and two new XML namespaces.

8.1  SIP Event Package Registration

   Package name: kpml
   Type: package
   Contact: Eric Burger, <e.burger@ieee.org>
   Published Specification: RFCXXXX

8.2  MIME Media Type application/kpml-request+xml

   +---------------------------------+---------------------------------+
   +---------------------------------+---------------------------------+
   | MIME media type name:           | application                     |
   | MIME subtype name:              | kpml-request+xml                |
   | Required parameters:            | none                            |
   | Optional parameters:            | Same as charset parameter       |
   |                                 | application/xml as specified in |
   |                                 | XML Media Types [3]             |
   | Encoding considerations:        | See RFC3023 [3].                |
   | Security considerations:        | See Section 10 of RFC3023 [3]   |
   |                                 | and Section 9 of RFCXXXX        |
   | Interoperability                | See RFC2023 [3] and RFCXXXX     |
   | considerations:                 |                                 |
   | Published specification:        | RFCXXXX                         |
   | Applications which use this     | Session-oriented applications   |



Burger & Dolly          Expires January 13, 2005               [Page 37]


Internet-Draft                    KPML                         July 2004


   | media type:                     | that have primitive user        |
   |                                 | interfaces.                     |
   | Personal and email address for  | Eric Burger <e.burger@ieee.org> |
   | further information:            |                                 |
   | Intended usage:                 | COMMON                          |
   +---------------------------------+---------------------------------+

   Additional Information:
      Magic Number: None
      File Extension: .xml
      Macintosh file type code: "TEXT"

8.3  MIME Media Type application/kpml-response+xml

   +---------------------------------+---------------------------------+
   +---------------------------------+---------------------------------+
   | MIME media type name:           | application                     |
   | MIME subtype name:              | kpml-resposne+xml               |
   | Required parameters:            | none                            |
   | Optional parameters:            | Same as charset parameter       |
   |                                 | application/xml as specified in |
   |                                 | XML Media Types [3]             |
   | Encoding considerations:        | See RFC3023 [3].                |
   | Security considerations:        | See Section 10 of RFC3023 [3]   |
   |                                 | and Section 9 of RFCXXXX        |
   | Interoperability                | See RFC2023 [3] and RFCXXXX     |
   | considerations:                 |                                 |
   | Published specification:        | RFCXXXX                         |
   | Applications which use this     | Session-oriented applications   |
   | media type:                     | that have primitive user        |
   |                                 | interfaces.                     |
   | Personal and email address for  | Eric Burger <e.burger@ieee.org> |
   | further information:            |                                 |
   | Intended usage:                 | COMMON                          |
   +---------------------------------+---------------------------------+

   Additional Information:
      Magic Number: None
      File Extension: .xml
      Macintosh file type code: "TEXT"

8.4  URN Sub-Namespace Registration for urn:ietf:xml:ns:kpml-request

   URI: urn:ietf:params:xml:ns:kpml-request

   Registrant Contact: IETF, SIPPING Work Group <sipping@ietf.org>, Eric
   Burger <e.burger@ieee.org>.




Burger & Dolly          Expires January 13, 2005               [Page 38]


Internet-Draft                    KPML                         July 2004


   XML:

   <?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>Key Press Markup Language Request</title>
     </head>
     <body>
       <h1>Namespace for Key Press Markup Language Request</h1>
       <h2>urn:ietf:params:xml:ns:kpml-request</h2>
       <p>
   <a href="ftp://ftp.rfc-editor.org/in-notes/rfcXXXX.txt">RFCXXXX</a>.
       </p>
     </body>
   </html>


8.5  URN Sub-Namespace Registration for urn:ietf:xml:ns:kpml-response

   URI: urn:ietf:params:xml:ns:kpml-response

   Registrant Contact: IETF, SIPPING Work Group <sipping@ietf.org>, Eric
   Burger <e.burger@ieee.org>.

   XML:

   <?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>Key Press Markup Language Response</title>
     </head>
     <body>
       <h1>Namespace for Key Press Markup Language Response</h1>
       <h2>urn:ietf:params:xml:ns:kpml-response</h2>
       <p>
   <a href="ftp://ftp.rfc-editor.org/in-notes/rfcXXXX.txt">RFCXXXX</a>.
       </p>
     </body>
   </html>




Burger & Dolly          Expires January 13, 2005               [Page 39]


Internet-Draft                    KPML                         July 2004


8.6  KPML Request Schema Registration

   Per RFC3688 [7], please register the XML Schema for KPML as
   referenced in Section 6.2 of RFCXXXX.

   URI: Please assign.

   Registrant Contact: IETF, SIPPING Work Group <sipping@ietf.org>, Eric
   Burger <e.burger@ieee.org>.

8.7  KPML Response Schema Registration

   Per RFC3688 [7], please register the XML Schema for KPML as
   referenced in Section 6.3 of RFCXXXX.

   URI: Please assign.

   Registrant Contact: IETF, SIPPING Work Group <sipping@ietf.org>, Eric
   Burger <e.burger@ieee.org>.

9.  Security Considerations

   As an XML markup, all of the security considerations of RFC3023 [3]
   and RFC3406 [6] must be met.  Pay particular attention to the
   robustness requirements of parsing XML.

   Key press information is potentially sensitive.  For example, it can
   represent credit card, calling card, or other personal information.
   Hijacking sessions allow unauthorized entities access to this
   sensitive information.  Therefore, signaling SHOULD be secure, e.g.,
   use of TLS and sips: SHOULD be used.  Moreover, the information
   itself is sensitive, therefore the use of S/MIME or other appropriate
   mechanism SHOULD be used.

   Subscriptions MUST be authenticated.

   User Devices MUST support digest authentication.

   User Devices MUST support the sips: scheme and TLS.

   User Devices MUST NOT buffer USER input prior to an authenticated
   subscription.

   User Devices MUST buffer User Input upon receipt of an authenticated
   and accepted subscription.

   User Devices implementing this specification MUST implement TLS and
   SHOULD implement S/MIME at a minimum.



Burger & Dolly          Expires January 13, 2005               [Page 40]


Internet-Draft                    KPML                         July 2004


10.  Examples

   This section is informative in nature.  If there is a discrepancy
   between this section and the normative sections above, the normative
   sections take precedence.

10.1  Monitoring for Octothorpe

   A common need for pre-paid and personal assistant applications is to
   monitor a conversation for a signal indicating a change in user focus
   from the party they called through the application to the application
   itself.  For example, if you call a party using a pre-paid calling
   card and the party you call redirects you to voice mail, digits you
   press are for the voice mail system.  However, many applications have
   a special key sequence, such as the octothorpe (#, or pound sign) or
   *9 that terminate the called party session and shift the user's focus
   to the application.

   Figure 20 shows the KPML for long octothorpe.

   <?xml version="1.0">
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern>
       <regex>L#</regex>
     </pattern>
   </kpml-request>

                   Figure 20: Long Octothorpe Example

   The regex value L indicates the following digit needs to be a
   long-duration key press.

10.2  Dial String Collection

   In this example, the User Device collects a dial string.  The
   application uses KPML to quickly determine when the user enters a
   target number.  In addition, KPML indicates what type of number the
   user entered.









Burger & Dolly          Expires January 13, 2005               [Page 41]


Internet-Draft                    KPML                         July 2004


   <?xml version="1.0">
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern>
       <regex tag="local-operator">0</regex>
       <regex tag="ld-operator"/>00</regex>
       <regex tag="vpn">7[x][x][x]</regex>
       <regex tag="local-number7">9xxxxxxx</regex>
       <regex tag="RI-number">9401xxxxxxx</regex>
       <regex tag="local-number10">9xxxxxxxxxx</regex>
       <regex tag="ddd">91xxxxxxxxxx</regex>
       <regex tag="iddd">011x.</regex>
     </pattern>
   </kpml-request>

                Figure 21: Dial String KPML Example Code

   Note the use of the "tag" attribute to indicate which regex matched
   the dialed string.  The interesting case here is if the user entered
   "94015551212".  This string matches both the "9401xxxxxxx" and
   "9xxxxxxxxxx" regular expressions.  By following the rules described
   in Section 4.1.5, the KPML interpreter will pick the "9401xxxxxxx"
   string, as it occurs first in document order (both expressions match
   the same length).  Figure 22 shows the response.

   <?xml version="1.0"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-resposne"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="94015551212" tag="RI-number"/>

                  Figure 22: Dial String KPML Response


11.  Call Flow Examples

11.1  Supplemental Digits

   This section gives a non-normative example of an application that
   collects supplemental digits.  Supplemental digit collection is where
   the network requests additional digits after the caller enters the
   destination address.  A typical supplemental dial string is four



Burger & Dolly          Expires January 13, 2005               [Page 42]


Internet-Draft                    KPML                         July 2004


   digits in length.

   Ingress Gateway      Application Server       Egress Gateway
          |                      |                      |
          |                      |                      |
          |                      |                      |
          |(1) INVITE            |                      |
          |-------------------------------------------->|
          |                      |                      |
          |                      |                      |
          |(2) 200 OK            |                      |
          |<--------------------------------------------|
          |                      |                      |
          |                      |                      |
          |(3) ACK               |                      |
          |-------------------------------------------->|
          |                      |                      |
          |                      |                      |
          |(4) SUBSCRIBE (one-shot)                     |
          |<---------------------|                      |
          |                      |                      |
          |                      |                      |
          |(5) 200 OK            |                      |
          |--------------------->|                      |
          |                      |                      |
          |                      |                      |
          |(6) NOTIFY            |                      |
          |--------------------->|                      |
          |                      |                      |
          |                      |                      |
          |(7) 200 OK            |                      |
          |<---------------------|                      |
          |                      |                      |
          |                      |                      |
          |(8)                   |                      |
          |......................|                      |
          |                      |                      |
          |                      |                      |
          |(9) NOTIFY (digits)   |                      |
          |--------------------->|                      |
          |                      |                      |
          |                      |                      |
          |(10) 200 OK           |                      |
          |<---------------------|                      |
          |                      |                      |
          |                      |                      |
          |                      |                      |
          |                      |                      |



Burger & Dolly          Expires January 13, 2005               [Page 43]


Internet-Draft                    KPML                         July 2004


                Figure 23: Supplemental Digits Call Flow

   In messages (1-3), the ingress gateway establishes a dialog with an
   egress gateway.  The application learns the dialog ID through
   out-of-band mechanisms, such as the Dialog Package or being
   coresident with the egress gateway.  Part of the ACK message is
   below, to illustrate the dialog identifiers.

   ACK sip:gw@subA.example.com SIP/2.0
   Via: ...
   Max-Forwards: ...
   Route: ...
   From: <sip:phn@example.com>;tag=jfh21
   To: <sip:gw@subA.example.com>;tag=onjwe2
   Call-ID: 12345592@subA.example.com
   ...

   In message (4), the application requests the gateway collect a string
   of four key presses.

   SUBSCRIBE sip:gw@subA.example.com SIP/2.0
   Via: SIP/2.0/TCP client.subB.example.com;branch=q4i9ufr4ui3
   From: <sip:ap@subB.example.com>;tag=567890
   To: <sip:gw@subA.example.com>
   Call-ID: 12345601@subA.example.com
   CSeq: 1 SUBSCRIBE
   Contact: <sip:ap@client.subB.example.com>
   Max-Forwards: 70
   Event: kpml ;remote-tag="<sip:phn@example.com;tag=jfh21>"
               ;local-tag="sip:gw@subA.example.com;tag=onjwe2"
               ;call-id="12345592@subA.example.com"
   Expires: 7200
   Accept: application/kpml-response+xml
   Content-Type: application/kpml-request+xml
   Content-Length: 292

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=
         "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
       version="1.0">
     <pattern persist="one-shot">
       <regex>xxxx</regex>
     </pattern>
   </kpml-request>

   Message (5) is the acknowledgement of the subscription request.



Burger & Dolly          Expires January 13, 2005               [Page 44]


Internet-Draft                    KPML                         July 2004


   SIP/2.0 200 OK
   Via: SIP/2.0/TCP subB.example.com;branch=q4i9ufr4ui3;
        received=192.168.125.12
   From: <sip:ap@subB.example.com>;tag=567890
   To: <sip:gw@subA.example.com>;tag=1234567
   Call-ID: 12345601@subA.example.com
   CSeq: 1 SUBSCRIBE
   Contact: <sip:gw27@subA.example.com>
   Expires: 3600
   Event: kpml

   Message (6) is the immediate notification of the subscription.

   NOTIFY sip:ap@client.subB.example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=gw27id4993
   To: <sip:ap@subB.example.com>;tag=567890
   From: <sip:gw@subA.example.com>;tag=1234567
   Call-ID: 12345601@subA.example.com
   CSeq: 1000 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3599
   Max-Forwards: 70
   Content-Length: 0

   Message (7) is the acknowledgment of the notification message.

   SIP/2.0 200 OK
   Via: SIP/2.0/TCP subA.example.com;branch=gw27id4993
   To: <sip:ap@subB.example.com>;tag=567890
   From: <sip:gw@subA.example.com>;tag=1234567
   Call-ID: 12345601@subA.example.com
   CSeq: 1000 NOTIFY

   Some time elapses (8).

   The user enters the input.  The device provides the notification of
   the collected digits in message (9).  Since this was a one-shot
   subscription, note the Subscription-State is "terminated".












Burger & Dolly          Expires January 13, 2005               [Page 45]


Internet-Draft                    KPML                         July 2004


   NOTIFY sip:ap@client.subB.example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=gw27id4993
   To: <sip:ap@subB.example.com>;tag=567890
   From: <sip:gw@subA.example.com>;tag=1234567
   Call-ID: 12345601@subA.example.com
   CSeq: 1001 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: terminated
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 258

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="4336"/>

   Message (10) is the acknowledgement of the notification.

   SIP/2.0 200 OK
   Via: SIP/2.0/TCP subA.example.com;branch=gw27id4993
   To: <sip:ap@subB.example.com>;tag=567890
   From: <sip:gw@subA.example.com>;tag=1234567
   Call-ID: 12345601@subA.example.com
   CSeq: 1001 NOTIFY


11.2  Multiple Applications

   This section gives a non-normative example of multiple applications.
   One application collects a destination number to call.  That
   application then waits for a "long pound."  During the call, the call
   goes to a personal assistant application, which interacts with the
   user.  In addition, the personal assistant application looks for a
   "short pound."

   For clarity, we do not show the INVITE dialogs.

   Gateway           Card Application      Personal Assistant
      |                      |                      |
      |                      |                      |
      |                      |                      |
      |(1) SUBSCRIBE (persistent)                   |



Burger & Dolly          Expires January 13, 2005               [Page 46]


Internet-Draft                    KPML                         July 2004


      |<---------------------|                      |
      |                      |                      |
      |                      |                      |
      |(2) 200 OK            |                      |
      |--------------------->|                      |
      |                      |                      |
      |                      |                      |
      |(3) NOTIFY            |                      |
      |--------------------->|                      |
      |                      |                      |
      |                      |                      |
      |(4) 200 OK            |                      |
      |<---------------------|                      |
      |                      |                      |
      |                      |                      |
      |(5)                   |                      |
      |......................|                      |
      |                      |                      |
      |                      |                      |
      |(6) NOTIFY (tag=card) |                      |
      |--------------------->|                      |
      |                      |                      |
      |                      |                      |
      |(7) 200 OK            |                      |
      |<---------------------|                      |
      |                      |                      |
      |                      |                      |
      |(8)                   |                      |
      |......................|                      |
      |                      |                      |
      |                      |                      |
      |(9) NOTIFY (tag=number)                      |
      |--------------------->|                      |
      |                      |                      |
      |                      |                      |
      |(10) 200 OK           |                      |
      |<---------------------|                      |
      |                      |                      |
      |                      |                      |
      |(11) SUBSCRIBE        |                      |
      |<--------------------------------------------|
      |                      |                      |
      |                      |                      |
      |(12) 200 OK           |                      |
      |-------------------------------------------->|
      |                      |                      |
      |                      |                      |
      |(13) NOTIFY           |                      |



Burger & Dolly          Expires January 13, 2005               [Page 47]


Internet-Draft                    KPML                         July 2004


      |-------------------------------------------->|
      |                      |                      |
      |                      |                      |
      |(14) 200 OK           |                      |
      |<--------------------------------------------|
      |                      |                      |
      |                      |                      |
      |(15)                  |                      |
      |.............................................|
      |                      |                      |
      |                      |                      |
      |(16) NOTIFY (tag=number)                     |
      |-------------------------------------------->|
      |                      |                      |
      |                      |                      |
      |(17) 200 OK           |                      |
      |<--------------------------------------------|
      |                      |                      |
      |                      |                      |
      |(18)                  |                      |
      |.............................................|
      |                      |                      |
      |                      |                      |
      |(19) NOTIFY (tag=#)   |                      |
      |-------------------------------------------->|
      |                      |                      |
      |                      |                      |
      |(20) 200 OK           |                      |
      |<--------------------------------------------|
      |                      |                      |
      |                      |                      |
      |(21)                  |                      |
      |.............................................|
      |                      |                      |
      |                      |                      |
      |(22) NOTIFY (tag=number)                     |
      |-------------------------------------------->|
      |                      |                      |
      |                      |                      |
      |(23) 200 OK           |                      |
      |<--------------------------------------------|
      |                      |                      |
      |                      |                      |
      |(24)                  |                      |
      |.............................................|
      |                      |                      |
      |                      |                      |
      |(25) NOTIFY (L#)      |                      |



Burger & Dolly          Expires January 13, 2005               [Page 48]


Internet-Draft                    KPML                         July 2004


      |--------------------->|                      |
      |                      |                      |
      |                      |                      |
      |(26) 200 OK           |                      |
      |<---------------------|                      |
      |                      |                      |
      |                      |                      |
      |                      |                      |
      |                      |                      |

               Figure 31: Multiple Application Call Flow

   Message (1) is the subscription request for the card number.

   SUBSCRIBE sip:gw@subA.example.com SIP/2.0
   Via: SIP/2.0/TCP client.subB.example.com;branch=3qo3j0ouq
   From: <sip:ap@subB.example.com>;tag=978675
   To: <sip:gw@subA.example.com>
   Call-ID: 12345601@subA.example.com
   CSeq: 20 SUBSCRIBE
   Contact: <sip:ap@client.subB.example.com>
   Max-Forwards: 70
   Event: kpml ;remote-tag="<sip:phn@example.com;tag=jfi23>"
               ;local-tag="sip:gw@subA.example.com;tag=oi43jfq"
               ;call-id="12345598@subA.example.com"
   Expires: 7200
   Accept: application/kpml-response+xml
   Content-Type: application/kpml-request+xml
   Content-Length: 339

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern persist="persist">
       <regex tag="card">x{16}</regex>
       <regex tag="number">x{10}</regex>
     </pattern>
   </kpml-request>

   Messages 2-4 are not shown for brevity.  Message (6) is the
   notification of the card number.







Burger & Dolly          Expires January 13, 2005               [Page 49]


Internet-Draft                    KPML                         July 2004


   NOTIFY sip:ap@client.subB.example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=3qo3j0ouq
   To: <sip:ap@subB.example.com>;tag=978675
   From: <sip:gw@subA.example.com>;tag=9783453
   Call-ID: 12345601@subA.example.com
   CSeq: 3001 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3442
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 271

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="9999888877776666"/>

   Message (7) is the acknowledgement of the notification.  Time goes by
   in (8).  Message (9) is the notification of the dialed number.

   NOTIFY sip:ap@client.subB.example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=3qo3j0ouq
   To: <sip:ap@subB.example.com>;tag=978675
   From: <sip:gw@subA.example.com>;tag=9783453
   Call-ID: 12345601@subA.example.com
   CSeq: 3001 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3542
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 278

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="2225551212" tag="number"/>

   Message (11) is the request for long-pound monitoring.



Burger & Dolly          Expires January 13, 2005               [Page 50]


Internet-Draft                    KPML                         July 2004


   SUBSCRIBE sip:gw@subA.example.com SIP/2.0
   Via: SIP/2.0/TCP client.subB.example.com;branch=3qo3j0ouq
   From: <sip:ap@subB.example.com>;tag=978675
   To: <sip:gw@subA.example.com>
   Call-ID: 12345601@subA.example.com
   CSeq: 21 SUBSCRIBE
   Contact: <sip:ap@client.subB.example.com>
   Max-Forwards: 70
   Event: kpml ;remote-tag="<sip:phn@example.com;tag=jfi23>"
               ;local-tag="sip:gw@subA.example.com;tag=oi43jfq"
               ;call-id="12345598@subA.example.com"
   Expires: 7200
   Accept: application/kpml-response+xml
   Content-Type: application/kpml-request+xml
   Content-Length: 295

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern persist="single-notify">
       <regex>L#</regex>
     </pattern>
   </kpml-request>

   Message (13) is the request from the personal assistant application
   for number and pound sign monitoring.






















Burger & Dolly          Expires January 13, 2005               [Page 51]


Internet-Draft                    KPML                         July 2004


   SUBSCRIBE sip:gw@subA.example.com SIP/2.0
   Via: SIP/2.0/TCP pahost.example.com;branch=xzvsadf
   From: <sip:pa@example.com>;tag=4rgj0f
   To: <sip:gw@subA.example.com>
   Call-ID: 93845@pahost.example.com
   CSeq: 21 SUBSCRIBE
   Contact: <sip:pa12@pahost.example.com>
   Max-Forwards: 70
   Event: kpml ;remote-tag="<sip:phn@example.com;tag=jfi23>"
               ;local-tag="sip:gw@subA.example.com;tag=oi43jfq"
               ;call-id="12345598@subA.example.com"
   Expires: 7200
   Accept: application/kpml-response+xml
   Content-Type: application/kpml-request+xml
   Content-Length: 332

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-request xmlns="urn:ietf:params:xml:ns:kpml-request"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-request kpml-request.xsd"
         version="1.0">
     <pattern persist="persist">
       <regex tag="number">x{10}</regex>
       <regex tag="#">#</regex>
     </pattern>
   </kpml-request>

   Message (18) is the notification of the number collected.

   NOTIFY sip:pa@example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=xzvsadf
   To: <sip:pa@example.com>;tag=4rgj0f
   From: <sip:gw@subA.example.com>;tag=9788823
   Call-ID: 93845@pahost.example.com
   CSeq: 3021 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3540
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 278

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"



Burger & Dolly          Expires January 13, 2005               [Page 52]


Internet-Draft                    KPML                         July 2004


         version="1.0"
         code="200" text="OK" digits="3335551212" tag="number"/>

   Message (21) is the notification of pound sign detected.

   NOTIFY sip:pa@example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=xzvsadf
   To: <sip:pa@example.com>;tag=4rgj0f
   From: <sip:gw@subA.example.com>;tag=9788823
   Call-ID: 93845@pahost.example.com
   CSeq: 3022 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3540
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 264

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="#" tag="#"/>

   Message (27) is the notification of long pound to the card
   application.






















Burger & Dolly          Expires January 13, 2005               [Page 53]


Internet-Draft                    KPML                         July 2004


   NOTIFY sip:ap@client.subB.example.com SIP/2.0
   Via: SIP/2.0/UDP subA.example.com;branch=3qo3j0ouq
   To: <sip:ap@subB.example.com>;tag=978675
   From: <sip:gw@subA.example.com>;tag=9783453
   Call-ID: 12345601@subA.example.com
   CSeq: 3037 NOTIFY
   Contact: <sip:gw27@subA.example.com>
   Event: kpml
   Subscription-State: active;expires=3216
   Max-Forwards: 70
   Content-Type: application/kpml-response+xml
   Content-Length: 256

   <?xml version="1.0" encoding="UTF-8"?>
   <kpml-response xmlns="urn:ietf:params:xml:ns:kpml-response"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
           "urn:ietf:params:xml:ns:kpml-response kpml-response.xsd"
         version="1.0"
         code="200" text="OK"
         digits="#"/>


12.  References

12.1  Normative References

   [1]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
        Levels", BCP 14, RFC 2119, March 1997.

   [2]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
        Specifications: ABNF", RFC 2234, November 1997.

   [3]  Murata, M., St. Laurent, S. and D. Kohn, "XML Media Types", RFC
        3023, January 2001.

   [4]  Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A.,
        Peterson, J., Sparks, R., Handley, M. and E. Schooler, "SIP:
        Session Initiation Protocol", RFC 3261, June 2002.

   [5]  Roach, A., "Session Initiation Protocol (SIP)-Specific Event
        Notification", RFC 3265, June 2002.

   [6]  Daigle, L., van Gulik, D., Iannella, R. and P. Faltstrom,
        "Uniform Resource Names (URN) Namespace Definition Mechanisms",
        BCP 66, RFC 3406, October 2002.

   [7]  Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January



Burger & Dolly          Expires January 13, 2005               [Page 54]


Internet-Draft                    KPML                         July 2004


        2004.

   [8]  Thompson, H., Beech, D., Maloney, M. and N. Mendelsohn, "XML
        Schema Part 1: Structures", W3C REC REC-xmlschema-1-20010502,
        May 2001.

12.2  Informative References

   [9]   Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson,
         "RTP: A Transport Protocol for Real-Time Applications", RFC
         1889, January 1996.

   [10]  Handley, M. and V. Jacobson, "SDP: Session Description
         Protocol", RFC 2327, April 1998.

   [11]  Fielding, R., Gettys, J., Mogul, J., Nielsen, H., Masinter, L.,
         Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol --
         HTTP/1.1", RFC 2616, June 1999.

   [12]  Schulzrinne, H. and S. Petrack, "RTP Payload for DTMF Digits,
         Telephony Tones and Telephony Signals", RFC 2833, May 2000.

   [13]  Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with
         Session Description Protocol (SDP)", RFC 3264, June 2002.

   [14]  Olson, S., Camarillo, G. and A. Roach, "Support for IPv6 in
         Session Description Protocol (SDP)", RFC 3266, June 2002.

   [15]  Andreasen, F. and B. Foster, "Media Gateway Control Protocol
         (MGCP) Version 1.0", RFC 3435, January 2003.

   [16]  Groves, C., Pantaleo, M., Anderson, T. and T. Taylor, "Gateway
         Control Protocol Version 1", RFC 3525, June 2003.

   [17]  Institute of Electrical and Electronics Engineers, "Information
         Technology - Portable Operating System Interface (POSIX) - Part
         1: Base Definitions, Chapter 9", IEEE Standard 1003.1, June
         2001.

   [18]  "Packet-based Multimedia Communications Systems (includes Annex
         C - H.323 on ATM)", ITU-T Recommendation H.323v3, September
         1999.

   [19]  International Telecommunications Union, "CONTROL PROTOCOL FOR
         MULTIMEDIA COMMUNICATION", ITU Recommendation H.245, 1998.

   [20]  World Wide Web Consortium, "Voice Extensible Markup Language
         (VoiceXML) Version 2.0", W3C Working Draft , April 2002,



Burger & Dolly          Expires January 13, 2005               [Page 55]


Internet-Draft                    KPML                         July 2004


         <http://www.w3.org/TR/voicexml20/>.

   [21]  Bray, T., Paoli, J., Sperberg-McQueen, C. and E. Maler,
         "Extensible Markup Language (XML) 1.0 (Second Edition)", W3C
         REC REC-xml-20001006, October 2000.

   [22]  Hunt, A. and S. McGlashan, "Speech Recognition Grammar
         Specification Version 1.0", W3C CR CR-speech-grammar-20020626,
         June 2002.

   [23]  Rosenberg, J., "A Framework for Application Interaction in the
         Session Initiation Protocol  (SIP)",
         draft-ietf-sipping-app-interaction-framework-01 (work in
         progress), February 2004.

   [24]  Burger (Ed.), E., Van Dyke, J. and A. Spitzer, "Basic Network
         Media Services with SIP", draft-burger-sipping-netann-08 (work
         in progress), February 2004.

   [25]  Burger, E., Van Dyke, J. and A. Spitzer, "Media Server Control
         Markup Language (MSCML) and Protocol", draft-vandyke-mscml-04
         (work in progress), March 2004.

   [26]  Rosenberg, J., "Obtaining and Using Globally Routable User
         Agent (UA) URIs (GRUU) in the  Session Initiation Protocol
         (SIP)", draft-ietf-sip-gruu-01 (work in progress), February
         2004.

   [27]  Rosenberg, J. and H. Schulzrinne, "An INVITE Inititiated Dialog
         Event Package for the Session Initiation  Protocol (SIP",
         draft-ietf-sipping-dialog-package-02 (work in progress), June
         2003.


Authors' Addresses

   Eric Burger
   Brooktrout Technology, Inc.
   18 Keewaydin Dr.
   Salem, NH  03079
   USA

   EMail: e.burger@ieee.org








Burger & Dolly          Expires January 13, 2005               [Page 56]


Internet-Draft                    KPML                         July 2004


   Martin Dolly
   AT&T Labs

   EMail: mdolly@att.com

Appendix A.  Contributors

   Ophir Frieder of the Illinois Institute of Technology collaborated on
   the development of the buffer algorithm.

   Jeff Van Dyke worked enough hours and wrote enough text to be
   considered an author under the old rules.

   Robert Fairlie-Cuninghame, Cullen Jennings, Jonathan Rosenberg, and I
   were the members of the Application Stimulus Signaling Design Team.
   All members of the team contributed to this work.  In addition,
   Jonathan Rosenberg postulated DML in his "A Framework for Stimulus
   Signaling in SIP Using Markup" draft.

   We liberally adopted text from Rohan Mahy's Signaled Telephony Events
   draft for the motivation section.

   This version of KPML has significant influence from MSCML, the
   SnowShore Media Server Control Markup Language.  Jeff Van Dyke and
   Andy Spitzer were the primary contributors to that effort.

   That said, any errors, misinterpretation, or fouls in this document
   are our own.

Appendix B.  Acknowledgements

   Hal Purdy and Eric Cheung of AT&T Laboratories helped immensely
   through many conversations and challenges.

   Steve Fisher of AT&T Laboratories suggested the digit suppression
   syntax and provided excellent review of the document.

   Terence Lobo of SnowShore Networks made it all work.

   Jerry Kamitses, Swati Dhuleshia, Shaun Bharrat, Sunil Menon, and
   Bryan Hill helped with clarifying the buffer behavior and DRegex
   syntax.

   Silvano Brewster and Bill Fenner of AT&T Laboratories helped
   considerably with makeing the text clear and DRegex tight.

   Bert Culpepper and Allison Manking gave an early version of this
   document a good scouring.



Burger & Dolly          Expires January 13, 2005               [Page 57]


Internet-Draft                    KPML                         July 2004


   Rohan Mahy gave Martin and I considerable moral support in the
   production of this document.

















































Burger & Dolly          Expires January 13, 2005               [Page 58]


Internet-Draft                    KPML                         July 2004


Intellectual Property Statement

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at
   ietf-ipr@ietf.org.

   The IETF has been notified of intellectual property rights claimed in
   regard to some or all of the specification contained in this
   document.  For more information consult the online list of claimed
   rights.


Disclaimer of Validity

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
   ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Copyright Statement

   Copyright (C) The Internet Society (2004).  This document is subject
   to the rights, licenses and restrictions contained in BCP 78, and
   except as set forth therein, the authors retain all their rights.





Burger & Dolly          Expires January 13, 2005               [Page 59]


Internet-Draft                    KPML                         July 2004


Acknowledgment

   Funding for the RFC Editor function is currently provided by the
   Internet Society.















































Burger & Dolly          Expires January 13, 2005               [Page 60]