RFC 5806 HISTORIC TELEPHONY · SIP · SIGNALING

SIP Diversion: Diversion Indication in SIP

A header to track where a call was forwarded from and why.

On rfc-editor.org ↗
PUBLISHED
March 2010
AUTHORS
S. Levy, M. Mohali
STREAM
INDEPENDENT
CARRIED IN
Requests and 3xx responses
PARAMETERS
reason, counter, limit, privacy, screen
COUNTER AND LIMIT FORMAT
One or two digits
PRIVACY VALUES
full, name, uri, off
SCREEN VALUES
yes, no
DOI
10.17487/RFC5806
ERRATA
Reported errata

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Independent Submission                                           S. Levy
Request for Comments: 5806                                 Cisco Systems
Category: Historic                                        M. Mohali, Ed.
ISSN: 2070-1721                                              Orange Labs
                                                              March 2010


                      Diversion Indication in SIP

Abstract

   This RFC, which contains the text of an Internet Draft that was
   submitted originally to the SIP Working Group, is being published now
   for the historical record and to provide a reference for later
   Informational RFCs.  The original Abstract follows.

   This document proposes an extension to the Session Initiation
   Protocol (SIP).  This extension provides the ability for the called
   SIP user agent to identify from whom the call was diverted and why
   the call was diverted.  The extension defines a general header,
   Diversion, which conveys the diversion information from other SIP
   user agents and proxies to the called user agent.

   This extension allows enhanced support for various features,
   including Unified Messaging, Third-Party Voicemail, and Automatic
   Call Distribution (ACD).  SIP user agents and SIP proxies that
   receive diversion information may use this as supplemental
   information for feature invocation decisions.

Status of This Memo

   This document is not an Internet Standards Track specification; it is
   published for the historical record.

   This document defines a Historic Document for the Internet community.
   This is a contribution to the RFC Series, independently of any other
   RFC stream.  The RFC Editor has chosen to publish this document at
   its discretion and makes no statement about its value for
   implementation or deployment.  Documents approved for publication by
   the RFC Editor are not a candidate for any level of Internet
   Standard; see Section 2 of RFC 5741.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc5806.

IESG Note

   This document contains an early proposal to the IETF SIP Working
   Group that was not chosen for standardization.  Discussions on the
   topic resulted in the informational RFC 3325, "Private Extensions to
   the Session Initiation Protocol (SIP) for Asserted Identity within
   Trusted Networks", and the standard solution that was chosen can be
   found in RFC 4244, "An Extension to the Session Initiation Protocol
   (SIP) for Request History Information".

Copyright Notice

   Copyright (c) 2010 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.

Table of Contents

   1. Introduction ....................................................4
   2. Terminology .....................................................4
      2.1. Requirements Language ......................................4
      2.2. Definitions ................................................4
      2.3. Abbreviations ..............................................5
   3. Overview ........................................................5
      3.1. When Is the Diversion Header Used? .........................6
   4. Extension Syntax ................................................6
   5. Detailed Semantics ..............................................7
      5.1. UAS Behavior ...............................................7
      5.2. UAC Behavior ...............................................7
      5.3. Redirect Server Behavior ...................................7
      5.4. Proxy Server Behavior ......................................7
   6. Examples Using Diversion Header .................................8
      6.1. Call Forward Unconditional .................................8
      6.2. Call Forward on Busy ......................................13
      6.3. Call Forward on No-Answer .................................17
      6.4. Call Forward on Unavailable ...............................21
      6.5. Multiple Diversions .......................................24
   7. Security Considerations ........................................27
   8. Further Examples ...............................................27
      8.1. Night Service/Automatic Call Distribution (ACD)
           Using Diversion Header ....................................27
      8.2. Voicemail Service Using Diversion Header ..................36
      8.3. Questions and Answers on Alternative Approaches ...........41
 9. Mapping ISUP/ISDN Redirection Information to SIP
      Diversion Header ...............................................42
      9.1. Mapping ISUP/ISDN Diversion Reason Codes ..................42
      9.2. Mapping ISUP Redirection Information to SIP
           Diversion Header ..........................................43
      9.3. Mapping ISDN Redirection Information to SIP
           Diversion Header ..........................................47
      9.4. Information Loss in SIP to ISUP/ISDN Translation ..........52
   10. Contributors ..................................................53
   11. Acknowledgements ..............................................53
   12. Normative References ..........................................53

1.  Introduction

   This RFC, which contains the text of an Internet Draft that was
   submitted originally to the SIP Working Group, is being published now
   for the historical record and to provide a reference for later
   Informational RFCs.

   In the legacy telephony network, redirection information is passed
   through the network in ISDN/ISUP (ISDN User Part) signaling messages.
   This information is used by various service providers and business
   applications to support enhanced features for the end user.

   An analogous mechanism of providing redirection information would
   enable such enhanced features for SIP users.

   The Diversion header allows implementation of feature logic based on
   from whom the call was diverted.

2.  Terminology

2.1.  Requirements Language

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

2.2.  Definitions

   diversion:

      A change to the ultimate destination endpoint of a request.  A
      change in the Request-URI of a request that was not caused by a
      routing decision.  This is also sometimes called a deflection or
      redirection.

      A diversion can occur when the "user" portion of the Request-URI
      is changed for a reason other than expansion or translation.

      A diversion can occur when only the "host" portion of the Request-
      URI has changed if the change was due to a non-routing decision.

   divertor:

      The entity that diverted the call.

   recursing:

      A SIP proxy or user agent that handles a received or internally
      generated 3xx response by forking new request(s) itself.

   non-recursing:

      A SIP proxy or user agent that handles a received or internally
      generated 3xx response by forwarding it upstream.

2.3.  Abbreviations

   CFUNC: Call Forward Unconditional

   CFTOD: Call Forward Time-of-Day

   CFB:   Call Forward on Busy

   CFNA:  Call Forward on No Answer

   CFUNV: Call Forward Unavailable

   ACD:   Automatic Call Distribution

3.  Overview

   In order to implement certain third-party features such as Third-
   Party Voicemail and Automatic Call Distribution (ACD) applications,
   diversion information needs to be given to the called third party so
   that he may respond to the caller intelligently.  In these
   situations, the party receiving a diverted call needs answers for two
   questions:

   Question 1: From whom was the request diverted?

   Question 2: Why was the request diverted?

   This document proposes usage of the Diversion header to answer these
   questions for the party receiving the diverted call.

   Insertion of the previous Request-URI (before the diversion occurred)
   into the Diversion header answers question 1.

   Insertion of the "reason" tag into the Diversion header (by the
   divertor) answers question 2.

3.1.  When Is the Diversion Header Used?

   The Diversion header SHOULD be added when a SIP proxy server, SIP
   redirect server, or SIP user agent changes the ultimate endpoint that
   will receive the call.

   Diversion information SHOULD NOT be added for normal call routing
   changes to the Request-URI.  Thus, the Diversion header is not added
   when features such as speed dial change the Request-URI.

   When a diversion occurs, a Diversion header SHOULD be added to the
   forwarded request or forwarded 3xx response.  The Diversion header
   MUST contain the Request-URI of the request prior to the diversion.
   The Diversion header SHOULD contain a reason that the diversion
   occurred.

   Existing Diversion headers received in an incoming request MUST NOT
   be removed or changed in forwarded requests.

   Existing Diversion headers received in an incoming response MUST NOT
   be removed or changed in the forwarded response.

   A Diversion header is added when features such as call forwarding or
   call deflection change the Request-URI.

4.  Extension Syntax

   The syntax of the Diversion header is:

   Diversion = "Diversion" ":" 1# (name-addr *( ";" diversion_params ))
   diversion-params = diversion-reason | diversion-counter |
                      diversion-limit | diversion-privacy |
                      diversion-screen | diversion-extension
   diversion-reason = "reason" "="
                   ( "unknown" | "user-busy" | "no-answer" |
                     "unavailable" | "unconditional" |
                     "time-of-day" | "do-not-disturb" |
                     "deflection" | "follow-me" |
                     "out-of-service" | "away" |
                     token | quoted-string )
   diversion-counter = "counter" "=" 1*2DIGIT
   diversion-limit = "limit" "=" 1*2DIGIT
   diversion-privacy = "privacy" "=" ( "full" | "name" |
                       "uri" | "off" | token | quoted-string )
   diversion-screen = "screen" "=" ( "yes" | "no" | token |
                                        quoted-string )
   diversion-extension = token ["=" (token | quoted-string)]
   The following is an extension of tables 4 and 5 in [RFC3261] for the
   Diversion header:
                       where  enc.  e-e ACK BYE CAN INV OPT REG
   _____________________________________________________________
   Diversion              R           h   -   -   -   o   -   -
   Diversion             3xx          h   -   -   -   o   -   -

5.  Detailed Semantics

5.1.  UAS Behavior

   A SIP User Agent Service (UAS) that receives a request and returns a
   3xx SHOULD add a Diversion header containing the previous Request-URI
   and the reason for the diversion.

5.2.  UAC Behavior

   A SIP UAC that receives a 3xx containing a Diversion header SHOULD
   copy the Diversion header into each downstream forked request that
   resulted from the 3xx.

5.3.  Redirect Server Behavior

   A SIP redirect server that receives a request and returns a 3xx
   containing a Contact that diverts the request to a different endpoint
   SHOULD add a Diversion header containing the Request-URI from the
   incoming request and the reason for the diversion.

5.4.  Proxy Server Behavior

   A non-recursing SIP proxy that receives a 3xx containing a Diversion
   header SHOULD forward the 3xx containing the Diversion header
   upstream unchanged.

   A SIP proxy that receives a request and invokes a feature that
   changes the Request-URI of the forwarded request in order to divert
   the request to a different endpoint SHOULD add a Diversion header
   containing the Request-URI from the incoming request and the reason
   for the diversion.

   A SIP proxy that receives a request and returns a 3xx containing a
   Contact that diverts the request to a different endpoint SHOULD add a
   Diversion header containing the Request-URI from the incoming request
   and the reason for the diversion.

5.4.1.  Proxy Logic for Diversion Header

      if (pdu.is_request()) {
          if (request-URI is changed due to a called feature) {
              if (proxy.is_recursing()) {
                  Add the Diversion header (indicating the reason
                    that the call has been diverted) to
                    the downstream forwarded request(s).
              } else {
                  Add the Diversion header (indicating the reason
                    that the call has been diverted) to
                    the upstream forwarded 3xx response.
              }
          }
      } else if (pdu.is_response()) {
          if (pdu.is_3xx()) {
              if (proxy.is_recursing()) {
                Copy Diversion header into forwarded INVITE(s).
              } else {
                Forward response upstream.
              }
          }
      }

6.  Examples Using Diversion Header

   There are several implementations of call forwarding features that
   can be implemented by either recursing or non-recursing SIP proxies
   or SIP user agents.

   A SIP proxy or user agent that generates or forwards 3xxs upstream is
   non-recursing.  A SIP proxy or user agent that handles received (or
   internally generated) 3xxs itself is recursing.

   The following examples illustrate usage of the Diversion header for
   some of the variants of recursing and non-recursing proxies and user
   agents.

6.1.  Call Forward Unconditional

   Usage of the Diversion header is shown below for several variant
   implementations of Call Forward Unconditional.

6.1.1.  Network Call Forward Unconditional (P2 Recursing)

   In this message flow, the call would normally be routed to Bob@B.
   However, Proxy 2 (P2) recursively implements Call Forward
   Unconditional (CFUNC) to Carol@C.

                     +------------------------+
                     | Bob@P2: CFUNC->Carol@C |
                     +------+-----------------+
                             \
                              \
A             P1              P2            B          C
                            recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INVITE Carol@C------->|
|              |              |  Diversion: Bob@P2     |
|              |              |    ;reason=unconditional
|              |              |             |          |
|              |              |<-200-------------------|
|              |              |             |          |
|              |<-200---------|             |          |
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.1.2.  Network Call Forward Unconditional (P1 Non-Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward Unconditional (CFUNC) to Carol@C.  Proxy 1 (P1) is non-
   recursing.

                     +------------------------+
                     | Bob@P2: CFUNC->Carol@C |
                     +------+-----------------+
                             \
                              \
A              P1             P2            B          C
            non-recursing  non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unconditional   |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|<-302---------|              |             |          |
|  Contact: Carol@C           |             |          |
|  Diversion: Bob@P2          |             |          |
|    ;reason=unconditional    |             |          |
|              |              |             |          |
|--ACK-------->|              |             |          |
|              |              |             |          |
|--INVITE Carol@C------------------------------------->|
|  Diversion: Bob@P2          |             |          |
|    ;reason=unconditional    |             |          |
|              |              |             |          |
|<-200-------------------------------------------------|
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.1.3.  Network Call Forward Unconditional (P1 Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward Unconditional (CFUNC) to Carol@C.  Proxy 1 (P1) is recursing.

                     +------------------------+
                     | Bob@P2: CFUNC->Carol@C |
                     +------+-----------------+
                             \
                              \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unconditional   |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unconditional   |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.1.4.  Endpoint Call Forward Unconditional (P1 Recursing, P2 Non-
        Recursing)

   In this message flow, user agent server B (B) non-recursively
   implements Call Forward Unconditional (CFUNC) to Carol@C.  Proxy 2
   (P2) is non-recursing.  Proxy 1 (P1) is recursing.

                                    +-----------------------+
                                    | Bob@B: CFUNC->Carol@C |
                                    +------+----------------+
                                            \
                                             \
A              P1             P2              B          C
            recursing      non-recursing
|              |              |               |          |
|--INV Bob@P1->|              |               |          |
|              |              |               |          |
|              |--INV Bob@P2->|               |          |
|              |              |--INV Bob@B--->|          |
|              |              |               |          |
|              |              |<-302----------|          |
|              |              |  Contact: Carol@C        |
|              |              |  Diversion: Bob@B        |
|              |              |    ;reason=unconditional
|              |              |               |          |
|              |              |--ACK--------->|          |
|              |              |               |          |
|              |<-302---------|               |          |
|              |  Contact: Carol@C            |          |
|              |  Diversion: Bob@B            |          |
|              |    ;reason=unconditional     |          |
|              |              |               |          |
|              |--ACK-------->|               |          |
|              |              |               |          |
|              |--INVITE Carol@C------------------------>|
|              |  Diversion: Bob@B            |          |
|              |    ;reason=unconditional     |          |
|              |              |               |          |
|              |<-200------------------------------------|
|              |              |               |          |
|<-200---------|              |               |          |
|              |              |               |          |
|--ACK-------------------------------------------------->|
|              |              |               |          |
|              |              |               |          |

6.2.  Call Forward on Busy

   Usage of the Diversion header is shown below for several variant
   implementations of Call Forward on Busy.

6.2.1.  Network Call Forward on Busy (P2 Recursing)

   In this message flow, Proxy 2 (P2) recursively implements Call
   Forward on Busy (CFB) to Carol@C.

                     +----------------------+
                     | Bob@P2: CFB->Carol@C |
                     +------+---------------+
                             \
                              \
A              P1             P2            B          C
                           recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-486--------|          |
|              |              |             |          |
|              |              |--ACK------->|          |
|              |              |             |          |
|              |              |--INVITE Carol@C------->|
|              |              |  Diversion: Bob@P2     |
|              |              |    ;reason=user-busy   |
|              |              |             |          |
|              |              |<-200-------------------|
|              |              |             |          |
|              |<-200---------|             |          |
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.2.2.  Network Call Forward on Busy (P1 Non-Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on Busy (CFB) to Carol@C.  Proxy 1 (P1) is non-recursing.

                     +----------------------+
                     | Bob@P2: CFB->Carol@C |
                     +------+---------------+
                             \
                              \
A              P1             P2            B          C
            non-recursing  non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-486--------|          |
|              |              |             |          |
|              |              |--ACK------->|          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=user-busy       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|<-302---------|              |             |          |
|  Contact: Carol@C           |             |          |
|  Diversion: Bob@P2          |             |          |
|    ;reason=user-busy        |             |          |
|              |              |             |          |
|--ACK-------->|              |             |          |
|              |              |             |          |
|--INVITE Carol@C------------------------------------->|
|  Diversion: Bob@P2          |             |          |
|    ;reason=user-busy        |             |          |
|              |              |             |          |
|<-200-------------------------------------------------|
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.2.3.  Network Call Forward on Busy (P1 Recursing, P2 Non-Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on Busy (CFB) to Carol@C.  Proxy 1 (P1) is recursing.

                     +----------------------+
                     | Bob@P2: CFB->Carol@C |
                     +------+---------------+
                             \
                              \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-486--------|          |
|              |              |             |          |
|              |              |--ACK------->|          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=user-busy       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=user-busy       |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.2.4.  Endpoint Call Forward on Busy (P1 Recursing, P2 Non-Recursing)

   In this message flow, user agent server B (B) non-recursively
   implements Call Forward on Busy (CFB) to Carol@C.  Proxy 2 (P2) is
   non-recursing.  Proxy 1 (P1) is recursing.

                               +---------------------+
                               | Bob@B: CFB->Carol@C |
                               +------+--------------+
                                          \
                                           \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-302--------|          |
|              |              |  Contact: Carol@C      |
|              |              |  Diversion: Bob@B      |
|              |              |    ;reason=user-busy   |
|              |              |             |          |
|              |              |--ACK------->|          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@B          |          |
|              |    ;reason=user-busy       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@B          |          |
|              |    ;reason-user-busy       |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.3.  Call Forward on No-Answer

   Usage of the Diversion header is shown below for several variant
   implementations of Call Forward on No-Answer.

6.3.1.  Network Call Forward on No-Answer (P2 Recursing)

   In this message flow, Proxy 2 (P2) recursively implements Call
   Forward on No Answer (CFNA) to Carol@C.

                     +-----------------------+
                     | Bob@P2: CFNA->Carol@C |
                     +------+----------------+
                             \
                              \
A              P1             P2            B          C
                           recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-180--------|          |
|              |              |             |          |
|              |              |             |          |
|              |              |             |          |
|              |           timeout          |          |
|              |              |--INVITE Carol@C------->|
|              |              |  Diversion: Bob@P2     |
|              |              |    ;reason=no-answer   |
|              |              |             |          |
|              |              |<-200-------------------|
|              |              |             |          |
|              |<-200---------|             |          |
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.3.2.  Network Call Forward on No-Answer (P1 Non-Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on No Answer (CFNA) to Carol@C.  Proxy 1 (P1) is non-
   recursing.

                     +-----------------------+
                     | Bob@P2: CFNA->Carol@C |
                     +------+----------------+
                             \
                              \
A              P1             P2            B          C
            non-recursing  non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-180--------|          |
|              |              |             |          |
|              |              |             |          |
|              |              |             |          |
|              |           timeout          |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=no-answer       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|<-302---------|              |             |          |
|  Contact: Carol@C           |             |          |
|  Diversion: Bob@P2          |             |          |
|    ;reason=no-answer        |             |          |
|              |              |             |          |
|--ACK-------->|              |             |          |
|              |              |             |          |
|--INVITE Carol@C------------------------------------->|
|  Diversion: Bob@P2          |             |          |
|    ;reason=no-answer        |             |          |
|              |              |             |          |
|<-200-------------------------------------------------|
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |

6.3.3.  Network Call Forward on No Answer (P1 Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on No Answer (CFNA) to Carol@C.  Proxy 1 (P1) is recursing.

                     +-----------------------+
                     | Bob@P2: CFNA->Carol@C |
                     +------+----------------+
                             \
                              \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |<-180--------|          |
|              |              |             |          |
|              |              |             |          |
|              |              |             |          |
|              |            timeout         |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=no-answer       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=no-answer       |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.3.4.  Endpoint Call Forward on No-Answer (P1 Recursing, P2 Non-
        Recursing, B Non-Recursing)

   In this message flow, user agent server B (B) non-recursively
   implements Call Forward on No Answer (CFNA) to Carol@C.  Proxy 2 (P2)
   is non-recursing.  Proxy 1 (P1) is recursing.

                                  +----------------------+
                                  | Bob@B: CFNA->Carol@C |
                                  +------+---------------+
                                          \
                                           \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |             |          |
|              |              |             |          |
|              |              |             |          |
|              |              |          timeout       |
|              |              |<-302--------|          |
|              |              |  Contact: Carol@C      |
|              |              |  Diversion: Bob@B      |
|              |              |    ;reason=no-answer   |
|              |              |             |          |
|              |              |--ACK------->|          |
|              |              |             |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@B          |          |
|              |    ;reason=no-answer       |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@B          |          |
|              |    ;reason-no-answer       |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |

6.4.  Call Forward on Unavailable

   Usage of the Diversion header is shown below for several variant
   implementations of Call Forward on Unavailable.

6.4.1.  Network Call Forward on Unavailable (P2 Recursing)

   In this message flow, Proxy 2 (P2) recursively implements Call
   Forward on Unavailable (CFUNV) to Carol@C.

                     +------------------------+
                     | Bob@P2: CFUNV->Carol@C |
                     +------+-----------------+
                             \
                              \
A              P1             P2            B          C
                           recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|<-100---------|              |             |          |
|              |--INV Bob@P2->|             |          |
|              |<-100---------|             |          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |  ...        |          |
|              |              |--INV Bob@B->|          |
|              |           timeout          |          |
|              |              |--INVITE Carol@C------->|
|              |              |  Diversion: Bob@P2     |
|              |              |    ;reason=unavailable
|              |              |             |          |
|              |              |<-200-------------------|
|              |              |             |          |
|              |<-200---------|             |          |
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.4.2.  Network Call Forward on Unavailable (P1 Non-Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on Unavailable (CFUNV) to Carol@C.  Proxy 1 (P1) is non-
   recursing.

                     +------------------------+
                     | Bob@P2: CFUNV->Carol@C |
                     +------+-----------------+
                             \
                              \
A              P1             P2            B          C
            non-recursing  non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|              |              |             |          |
|              |--INV Bob@P2->|             |          |
|              |              |             |          |
|              |<-100---------|             |          |
|              |              |             |          |
|<-100---------|              |             |          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |  ...        |          |
|              |              |--INV Bob@B->|          |
|              |           timeout          |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unavailable     |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|<-302---------|              |             |          |
|  Contact: Carol@C           |             |          |
|  Diversion: Bob@P2          |             |          |
|    ;reason=unavailable      |             |          |
|              |              |             |          |
|--ACK-------->|              |             |          |
|              |              |             |          |
|--INVITE Carol@C------------------------------------->|
|  Diversion: Bob@P2          |             |          |
|    ;reason=unavailable      |             |          |
|              |              |             |          |
|<-200-------------------------------------------------|
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.4.3.  Network Call Forward on Unavailable (P1 Recursing, P2 Non-
        Recursing)

   In this message flow, Proxy 2 (P2) non-recursively implements Call
   Forward on Unavailable (CFUNV) to Carol@C.  Proxy 1 (P1) is
   recursing.

                     +------------------------+
                     | Bob@P2: CFUNV->Carol@C |
                     +------+-----------------+
                             \
                              \
A              P1             P2            B          C
            recursing      non-recursing
|              |              |             |          |
|--INV Bob@P1->|              |             |          |
|<-100---------|              |             |          |
|              |--INV Bob@P2->|             |          |
|              |<-100---------|             |          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |--INV Bob@B->|          |
|              |              |  ...        |          |
|              |              |--INV Bob@B->|          |
|              |           timeout          |          |
|              |<-302---------|             |          |
|              |  Contact: Carol@C          |          |
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unavailable     |          |
|              |              |             |          |
|              |--ACK-------->|             |          |
|              |              |             |          |
|              |--INVITE Carol@C---------------------->|
|              |  Diversion: Bob@P2         |          |
|              |    ;reason=unavailable     |          |
|              |              |             |          |
|              |<-200----------------------------------|
|              |              |             |          |
|<-200---------|              |             |          |
|              |              |             |          |
|--ACK------------------------------------------------>|
|              |              |             |          |
|              |              |             |          |

6.5.  Multiple Diversions

   Usage of the Diversion header when multiple diversions occur are
   shown the following two examples.

6.5.1.  Call Forward Unconditional and Call Forward Busy

   In this message flow, Proxy 2 (P2) implements Call Forward
   Unconditional (CFUNC) to Carol@C.  C then implements Call Forward on
   Busy (CFB) to 5551234@D.  P2 is non-recursing.  P1 is recursing.  C
   is non-recursing.

            +------------------------+     +-------------------------+
            | Bob@P2: CFUNC->Carol@C |     | Carol@C: CFB->5551234@D |
            +---------------+--------+     +--------+----------------+
                             \                       \
                              \                       \
A              P1             P2            B          C          D
            recursing      non-recursing          non-recursing
|              |              |             |          |          |
|--INV Bob@P1->|              |             |          |          |
|              |              |             |          |          |
|              |--INV Bob@P2->|             |          |          |
|              |              |             |          |          |
|              |<-302---------|             |          |          |
|              |  Contact: Carol@C          |          |          |
|              |  Diversion: Bob@P2         |          |          |
|              |    ;reason=unconditional   |          |          |
|              |              |             |          |          |
|              |--ACK-------->|             |          |          |
|              |              |             |          |          |
|              |--INVITE Carol@C---------------------->|          |
|              |  Diversion: Bob@P2         |          |          |
|              |    ;reason=unconditional   |          |          |
|              |              |             |          |          |
|              |<-302----------------------------------|          |
|              |  Contact: 5551234@D        |          |          |
|              |  Diversion: Carol@C        |          |          |
|              |    ;reason=user-busy       |          |          |
|              |    ;privacy="full"         |          |          |
|              |  Diversion: Bob@P2         |          |          |
|              |    ;reason=unconditional   |          |          |
|              |              |             |          |          |
|              |--ACK--------------------------------->|          |
|              |              |             |          |          |
|              |--INVITE 5551234@D------------------------------->|
|              |  Diversion: Carol@C        |          |          |
|              |    ;reason=user-busy       |          |          |
|              |    ;privacy="full"         |          |          |
|              |  Diversion: Bob@P2         |          |          |
|              |    ;reason=unconditional   |          |          |
|              |              |             |          |          |
|              |<-200---------------------------------------------|
|              |              |             |          |          |
|<-200---------|              |             |          |          |
|              |              |             |          |          |
|--ACK----------------------------------------------------------->|
|              |              |             |          |          |
|              |              |             |          |          |

6.5.2.  Call Forward Unconditional and Call Forward No Answer

   In this message flow, Proxy 2 (P2) implements Call Forward
   Unconditional (CFUNC) to Carol@C.  (P2 would normally have routed the
   call to B).  C then implements Call Forward on No Answer (CFNA) to
   5551234@D.  P2 is recursing.  C is recursing.

         +------------------------+  +--------------------------+
         | Bob@P2: CFUNC->Carol@C |  | Carol@C: CFNA->5551234@D |
         +------------------+-----+  +-----+--------------------+
                             \              \
                              \              \
A              P1             P2       B      C                 D
                            recursing       recursing
|              |              |        |      |                 |
|--INV Bob@P1->|              |        |      |                 |
|              |              |        |      |                 |
|              |--INV Bob@P2->|        |      |                 |
|              |              |        |      |                 |
|              |              |--INV Carol@C->|                 |
|              |              |  Diversion: Bob@P2              |
|              |              |    ;reason=unconditional        |
|              |              |        |      |                 |
|              |              |<--180---------|                 |
|              |              |        |      |                 |
|              |<-180---------|        |      |                 |
|              |              |        |      |                 |
|<-180---------|              |        |      |                 |
|              |              |        |      |                 |
|              |              |        |      |                 |
|              |              |        |    timeout             |
|              |              |        |      |--INV 5551234@D->|
|              |              |        |      |Diversion: Carol@C
|              |              |        |      |  ;reason=no-answer
|              |              |        |      |  ;privacy="full"
|              |              |        |      |Diversion: Bob@P2
|              |              |        |      |  ;reason= unconditional
|              |              |        |      |                 |
|              |              |        |      |<-200------------|
|              |              |        |      |         |       |
|              |              |<-200----------|         |       |
|              |              |        |      |         |       |
|              |<-200---------|        |      |         |       |
|              |              |        |      |         |       |
|<-200---------|              |        |      |         |       |
|              |              |        |      |         |       |
|--ACK--------------------------------------------------------->|
|              |              |        |      |         |       |

7.  Security Considerations

   There are some privacy considerations when using the Diversion
   header.  Usage of the Diversion header implies that the diverting UAS
   trusts the diverted-to UAS.  Usage of the Diversion header by SIP
   proxies or SIP user agents can cause information leakage of route
   information and called information to untrusted SIP proxies and
   untrusted callers in upstream 3xxs.  Leakage of this information can
   be mitigated by having a recursing trusted upstream proxy server.
   For a SIP network architecture where all proxies are required to be
   non-recursive, Diversion header hiding may be considered necessary in
   order to prevent leakage of route information to the caller.  To
   accomplish Diversion header hiding, a trusted upstream proxy would
   add a Record-Route header and use a secret key to encrypt the
   contents of the Diversion header in 3xxs that are forwarded upstream.
   On receipt of re-INVITEs, the proxy would decrypt the contents of the
   Diversion header (using its secret key) and forward the INVITE.
   There is no currently defined interaction of the Diversion and Hide
   headers.  Question: Should there be?

8.  Further Examples

   Only the relevant headers have been included in the following
   examples.  The contents of the Session Description Protocols (SDPs)
   have also been omitted.

8.1.  Night Service/Automatic Call Distribution (ACD) Using Diversion
      Header

   In the following two message flows, two separate companies,
   WeSellPizza.com and WeSellFlowers.com, have contracted with a third
   company, NightService.com to provide nighttime support for their
   incoming voice calls.

   In the first flow, Alice calls out for pizza.  In the second flow,
   Alice calls for roses.  In both instances, the same night service
   company (and receptionist, Carol) answers the call.  However, because
   the Diversion header is used, Carol is able to customize her greeting
   to the caller.

                +-------------------------------------+
                | WeSellPizza@P2: CFTOD->nightserv@P3 |
                +------------+------------------------+
                              \
                               \
UAC             P1             P2                 P3               UAS1
                        (WeSellPizza.com)  (NightService.com)
                                                (ACD)
| [1]           |              |                   |                  |
|-INV pizza@P1->|              |                   |                  |
|               |              |                   |                  |
|               |              |                   |                  |
|               | [2] INVITE WeSellPizza@P2        |                  |
|               |------------->|                   |                  |
|               |              |                   |                  |
|               |              | [3]               |                  |
|               |              |-INV nightserv@P3->|                  |
|               |              | Diversion: WeSellPizza@P2            |
|               |              |   ;reason=time-of-day                |
|               |              |                   |                  |
|               |              |                   | [4]              |
|               |              |                   |-INV Carol@uas1-->|
|               |              |            Diversion: WeSellPizza@P2 |
|               |              |                ;reason=time-of-day   |
|               |              |                   |                  |
|               |              |                   |<-[5] 200---------|
|               |              |<-[6] 200----------|                  |
|               |<-[7] 200-----|                   |                  |
|<-[8] 200------|              |                   |                  |
|               |              |                   |                  |
|--[9] ACK----------------------------------------------------------->|
|               |              |                   |                  |
|<=========================================="Hello, WeSellPizza"======|
|               |              |                   |                  |
|               |              |                   |                  |

   Alice calls for pizza.

   [1] SIP UAC to SIP proxy server 1:

        INVITE sip:pizza@p1.isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:pizza@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   The ISP's originating proxy translated the keyword pizza to the
   company WeSellPizza.com

   [2] SIP proxy server 1 to SIP proxy server 2 (WeSellPizza.com):

        INVITE sip:WeSellPizza@p2.isp.com SIP/2.0
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:pizza@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   It's after midnight and the pizza people are in bed.  Fortunately,
   WeSellPizza.com has contracted with NightService.com to answer their
   nighttime calls.  Thus, P2 implements CFTOD to NightService.com.

   [3] SIP proxy server 2 (WeSellPizza.com) to
       SIP proxy server 3 (NightService.com):

        INVITE sip:NightService@p3.isp.com SIP/2.0
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:pizza@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:WeSellPizza@p2.isp.com>
          ;reason=time-of-day
        Content-Type: application/sdp

   Carol is available to receive the incoming call.

   [4] SIP proxy server 3 (NightService.com) to UAS1 (Carol):

        INVITE sip:carol@uas1.nightservice.com SIP/2.0
        Via: SIP/2.0/UDP p3.isp.com
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:pizza@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:WeSellPizza@p2.isp.com>
          ;reason=time-of-day
        Content-Type: application/sdp

   The ACD keys off the Diversion header to pull up the WeSellPizza FAQ
   on Carol's web browser.

   [5] UAS1 to SIP proxy server 3:

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP p3.isp.com
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:pizza@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [6] SIP proxy server 3 to SIP proxy server 2:

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:pizza@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [7] SIP proxy server 2 to SIP proxy server 1:

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:pizza@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [8] SIP proxy server 1 to UAC

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:pizza@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [9] SIP UAC to UAS1:

        ACK sip:uas1.nightservice.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: <sip:pizza@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   The RTP flows begin and Carol answers "Hello, WeSellPizza.  How may I
   help you?"

                 +---------------------------------------+
                 | WeSellFlowers@P4: CFTOD->nightserv@P3 |
                 +-------------+-------------------------+
                                \
                                 \
UAC             P1               P4                 P3              UAS1
                         (WeSellFlowers.com)  (NightService.com)
                                                   (ACD)
| [1]           |                |                   |                |
|-INV roses@P1->|                |                   |                |
|               |                |                   |                |
|               | [2] INVITE WeSellFlowers@P4        |                |
|               |--------------->|                   |                |
|               |                |                   |                |
|               | [3]            |                   |                |
|               |<-302-----------|                   |                |
|               |  Contact: nightservice@P3          |                |
|               |  Diversion: WeSellFlowers@P4       |                |
|               |    ;reason=time-of-day             |                |
|               |                |                   |                |
|               |--[4] ACK------>|                   |                |
|               |                |                   |                |
|               | [5]            |                   |                |
|               |-INVITE nightservice@P3------------>|                |
|               | Diversion: WeSellFlowers@P4        |                |
|               |   ;reason=time-of-day              |                |
|               |                |                   |                |
|               |                |                   | [6]            |
|               |                |               -INV Carol@uas1----->|
|               |                |          Diversion: WeSellFlowers@P4
|               |                |            ;reason=time-of-day
|               |                |                                    |
|               |                |              |<-[7] 200------------|
|               |<-[8] 200---------------------------|                |
|<-[9] 200------|                |                   |                |
|               |                |                   |                |
|--[10] ACK---------------------------------------------------------->|
|               |                |                   |                |
|<======================================="Hello, WeSellFlowers"=======|
|               |                |                   |                |
|               |                |                   |                |

   Alice calls for roses.

   [1] SIP UAC to SIP proxy server 1:

        INVITE sip:roses@p1.isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:roses@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   The ISP's originating proxy translated the keyword roses to the
   company WeSellFlowers.com

   [2] SIP proxy server 1 to SIP proxy server 4 (WeSellFlowers.com):

        INVITE sip:WeSellFlowers@p4.isp.com SIP/2.0
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:roses@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   It's now 1 a.m. and the florists are also in bed.  Fortunately,
   WeSellFlowers.com has contracted with NightService.com to answer
   their nighttime calls, too.  Thus, P4 implements CFTOD to
   NightService.com.

   [3] SIP proxy server 4 (WeSellFlowers.com) to
       SIP proxy server 1 (NightService.com):

        SIP/2.0 302 Moved Temporarily
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: NightService@p3.isp.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=p4
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:WeSellFlowers@p4.isp.com>
          ;reason=time-of-day

   [4] SIP proxy server 1 to SIP proxy server 4 (WeSellFlowers.com):
        ACK sip:uas1.nightservice.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=p4
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   [5] SIP proxy server 1 (WeSellFlowers.com) to
       SIP proxy server 3 (NightService.com):

        INVITE sip:NightService@p3.isp.com SIP/2.0
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:roses@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:WeSellFlowers@p4.isp.com>
          ;reason=time-of-day
        Content-Type: application/sdp

   Carol is available to receive the incoming call.

   [6] SIP proxy server 3 (NightService.com) to UAS1 (Carol):

        INVITE sip:carol@uas1.nightservice.com SIP/2.0
        Via: SIP/2.0/UDP p3.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:roses@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:WeSellFlowers@p4.isp.com>
          ;reason=time-of-day
        Content-Type: application/sdp

   The ACD keys off the Diversion header to pull up the WeSellFlowers
   FAQ on Carol's web browser.

   [7] SIP UAS1 to SIP proxy server 3:

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP p3.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [8] SIP proxy server 3 to SIP proxy server 1:

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [9] SIP proxy server 1 to UAC

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: carol@uas1.nightservice.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [10] SIP UAC to SIP UAS1:

        ACK sip:uas1.nightservice.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: <sip:roses@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   The RTP flows begin and Carol answers "Hello, WeSellFlowers.  How may
   I help you?"

8.2.  Voicemail Service Using Diversion Header

   Bob has contracted his Voicemail to a third-party company,
   Voicemail.com.  In this message flow, Bob has hit the Do-Not-Disturb
   button on his phone.  The Do-Not-Disturb functionality of Bob's phone
   is configured to CFUNC (Call Forward Unconditional) to
   voicemail@isp.com.  Because the Diversion header is used,
   Voicemail.com is able to place the incoming call into Bob's voice
   mailbox.

                 +---------------------------------------------+
                 | Bob@UAS1: CFDoNotDisturb->voicemail@isp.com |
                 +--------------------------------------+------+
                                                         \
                                                          \
UAC1               P1                P2            UAS1        UAS2
                                                          Voicemail.com
|                  |                  |              |          |
|--[1] INV Bob@P1->|                  |              |          |
|                  |                  |              |          |
|                  |--[2] INV Bob@P2->|              |          |
|                  |                  |              |          |
|                  |               [3] INV Bob@uas1->|          |
|                  |                  |              |          |
|                  |                [4] <- 302-------|          |
|                  |               Contact: voicemail@isp.com   |
|                  |               Diversion: Bob@uas1          |
|                  |                 ;reason=do-not-disturb     |
|                  |                  |              |          |
|                  |                  |[5] ACK------>|          |
|                  |                  |              |          |
|                  |<-[6] 302---------|              |          |
|                  |  Contact: voicemail@isp.com     |          |
|                  |  Diversion: Bob@uas1            |          |
|                  |    ;reason=do-not-disturb       |          |
|                  |                  |              |          |
|                  |--[7] ACK-------->|              |          |
|<-[8] 302---------|                  |              |          |
|  Contact: voicemail@isp.com         |              |          |
|  Diversion: Bob@uas1                |              |          |
|    ;reason=do-not-disturb           |              |          |
|                  |                  |              |          |
|--[9] ACK-------->|                  |              |          |
|                  |                  |              |          |
|--[10] INVITE voicemail@isp.com------------------------------->|
|  Diversion: Bob@uas1                |              |          |
|    ;reason=do-not-disturb           |              |          |
|                  |                  |              |          |
|<--[11] 200----------------------------------------------------|
|                  |                  |              |          |
|---[12] ACK--------------------------------------------------->|
|                  |                  |              |          |
|                  |                  |              |          |

   Alice calls Bob.

   [1] SIP UAC to SIP proxy server 1:

        INVITE sip:Bob@p1.isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:Bob@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   The ISP's originating proxy routes the request to proxy 2 (P2).

   [2] SIP proxy server 1 to SIP proxy server 2:

        INVITE sip:Bob@p2.isp.com SIP/2.0
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:Bob@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [3] SIP proxy server 2 to UAS1 (Bob's SIP phone):

        INVITE sip:Bob@uas1.isp.com SIP/2.0
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:Bob@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   Since Bob had hit the Do-Not-Disturb button on his SIP phone, Bob's
   phone forwards the call to his voicemail service.

   [4] User agent server 1 (UAS1) to SIP proxy server 2 (P2)

        SIP/2.0 302 Moved Temporarily
        Via: SIP/2.0/UDP p2.isp.com
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: Voicemail@isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:Bob@uas1.isp.com>
          ;reason=do-not-disturb

   [5] SIP proxy server 2 to UAS1 (Bob's SIP phone):

        ACK sip:Bob@uas1.isp.com SIP/2.0
        Via: SIP/2.0/UDP p2.isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   [6] SIP proxy server 2 (P2) to SIP proxy server 1 (P1):

        SIP/2.0 302 Moved Temporarily
        Via: SIP/2.0/UDP p1.isp.com
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: Voicemail@isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:Bob@uas1.isp.com>
          ;reason=do-not-disturb

   [7] SIP proxy server 1 to SIP proxy server 2:

        ACK sip:Bob@p2.isp.com SIP/2.0
        Via: SIP/2.0/UDP p1.isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   [8] SIP proxy server 1 (P1) to UAC (alice-pc):

        SIP/2.0 302 Moved Temporarily
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: Voicemail@isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:Bob@uas1.isp.com>
          ;reason=do-not-disturb

   [9] SIP UAC to SIP proxy server 1:

        ACK sip:Bob@p1.isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas1
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   [10] SIP UAC (alice-pc) to Voicemail server.

        INVITE sip:Voicemail@isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: sip:Bob@p1.isp.com
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Diversion: <sip:Bob@uas1.isp.com>
          ;reason=do-not-disturb
        Content-Type: application/sdp

   [11] Voicemail server to SIP UAC (alice-pc):

        SIP/2.0 200 OK
        Via: SIP/2.0/UDP alice-pc.isp.com
        Contact: Voicemail@isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas2
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE
        Content-Type: application/sdp

   [12] SIP UAC to Voicemail server:

        ACK sip:Voicemail@isp.com SIP/2.0
        Via: SIP/2.0/UDP alice-pc.isp.com
        From: sip:alice@isp.com
        To: <sip:Bob@p1.isp.com>;tag=uas2
        Call-ID: 12345600@alice-pc.isp.com
        CSeq: 1 INVITE

   Because the Diversion header is present, the Voicemail server is able
   to place Alice's message into Bob's voice mailbox.

8.3.  Questions and Answers on Alternative Approaches

   Question 1:

   Why do we need the Diversion header when we can see the To: header?

   Answer:

   a) The To: header is not guaranteed to have significance to the
      called party.

      For example, the To: header may contain a locally significant URL
      (to the caller) such as a private numbering plan, speed dial
      digits, telephony escape digits, or telephony prefix digits.

      Without a Diversion header, enumerating all possible locally
      significant To: headers that anyone might use to contact
      Bob@uas1.isp.com becomes a configuration problem at
      Voicemail@isp.com and is prone to namespace collision.

      Support for Diversion headers enables Bob to contract a third-
      party service (Voicemail@isp.com) with a single globally
      significant URL for his voice mailbox (Bob@uas1.isp.com).

   b) Given a set of multiple diversions, there is a policy decision of
      which Diversion header takes precedence for service logic.

      Different services (or even different users for the same service)
      may want to configure this policy differently (first, last, second
      to last, etc.).

   Question 2:

   Why do we need the Diversion header when we can see the Via: header?

   Answer:

   The Via header does not contain information about servers whom have
   deflected the call (using a 3xx).

9.  Mapping ISUP/ISDN Redirection Information to SIP Diversion Header

   The discussions below regarding ISUP/ISDN reflect generic elements in
   ISUP/ISDN.  In some variations of ISUP/ISDN, the information elements
   are represented differently.  Regardless of the ISUP/ISDN variant,
   translation should be performed for the "first redirecting number"
   and the "last redirecting number".

   In order to prevent ambiguity, it is important to highlight a
   terminology mismatch between ISUP/ISDN and SIP.  In SIP, a "redirect"
   indicates the act of returning a 3xx response.  In ISUP/ISDN, a
   "redirection" is diversion of a call by a network entity.  In
   ISUP/ISDN, a call may also be deflected (by an endpoint).  Diversion
   is the more generic term that refers to either the act of an network
   redirection or endpoint deflection.

   In SIP, Diversion can be implemented as either an upstream 3xx (non-
   recursive) or an additionally forked downstream request (recursive).
   In the following text, a lowercase "redirect" indicates the SIP
   usage, while an uppercase "Redirect" indicates ISUP usage.

9.1.  Mapping ISUP/ISDN Diversion Reason Codes

   ISUP and ISDN define the following diversion reasons:

      0000 = Unknown
      0001 = Call forwarding busy or called DTE busy
      0010 = Call forwarding no reply
      1111 = Call forwarding unconditional or systematic
             call redirection
      1010 = Call deflection or call forwarding by the called DTE
      1001 = Call forwarding DTE out of order
      Mapping of ISUP/ISDN reason codes to Diversion reason codes is
      performed as follows:

      ISUP/ISDN reason code       Diversion reason code
      0001                        "user-busy"
      0010                        "no-answer"
      1111                        "unconditional"
      1010                        "deflection"
      1001                        "unavailable"
      0000                        all others

9.2.  Mapping ISUP Redirection Information to SIP Diversion Header

   This section describes how generic ISUP diversion information
   elements may be translated across an ISUP/SIP gateway.

9.2.1.  ISUP Definitions

   Called Party Number          The number of the party to which the
                                call is currently being routed.

   Redirecting Number           The number to which the call was being
                                routed when the last diversion occurred.

   Redirecting Reason           The reason that the last diversion
                                occurred.

   Original Called Number       The number to which the call was being
                                routed when the first diversion
                                occurred.

   Original Redirecting Reason  The reason that the first diversion
                                occurred.

   Redirection Counter          The count of the total number of
                                diversions that have occurred.

   Address Presentation         Indication of whether presentation is
                                allowed or restricted.

9.2.2.  ISUP Parameters

   When a SIP call transits a SIP/ISUP gateway, the following
   information in the ISUP message should be examined/set when
   translating SIP Diversion headers to ISUP diversion information:

      1) Redirecting Number

      2) Redirecting Reason

      3) Redirecting Address Presentation

      4) Original Called Number

      5) Original Redirecting Reason

      6) Original Address Presentation

      7) Redirection Counter

   An ISUP message contains information on the first and last diversions
   that occurred.  The Redirection number is the number to which the
   call was being routed when the last diversion occurred.  The
   Redirecting Reason is the reason that the last diversion occurred.

   The Original Called Number is the number to which the call was being
   routed when the first diversion occurred.  The Original Redirecting
   Reason is the reason that the first diversion occurred.

   When only one Diversion has occurred, the number to which the call
   was being routed when the diversion occurred is in the Redirecting
   Number and the reason for that diversion is carried in the Redirect
   Reason.

9.2.3.  ISUP to SIP Translation

   The ISUP Redirecting Number SHOULD be used to set the value of the
   name-addr of the top-most Diversion header.  The ISUP Redirecting
   Number address presentation SHOULD be used to set the value of the
   diversion-privacy of the top-most Diversion header.  The ISUP
   Redirecting Reason SHOULD be used to set the value of the diversion-
   reason of the top-most Diversion header.  When present, the Original
   Called Number SHOULD be used to set the name-addr of the bottom-most
   Diversion header.  When present, the Original Redirecting Reason
   SHOULD be used to set the diversion-reason of the bottom-most
   Diversion header.  When present, the Original Address Presentation
   SHOULD be used to set the diversion-privacy of the bottom-most
   Diversion header.

   The Redirection Counter value minus 1 SHOULD be stored in the
   diversion- counter associated with the top-most Diversion header.
   Presence of the diversion-counter for the bottom-most Diversion
   header is optional.  If present, the diversion-counter of the bottom-
   most Diversion header SHOULD be 1.

9.2.4.  SIP to ISUP Translation

   The name-addr of the top-most Diversion header SHOULD be used to set
   the ISUP Redirecting Number.  The diversion-reason of the top-most
   Diversion header SHOULD be used to set the ISUP Redirecting Reason.
   The diversion-privacy of the top-most Diversion header SHOULD be used
   to set the ISUP Redirecting Address Presentation.

   When multiple Diversion headers are present, the name-addr of the
   bottom- most Diversion header SHOULD be used to set the ISUP Original
   Redirecting Number.  When multiple Diversion headers are present, the
   diversion-reason of the bottom-most Diversion header SHOULD be used
   to set the ISUP Original Redirecting Reason.  When multiple Diversion
   headers are present, the diversion-privacy of the bottom-most
   Diversion header SHOULD be used to set the ISUP Original Redirecting
   Address Presentation.

   The ISUP Redirection Counter SHOULD be set equal to the sum of the
   counters of all Diversion headers in the SIP message.  A Diversion
   header that does not explicitly specify a diversion-counter tag
   counts as 1.

9.2.5.  Example of ISUP to SIP Translation

                                   ISUP/SIP GW
                                       |
--IAM--------------------------------->|
  Called Party Number    =+19195551004 |
  Redirecting Number     =+19195551002 |
    Address Presentation =presentation restricted
  Original Called Number =+19195551001 |
  RedirectionInformation:              |
    Original Redirecting Reason = Unconditional (1111)
    Redirecting Reason = User busy (0001)
    Redirection Counter = 5            |
                                       |
                                       |--INVITE +19195551004------>
                                       |  Diversion: <tel:+19195551002>
                                       |    ;reason=user-busy
                                       |    ;privacy="full"
                                       |    ;counter=4
                                       |  Diversion: <tel:+19195551001>
                                       |    ;reason=unconditional
                                       |    ;counter=1
                                       |
                                       |

9.2.6.  Example of SIP to ISUP Translation

                                   ISUP/SIP GW
                                       |
                                       |<--INVITE +19195551004------
                                       |  Diversion: <tel:+19195551002>
                                       |    ;reason=user-busy
                                       |    ;privacy="full"
                                       |    ;counter=4
                                       |  Diversion: <tel:+19195551001>
                                       |    ;reason=unconditional
                                       |    ;counter=1
                                       |
                                       |
                                       |
<--IAM---------------------------------|
  Called Party Number    =+19195551004 |
  Redirecting Number     =+19195551002 |
    Address Presentation =presentation restricted
  Original Called Number =+19195551001 |
  RedirectionInformation:              |
    Original Redirecting Reason = Unconditional (1111)
    Redirecting Reason = User busy (0001)
    Redirection Counter = 5            |

9.3.  Mapping ISDN Redirection Information to SIP Diversion Header

   An ISDN message can contain up to two instances of a Redirecting
   Number information element.  When a diversion occurs, an additional
   Redirection number information element is added.  When a third (or
   greater) diversion occurs, the new Redirecting Number information
   element replaces the bottom-most Redirection number information
   element.

9.3.1.  ISDN Definitions

   Called Party Number          The number of the party to which the
                                call is currently being routed.

   Redirecting Number
   information element          Aggregate information element that
                                contains Redirecting number and Reason
                                for diversion.

   Redirecting Number           The number to which the call was being
                                routed when the last diversion occurred.

   Reason for Diversion         The reason that the last diversion
                                occurred.

   Origin of Number             Indicates whether the number is user
                                provided and screened or network
                                provided.

   Presentation Status          Indicates if presentation is allowed or
                                prohibited.

9.3.2.  ISDN Parameters

   When a SIP call transits a SIP/ISDN gateway, the following
   information in the ISDN message should be examined/set when
   translating SIP Diversion headers to ISDN diversion information:

      1) Redirecting Number of the top-most Redirecting Number
         information element

      2) Reason for diversion of the top-most Redirection number
         information element

      3) Origin of Number and Presentation Status of the top-most
         Redirection number information element

      4) Redirection number of the bottom-most Redirection number
         information element

      5) Reason for diversion of the bottom-most Redirection number
         information element

      6) Origin of Number and Presentation Status of the bottom-most
         Redirection number information element

   An ISDN message contains information on the first and last diversions
   that occurred.  The top-most Redirection number information element
   contains information (including the Redirecting Number, Origin of
   Number, Presentation Status, and Reason for diversion) about the last
   diversion that occurred.  The bottom-most Redirection number
   information element contains information (including the Redirecting
   Number, Origin of Number, Presentation Status, and Reason for
   diversion) about the first diversion that occurred.

   If only one Diversion has occurred, only one Redirection number
   information element is present.

   The Redirecting Number information element has the same Type of
   Number/Numbering Plan, and Digits as the Calling Party Number
   information element.

   There is no Redirection Counter associated with this ISDN information
   element.

   Notice that the order of the Redirection number information elements
   in an ISDN message (top=first, bottom=last) is reversed from the
   order of Diversion headers in a SIP message (top=last, bottom=first).

9.3.3.  ISDN to SIP Translation

   The Redirecting Number of the top-most ISDN Redirecting Number
   information element SHOULD be used to set the value of the name-addr
   of the bottom-most Diversion header.  The Reason for Diversion of the
   top-most ISDN Redirecting Number information element SHOULD be used
   to set the value of the diversion-reason of the bottom-most Diversion
   header.

   The Origin of Number of the top-most ISDN Redirecting Number
   information element SHOULD be used to set the value of the diversion-
   screen of the bottom-most Diversion header.  The Presentation Status
   of the top-most ISDN Redirecting Number information element SHOULD be
   used to set the value of the diversion-privacy of the bottom-most
   Diversion header.

   The Redirecting Number of the bottom-most ISDN Redirecting Number
   information element SHOULD be used to set the value of the name-addr
   of the top-most Diversion header.  The Reason for Diversion of the
   bottom-most ISDN Redirecting Number information element SHOULD be
   used to set the value of the diversion-reason of the top-most
   Diversion header.

   The Origin of Number of the bottom-most ISDN Redirecting Number
   information element SHOULD be used to set the value of the diversion-
   screen of the top-most Diversion header.  The Presentation Status of
   the bottom-most ISDN Redirecting Number information element SHOULD be
   used to set the value of the diversion-privacy of the top-most
   Diversion header.

   Presence of the diversion-counter in each of the Diversion headers is
   optional.  If present, the diversion-counter of each Diversion header
   SHOULD be 1.

9.3.4.  SIP to ISDN Translation

   The name-addr of the top-most Diversion header SHOULD be used to set
   the Redirecting Number of the bottom-most ISDN Redirecting Number
   information element.

   The diversion-reason of the top-most Diversion header SHOULD be used
   to set the Reason for Diversion of the bottom-most ISDN Redirecting
   Number information element.

   The diversion-screen of the top-most Diversion header SHOULD be used
   to set the Origin of Number of the bottom-most ISDN Redirecting
   Number information element.

   The diversion-privacy of the top-most Diversion header SHOULD be used
   to set the Presentation Status of the bottom-most ISDN Redirecting
   Number information element.

   The name-addr of the bottom-most Diversion header SHOULD be used to
   set the Redirecting Number of the top-most ISDN Redirecting Number
   information element.

   The diversion-reason of the bottom-most Diversion header SHOULD be
   used to set the Reason for Diversion of the top-most ISDN Redirecting
   Number information element.

   The diversion-screen of the bottom-most Diversion header SHOULD be
   used to set the Origin of Number of the top-most ISDN Redirecting
   Number information element.

   The diversion-privacy of the bottom-most Diversion header SHOULD be
   used to set the Presentation Status of the top-most ISDN Redirecting
   Number information element.

9.3.5.  Example of ISDN to SIP Translation

                        ISDN/SIP GW
                                       |
--Setup------------------------------->|
  Called party number      =+19195551004
  Redirecting Number information element:
    Redirecting Number     =+19195551001
    Reason for redirection = Unconditional (1111)
    Origin of Number       = passed network screening
    Presentation Status    = presentation allowed
  Redirecting Number information element:
    Redirecting Number     =+19195551002
    Reason for redirection = User busy (0001)
    Origin of Number       = passed network screening
    Presentation Status    = presentation prohibited
                                       |
                                       |--INVITE tel:+19195551004---->
                                       |  Diversion: <tel:+19195551002>
                                       |    ;reason=user-busy
                                       |    ;screen="yes"
                                       |    ;privacy="off"
                                       |  Diversion: <tel:+19195551001>
                                       |    ;reason=unconditional
                                       |    ;screen="yes"
                                       |    ;privacy="full"
                                       |
                                       |

9.3.6.  Example of SIP to ISDN Translation

                                   ISDN/SIP GW
                                       |
<--Setup-------------------------------|
  Called party number      =+19195551004
  Redirecting Number information element:
    Redirecting Number     =+19195551001
    Reason for redirection = Unconditional (1111)
    Origin of Number       = passed network screening
    Presentation Status    = presentation allowed
  Redirecting Number information element:
    Redirecting Number     =+19195551002
    Reason for redirection = User busy (0001)
    Origin of Number       = passed network screening
    Presentation Status    = presentation prohibited
                                       |
                                       |<--INVITE tel:+19195551004----
                                       |  Diversion: <tel:+19195551002>
                                       |    ;reason=user-busy
                                       |    ;screen="yes"
                                       |    ;privacy="off
                                       |  Diversion: <tel:+19195551001>
                                       |    ;reason=unconditional
                                       |    ;screen="yes"
                                       |    ;privacy="full"
                                       |

9.4.  Information Loss in SIP to ISUP/ISDN Translation

   Because ISUP and ISDN only support a subset of the information in a
   SIP Diversion header, information loss occurs during translation at a
   SIP/ISUP or SIP/ISDN boundary.

9.4.1.  Loss of Diversion URI Information

   Because ISUP and ISDN only support a subset of URI types
   (specifically tel: URIs and sip:x@y;user=phone URIs), diversion
   information occurring for other URI types may be lost when crossing
   from SIP to ISDN or ISUP.

9.4.2.  Loss of Diversion Reason Information

   Because ISUP and ISDN only support a subset of the reason codes
   supported by the Diversion header, specific reason code information
   may be lost when crossing from SIP to ISDN or ISUP.

9.4.3.  Loss of Diversion Counter Information

   Because ISDN does not support a counter field (indicating the number
   of diversions that have occurred), counter information may be lost
   when crossing from SIP to ISDN.

10.  Contributors

   Special acknowledgement to both Bryan Byerly and JR Yang.  As
   original authors of this document, both were instrumental is getting
   this document written.

11.  Acknowledgements

   We would like to thank David Williams, Ameet Kher, Satya Khatter,
   Manoj Bhatia, Shail Bhatnagar, Denise Caballero-Mccann, Kara Adams,
   Charles Eckel of Cisco Systems, and Bert Culpepper of InterVoice-
   Brite for their insights, inputs, and comments.

12.  Normative References

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

   [RFC3261]  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.

Authors' Addresses

   Steve Levy
   Cisco Systems
   7025 Kit Creek Road P.O. Box 14987 Research Triangle Park,
   NC  27709
   USA

   EMail: stlevy@cisco.com

   Marianne Mohali (editor)
   Orange Labs
   38-40 rue du General Leclerc
   Issy-Les-Moulineaux Cedex 9  92794
   France

   Phone: +33145294514
   EMail: marianne.mohali@orange-ftgroup.com

ISO Plain Language

On this page
PROBLEMLegacy telephone networks pass redirection information through the network so that services can support enhanced features, and SIP had no equivalent mechanism.
MECHANISMThe Diversion header carries the previous Request-URI and a reason code, and it is added whenever a proxy, redirect server or user agent changes the ultimate endpoint that will receive the call. Existing Diversion headers must not be removed or changed, so the whole history travels with the call.
WHY IT FADEDThe proposal was not chosen for standardization. The discussions led to the informational RFC 3325 and to the standard solution in RFC 4244. The RFC is Historic and has been updated by RFC 8996.

§1Why Diversion Information Matters

RFC 5806 contains the text of an Internet Draft that was submitted to the SIP Working Group and is published for the historical record and as a reference for later Informational RFCs. The IESG note records that it is an early proposal that was not chosen for standardization, and that the discussions on the topic resulted in the informational RFC 3325 and in the standard solution, RFC 4244.

In the legacy telephony network, redirection information is passed through the network in ISDN and ISUP signalling messages. Service providers and business applications use it to support enhanced features for the end user, and an analogous mechanism in SIP would enable the same features for SIP users. The Diversion header, as proposed, allows feature logic to be based on from whom the call was diverted.

The proposal is for an extension to the Session Initiation Protocol that gives the called SIP user agent the ability to identify from whom the call was diverted and why. It defines a general header, Diversion, which conveys the diversion information from other SIP user agents and proxies to the called user agent, and it allows enhanced support for features including Unified Messaging, Third-Party Voicemail and Automatic Call Distribution.

Legacy phone networks pass information about a redirected call along with the call itself. SIP had no equivalent, so this proposal defines a header carrying the previous address and the reason for the diversion. It was never adopted.

§2Diversion, Divertor, Recursing and Non-Recursing

The document defines four terms. A diversion is a change to the ultimate destination endpoint of a request, that is, a change in the Request-URI that was not caused by a routing decision. It is also sometimes called a deflection or a redirection. A diversion can occur when the user portion of the Request-URI is changed for a reason other than expansion or translation, and it can occur when only the host portion has changed, if the change was due to a non-routing decision. The entity that diverted the call is the divertor.

A SIP proxy or user agent is recursing when it handles a received or internally generated 3xx response by forking new requests itself, and non-recursing when it handles such a response by forwarding it upstream. That distinction decides where the Diversion header is added, as the behaviour rules below show. The document also abbreviates the call-forwarding features it uses in its examples: Call Forward Unconditional, Call Forward Time-of-Day, Call Forward on Busy, Call Forward on No Answer, Call Forward Unavailable, and Automatic Call Distribution.

A diversion is any change to where a call is going that is not just normal routing. The divertor is whoever made that change, and the document distinguishes servers that handle a redirect themselves from servers that pass it on.

§3When the Diversion Header Is Used

To implement third-party features such as Third-Party Voicemail and Automatic Call Distribution, the called third party needs diversion information so that it can respond to the caller intelligently. The party receiving a diverted call needs answers to two questions: from whom was the request diverted, and why was it diverted. The proposal answers the first by inserting the previous Request-URI, the address before the diversion occurred, into the Diversion header, and the second by inserting the reason tag, added by the divertor.

The rules are precise. The Diversion header SHOULD be added when a SIP proxy server, SIP redirect server or SIP user agent changes the ultimate endpoint that will receive the call. Diversion information SHOULD NOT be added for normal call routing changes to the Request-URI, so the header is not added when a feature such as speed dial changes the Request-URI; it is added when features such as call forwarding or call deflection change it. When a diversion occurs, a Diversion header SHOULD be added to the forwarded request or the forwarded 3xx response, and it MUST contain the Request-URI of the request prior to the diversion, and SHOULD contain a reason.

Existing Diversion headers received in an incoming request MUST NOT be removed or changed in forwarded requests, and the same rule applies to headers received in an incoming response. The document explains why a separate header is needed rather than reusing the To header: the To header is not guaranteed to have significance to the called party, and it may hold a locally significant URL such as a private numbering plan, speed dial digits, telephony escape digits or prefix digits. Without a Diversion header, enumerating every locally significant To header that anyone might use to reach a given user becomes a configuration problem at the voicemail server, and is prone to namespace collision.

Whenever a proxy, redirect server or user agent changes where a call is going, it adds a header naming the address the call came from and the reason for the change. Headers already present are never removed, so the recipient can see the whole chain.

§4The Header Syntax and Its Parameters

The header is a name followed by one or more name-addr values, each with its own parameters. The reason parameter takes one of a fixed set of values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service or away, and it may also be a token or a quoted string. The counter parameter carries one or two digits and gives the total number of diversions seen, while the limit parameter carries one or two digits and gives the maximum number of diversions allowed. The privacy parameter takes full, name, uri or off, and the screen parameter takes yes or no. Any of the parameters may also be a token or a quoted string, and an extension parameter allows a token with an optional value.

The document then extends the tables in the SIP specification with two rows for the Diversion header, one for requests and one for 3xx responses, marking it as valid in a request and in a 3xx response and as a header that a proxy can handle.

The header holds an address plus parameters. The reason parameter names why the call was diverted, for example user-busy or unconditional. Other parameters count the diversions, set a limit, control privacy and record whether the number was screened.

THE DIVERSION HEADER SYNTAX FROM RFC 5806
ABNF
Diversion = "Diversion" ":" 1# (name-addr *( ";" diversion_params ))
diversion-params = diversion-reason | diversion-counter |
                   diversion-limit | diversion-privacy |
                   diversion-screen | diversion-extension
diversion-reason = "reason" "="
                 ( "unknown" | "user-busy" | "no-answer" |
                   "unavailable" | "unconditional" |
                   "time-of-day" | "do-not-disturb" |
                   "deflection" | "follow-me" |
                   "out-of-service" | "away" |
                   token | quoted-string )
diversion-counter = "counter" "=" 1*2DIGIT
diversion-limit = "limit" "=" 1*2DIGIT
diversion-privacy = "privacy" "=" ( "full" | "name" |
                    "uri" | "off" | token | quoted-string )
diversion-screen = "screen" "=" ( "yes" | "no" | token |
                                     quoted-string )
diversion-extension = token ["=" (token | quoted-string)]
THE REASON CODES (RFC 5806)
  • unknownReason — The reason is not known.
  • user-busyReason — The called party was busy.
  • no-answerReason — The called party did not answer.
  • unavailableReason — The called party was unavailable.
  • unconditionalReason — The call was forwarded unconditionally.
  • time-of-dayReason — The call was forwarded because of the time of day.
  • do-not-disturbReason — The called party asked not to be disturbed.
  • deflectionReason — The call was deflected.
  • follow-meReason — The call was forwarded to a follow-me location.
  • out-of-serviceReason — The called party was out of service.
  • awayReason — The called party was away.

§5Behaviour at Each SIP Element

A SIP User Agent Service that receives a request and returns a 3xx SHOULD add a Diversion header containing the previous Request-URI and the reason for the diversion. A SIP redirect server that receives a request and returns a 3xx containing a Contact that diverts the request to a different endpoint SHOULD do the same with the Request-URI from the incoming request. A SIP user agent client that receives a 3xx containing a Diversion header SHOULD copy the header into each downstream forked request that resulted from the 3xx.

Proxies are split by their recursion behaviour. A non-recursing proxy that receives a 3xx containing a Diversion header SHOULD forward the 3xx with the header upstream unchanged. A proxy that invokes a feature which changes the Request-URI of the forwarded request to divert the request to a different endpoint SHOULD add a Diversion header with the incoming Request-URI and the reason. A proxy that receives a request and returns a 3xx with a diverting Contact SHOULD add one as well. The document gives the same rules as pseudo-code: on a request whose Request-URI was changed by a feature, a recursing proxy adds the header to the downstream forwarded requests and a non-recursing proxy adds it to the upstream forwarded 3xx response; on a 3xx response, a recursing proxy copies the header into the forwarded INVITEs and a non-recursing proxy forwards the response upstream.

Each element that diverts a call adds its own header, and the rule is never to remove one that arrived earlier. A server that handles the redirect itself puts the header on the new requests it creates; a server that passes the redirect on leaves it in the response.

CALL FORWARD UNCONDITIONAL, FROM THE EXAMPLE IN RFC 5806
AliceProxy P1Proxy P2, recursingCarol
  1. INVITE Bob@P1The call is normally routed to Bob.
  2. INVITE Bob@P2The proxy forwards the request.
  3. INVITE Carol@CP2 forwards to Carol and adds a Diversion header with reason=unconditional.
  4. 200Carol answers.
  5. 200The answer travels back.
  6. 200Alice sees the call answered.
  7. ACKThe call is confirmed.

§7Security and Privacy Considerations

There are privacy considerations when using the header. Usage of the Diversion header implies that the diverting user agent trusts the diverted-to user agent. Its use by SIP proxies or SIP user agents can cause information leakage of route information and called information to untrusted SIP proxies and to untrusted callers in upstream 3xx responses.

The document suggests two ways to limit that leakage. It can be mitigated by having a recursing trusted upstream proxy server. And for an architecture where all proxies are required to be non-recursive, hiding the Diversion header may be considered necessary to prevent leakage of route information to the caller; to accomplish that, a trusted upstream proxy would add a Record-Route header and use a secret key to encrypt the contents of the Diversion header in the 3xx responses forwarded upstream, and on receipt of re-INVITEs it would decrypt the contents and forward the INVITE. The document notes that there is no currently defined interaction between the Diversion and Hide headers, and asks whether there should be.

The header can reveal routing information to an untrusted proxy or to the caller. A trusted proxy in the path can hide it by encrypting the header before forwarding the response upstream.

§7References