[ RFC Index | RFC Search | Usenet FAQs | Web FAQs | Documents | Cities ]

Alternate Formats: rfc3435.txt | rfc3435.txt.pdf

RFC 3435 - Media Gateway Control Protocol (MGCP) Version 1.0


    Search the Archives
Display RFC by number
    


RFC3435 - Media Gateway Control Protocol (MGCP) Version 1.0


Network Working Group                                       F. Andreasen
Request for Comments: 3435                                     B. Foster
Obsoletes: 2705                                            Cisco Systems
Category: Informational                                     January 2003

                 Media Gateway Control Protocol (MGCP)
                              Version 1.0

Status of this Memo

   This memo provides information for the Internet community.  It does
   not specify an Internet standard of any kind.  Distribution of this
   memo is unlimited.

Copyright Notice

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

IESG Note

   This document is being published for the information of the
   community.  It describes a protocol that is currently being deployed
   in a number of products.  Implementers should be aware of RFC 3015,
   which was developed in the IETF Megaco Working Group and the ITU-T
   SG16 and which is considered by the IETF and ITU-T to be the
   standards-based (including reviewed security considerations) way to
   meet the needs that MGCP was designed to address.

Abstract

   This document describes an application programming interface and a
   corresponding protocol (MGCP) which is used between elements of a
   decomposed multimedia gateway.  The decomposed multimedia gateway
   consists of a Call Agent, which contains the call control
   "intelligence", and a media gateway which contains the media
   functions, e.g., conversion from TDM voice to Voice over IP.

   Media gateways contain endpoints on which the Call Agent can create,
   modify and delete connections in order to establish and control media
   sessions with other multimedia endpoints.  Also, the Call Agent can
   instruct the endpoints to detect certain events and generate signals.
   The endpoints automatically communicate changes in service state to
   the Call Agent.  Furthermore, the Call Agent can audit endpoints as
   well as the connections on endpoints.

   The basic and general MGCP protocol is defined in this document,
   however most media gateways will need to implement one or more MGCP
   packages, which define extensions to the protocol suitable for use
   with specific types of media gateways.  Such packages are defined in
   separate documents.

Table of Contents

   1.     Introduction.................................................5
   1.1    Relation with the H.323 Standards............................7
   1.2    Relation with the IETF Standards.............................8
   1.3    Definitions..................................................9
   1.4    Conventions used in this Document............................9
   2.     Media Gateway Control Interface.............................10
   2.1    Model and Naming Conventions................................10
   2.1.1  Types of Endpoints..........................................10
   2.1.2  Endpoint Identifiers........................................14
   2.1.3  Calls and Connections.......................................16
   2.1.4  Names of Call Agents and Other Entities.....................22
   2.1.5  Digit Maps..................................................23
   2.1.6  Packages....................................................26
   2.1.7  Events and Signals..........................................28
   2.2    Usage of SDP................................................33
   2.3    Gateway Control Commands....................................33
   2.3.1  Overview of Commands........................................33
   2.3.2  EndpointConfiguration.......................................36
   2.3.3  NotificationRequest.........................................37
   2.3.4  Notify......................................................44
   2.3.5  CreateConnection............................................46
   2.3.6  ModifyConnection............................................52
   2.3.7  DeleteConnection (from the Call Agent)......................54
   2.3.8  DeleteConnection (from the gateway).........................58
   2.3.9  DeleteConnection (multiple connections from the Call Agent) 59
   2.3.10 AuditEndpoint...............................................60
   2.3.11 AuditConnection.............................................65
   2.3.12 RestartInProgress...........................................66
   2.4    Return Codes and Error Codes................................69
   2.5    Reason Codes................................................74
   2.6    Use of Local Connection Options and Connection Descriptors..75
   2.7    Resource Reservations.......................................77
   3.     Media Gateway Control Protocol..............................77
   3.1    General Description.........................................78
   3.2    Command Header..............................................79
   3.2.1  Command Line................................................79
   3.2.2  Parameter Lines.............................................82
   3.3    Format of response headers.................................101
   3.3.1  CreateConnection Response..................................104
   3.3.2  ModifyConnection Response..................................105

   3.3.3  DeleteConnection Response..................................106
   3.3.4  NotificationRequest Response...............................106
   3.3.5  Notify Response............................................106
   3.3.6  AuditEndpoint Response.....................................106
   3.3.7  AuditConnection Response...................................107
   3.3.8  RestartInProgress Response.................................108
   3.4    Encoding of the Session Description (SDP)..................108
   3.4.1  Usage of SDP for an Audio Service..........................110
   3.4.2  Usage of SDP for LOCAL Connections.........................110
   3.5    Transmission over UDP......................................111
   3.5.1  Providing the At-Most-Once Functionality...................112
   3.5.2  Transaction Identifiers and Three Ways Handshake...........113
   3.5.3  Computing Retransmission Timers............................114
   3.5.4  Maximum Datagram Size, Fragmentation and Reassembly........115
   3.5.5  Piggybacking...............................................116
   3.5.6  Provisional Responses......................................117
   4.     States, Failover and Race Conditions.......................119
   4.1    Failover Assumptions and Highlights........................119
   4.2    Communicating with Gateways................................121
   4.3    Retransmission, and Detection of Lost Associations:........122
   4.4    Race Conditions............................................126
   4.4.1  Quarantine List............................................127
   4.4.2  Explicit Detection.........................................133
   4.4.3  Transactional Semantics....................................134
   4.4.4  Ordering of Commands, and Treatment of Misorder............135
   4.4.5  Endpoint Service States....................................137
   4.4.6  Fighting the Restart Avalanche.............................140
   4.4.7  Disconnected Endpoints.....................................143
   4.4.8  Load Control in General....................................146
   5.     Security Requirements......................................147
   5.1    Protection of Media Connections............................148
   6.     Packages...................................................148
   6.1    Actions....................................................150
   6.2    BearerInformation..........................................150
   6.3    ConnectionModes............................................151
   6.4    ConnectionParameters.......................................151
   6.5    DigitMapLetters............................................151
   6.6    Events and Signals.........................................152
   6.6.1  Default and Reserved Events................................155
   6.7    ExtensionParameters........................................156
   6.8    LocalConnectionOptions.....................................157
   6.9    Reason Codes...............................................157
   6.10   RestartMethods.............................................158
   6.11   Return Codes...............................................158
   7.     Versions and Compatibility.................................158
   7.1    Changes from RFC 2705......................................158
   8.     Security Considerations....................................164
   9.     Acknowledgments............................................164

   10.    References.................................................164
   Appendix A: Formal Syntax Description of the Protocol.............167
   Appendix B: Base Package..........................................175
   B.1    Events.....................................................175
   B.2    Extension Parameters.......................................176
   B.2.1  PersistentEvents...........................................176
   B.2.2  NotificationState..........................................177
   B.3    Verbs......................................................177
   Appendix C: IANA Considerations...................................179
   C.1    New MGCP Package Sub-Registry..............................179
   C.2    New MGCP Package...........................................179
   C.3    New MGCP LocalConnectionOptions Sub-Registry...............179
   Appendix D: Mode Interactions.....................................180
   Appendix E: Endpoint Naming Conventions...........................182
   E.1    Analog Access Line Endpoints...............................182
   E.2    Digital Trunks.............................................182
   E.3    Virtual Endpoints..........................................183
   E.4    Media Gateway..............................................184
   E.5    Range Wildcards............................................184
   Appendix F: Example Command Encodings.............................185
   F.1    NotificationRequest........................................185
   F.2    Notify.....................................................186
   F.3    CreateConnection...........................................186
   F.4    ModifyConnection...........................................189
   F.5    DeleteConnection (from the Call Agent).....................189
   F.6    DeleteConnection (from the gateway)........................190
   F.7    DeleteConnection (multiple connections
          from the Call Agent).......................................190
   F.8    AuditEndpoint..............................................191
   F.9    AuditConnection............................................192
   F.10   RestartInProgress..........................................193
   Appendix G: Example Call Flows....................................194
   G.1    Restart....................................................195
   G.1.1  Residential Gateway Restart................................195
   G.1.2  Call Agent Restart.........................................198
   G.2    Connection Creation........................................200
   G.2.1  Residential Gateway to Residential Gateway.................200
   G.3    Connection Deletion........................................206
   G.3.1  Residential Gateway to Residential Gateway.................206
   Authors' Addresses................................................209
   Full Copyright Statement..........................................210

1. Introduction

   This document describes an abstract application programming interface
   (MGCI) and a corresponding protocol (MGCP) for controlling media
   gateways from external call control elements called media gateway
   controllers or Call Agents.  A media gateway is typically a network
   element that provides conversion between the audio signals carried on
   telephone circuits and data packets carried over the Internet or over
   other packet networks.  Examples of media gateways are:

   * Trunking gateways, that interface between the telephone network and
     a Voice over IP network.  Such gateways typically manage a large
     number of digital circuits.

   * Voice over ATM gateways, which operate much the same way as voice
     over IP trunking gateways, except that they interface to an ATM
     network.

   * Residential gateways, that provide a traditional analog (RJ11)
     interface to a Voice over IP network.  Examples of residential
     gateways include cable modem/cable set-top boxes, xDSL devices, and
     broad-band wireless devices.

   * Access gateways, that provide a traditional analog (RJ11) or
     digital PBX interface to a Voice over IP network.  Examples of
     access gateways include small-scale voice over IP gateways.

   * Business gateways, that provide a traditional digital PBX interface
     or an integrated "soft PBX" interface to a Voice over IP network.

   * Network Access Servers, that can attach a "modem" to a telephone
     circuit and provide data access to the Internet.  We expect that in
     the future, the same gateways will combine Voice over IP services
     and Network Access services.

   * Circuit switches, or packet switches, which can offer a control
     interface to an external call control element.

   MGCP assumes a call control architecture where the call control
   "intelligence" is outside the gateways and handled by external call
   control elements known as Call Agents.  The MGCP assumes that these
   call control elements, or Call Agents, will synchronize with each
   other to send coherent commands and responses to the gateways under
   their control.  If this assumption is violated, inconsistent behavior
   should be expected.  MGCP does not define a mechanism for
   synchronizing Call Agents.  MGCP is, in essence, a master/slave
   protocol, where the gateways are expected to execute commands sent by
   the Call Agents.  In consequence, this document specifies in great

   detail the expected behavior of the gateways, but only specifies
   those parts of a Call Agent implementation, such as timer management,
   that are mandated for proper operation of the protocol.

   MGCP assumes a connection model where the basic constructs are
   endpoints and connections.  Endpoints are sources and/or sinks of
   data and can be physical or virtual.  Examples of physical endpoints
   are:

   * An interface on a gateway that terminates a trunk connected to a
     PSTN switch (e.g., Class 5, Class 4, etc.).  A gateway that
     terminates trunks is called a trunking gateway.

   * An interface on a gateway that terminates an analog POTS connection
     to a phone, key system, PBX, etc.  A gateway that terminates
     residential POTS lines (to phones) is called a residential gateway.

   An example of a virtual endpoint is an audio source in an audio-
   content server.  Creation of physical endpoints requires hardware
   installation, while creation of virtual endpoints can be done by
   software.

   Connections may be either point to point or multipoint.  A point to
   point connection is an association between two endpoints with the
   purpose of transmitting data between these endpoints.  Once this
   association is established for both endpoints, data transfer between
   these endpoints can take place.  A multipoint connection is
   established by connecting the endpoint to a multipoint session.

   Connections can be established over several types of bearer networks,
   for example:

   * Transmission of audio packets using RTP and UDP over an IP network.

   * Transmission of audio packets using AAL2, or another adaptation
     layer, over an ATM network.

   * Transmission of packets over an internal connection, for example
     the TDM backplane or the interconnection bus of a gateway.  This is
     used, in particular, for "hairpin" connections, connections that
     terminate in a gateway but are immediately rerouted over the
     telephone network.

   For point-to-point connections the endpoints of a connection could be
   in separate gateways or in the same gateway.

1.1 Relation with the H.323 Standards

   MGCP is designed as an internal protocol within a distributed system
   that appears to the outside as a single VoIP gateway.  This system is
   composed of a Call Agent, that may or may not be distributed over
   several computer platforms, and of a set of gateways, including at
   least one "media gateway" that perform the conversion of media
   signals between circuits and packets, and at least one "signaling
   gateway" when connecting to an SS7 controlled network.  In a typical
   configuration, this distributed gateway system will interface on one
   side with one or more telephony (i.e., circuit) switches, and on the
   other side with H.323 conformant systems, as indicated in the
   following table:

    ------------------------------------------------------------------
   | Functional|  Phone     |  Terminating    |  H.323 conformant     |
   | Plane     |  switch    |  Entity         |  systems              |
   |-----------|------------|-----------------|-----------------------|
   | Signaling |  Signaling |  Call agent     |  Signaling exchanges  |
   | Plane     |  exchanges |                 |  with the Call Agent  |
   |           |  through   |                 |  through H.225/RAS and|
   |           |  SS7/ISUP  |                 |  H.225/Q.931.         |
   |-----------|------------|-----------------|-----------------------|
   |           |            |                 |  Possible negotiation |
   |           |            |                 |  of logical channels  |
   |           |            |                 |  and transmission     |
   |           |            |                 |  parameters through   |
   |           |            |                 |  H.245 with the call  |
   |           |            |                 |  agent.               |
   |-----------|------------|-----------------|-----------------------|
   |           |            |  Internal       |                       |
   |           |            |  synchronization|                       |
   |           |            |  through MGCP   |                       |
   |-----------|------------|-----------------|-----------------------|
   | Bearer    |  Connection|  Telephony      |  Transmission of VoIP |
   | Data      |  through   |  gateways       |  data using RTP       |
   | Transport |  high speed|                 |  directly between the |
   | Plane     |  trunk     |                 |  H.323 station and the|
   |           |  groups    |                 |  gateway.             |
    ------------------------------------------------------------------

   In the MGCP model, the gateways focus on the audio signal translation
   function, while the Call Agent handles the call signaling and call
   processing functions.  As a consequence, the Call Agent implements
   the "signaling" layers of the H.323 standard, and presents itself as
   an "H.323 Gatekeeper" or as one or more "H.323 Endpoints" to the
   H.323 systems.

1.2  Relation with the IETF Standards

   While H.323 is the recognized standard for VoIP terminals, the IETF
   has also produced specifications for other types of multi-media
   applications.  These other specifications include:

   * the Session Description Protocol (SDP), RFC 2327

   * the Session Announcement Protocol (SAP), RFC 2974

   * the Session Initiation Protocol (SIP), RFC 3261

   * the Real Time Streaming Protocol (RTSP), RFC 2326.

   The latter three specifications are in fact alternative signaling
   standards that allow for the transmission of a session description to
   an interested party.  SAP is used by multicast session managers to
   distribute a multicast session description to a large group of
   recipients, SIP is used to invite an individual user to take part in
   a point-to-point or unicast session, RTSP is used to interface a
   server that provides real time data.  In all three cases, the session
   description is described according to SDP; when audio is transmitted,
   it is transmitted through the Real-time Transport Protocol, RTP.

   The distributed gateway systems and MGCP will enable PSTN telephony
   users to access sessions set up using SAP, SIP or RTSP.  The Call
   Agent provides for signaling conversion, according to the following
   table:

    ------------------------------------------------------------------
   | Functional|  Phone     |  Terminating  |  IETF conforming systems|
   | Plane     |  switch    |  Entity       |                         |
   |-----------|------------|---------------|-------------------------|
   | Signaling |  Signaling |  Call agent   |  Signaling exchanges    |
   | Plane     |  exchanges |               |  with the Call Agent    |
   |           |  through   |               |  through SAP, SIP or    |
   |           |  SS7/ISUP  |               |  RTSP.                  |
   |-----------|------------|---------------|-------------------------|
   |           |            |               |  Negotiation of session |
   |           |            |               |  description parameters |
   |           |            |               |  through SDP (telephony |
   |           |            |               |  gateway terminated but |
   |           |            |               |  passed via the call    |
   |           |            |               |  agent to and from the  |
   |           |            |               |  IETF conforming system)|
   |-----------|------------|---------------|-------------------------|
   |           |            | Internal syn- |                         |
   |           |            | chronization  |                         |
   |           |            | through MGCP  |                         |
   |-----------|------------|---------------|-------------------------|
   | Bearer    |  Connection|  Telephony    |  Transmission of VoIP   |
   | Data      |  through   |  gateways     |  data using RTP,        |
   | Transport |  high speed|               |  directly between the   |
   | Plane     |  trunk     |               |  remote IP end system   |
   |           |  groups    |               |  and the gateway.       |
    ------------------------------------------------------------------

   The SDP standard has a pivotal status in this architecture.  We will
   see in the following description that we also use it to carry session
   descriptions in MGCP.

1.3 Definitions

   Trunk:  A communication channel between two switching systems, e.g.,
   a DS0 on a T1 or E1 line.

1.4 Conventions used in this Document

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

2. Media Gateway Control Interface

   The interface functions provide for connection control and endpoint
   control.  Both use the same system model and the same naming
   conventions.

2.1 Model and Naming Conventions

   The MGCP assumes a connection model where the basic constructs are
   endpoints and connections.  Connections are grouped in calls.  One or
   more connections can belong to one call.  Connections and calls are
   set up at the initiative of one or more Call Agents.

2.1.1 Types of Endpoints

   In the introduction, we presented several classes of gateways.  Such
   classifications, however, can be misleading.  Manufacturers can
   arbitrarily decide to provide several types of services in a single
   package.  A single product could well, for example, provide some
   trunk connections to telephony switches, some primary rate
   connections and some analog line interfaces, thus sharing the
   characteristics of what we described in the introduction as
   "trunking", "access" and "residential" gateways.  MGCP does not make
   assumptions about such groupings.  We simply assume that media
   gateways support collections of endpoints.  The type of the endpoint
   determines its functionality.  Our analysis, so far, has led us to
   isolate the following basic endpoint types:

   * Digital channel (DS0),

   * Analog line,

   * Announcement server access point,

   * Interactive Voice Response access point,

   * Conference bridge access point,

   * Packet relay,

   * ATM "trunk side" interface.

   In this section, we will describe the expected behavior of such
   endpoints.

   This list is not final.  There may be other types of endpoints
   defined in the future, for example test endpoints that could be used
   to check network quality, or frame-relay endpoints that could be used
   to manage audio channels multiplexed over a frame-relay virtual
   circuit.

2.1.1.1 Digital Channel (DS0)

   Digital channels provide a 64 Kbps service.  Such channels are found
   in trunk and ISDN interfaces.  They are typically part of digital
   multiplexes, such as T1, E1, T3 or E3 interfaces.  Media gateways
   that support such channels are capable of translating the digital
   signals received on the channel, which may be encoded according to
   A-law or mu-law, using either the complete set of 8 bits per sample
   or only 7 of these bits, into audio packets.  When the media gateway
   also supports a Network Access Server (NAS) service, the gateway
   shall be capable of receiving either audio-encoded data (modem
   connection) or binary data (ISDN connection) and convert them into
   data packets.

                                         +-------
                           +------------+|
              (channel) ===|DS0 endpoint| -------- Connections
                           +------------+|
                                         +-------

   Media gateways should be able to establish several connections
   between the endpoint and the packet networks, or between the endpoint
   and other endpoints in the same gateway.  The signals originating
   from these connections shall be mixed according to the connection
   "mode", as specified later in this document.  The precise number of
   connections that an endpoint supports is a characteristic of the
   gateway, and may in fact vary according to the allocation of
   resources within the gateway.

   In some cases, digital channels are used to carry signaling.  This is
   the case for example for SS7 "F" links, or ISDN "D" channels.  Media
   gateways that support these signaling functions shall be able to send
   and receive the signaling packets to and from a Call Agent, using the
   "backhaul" procedures defined by the SIGTRAN working group of the
   IETF.  Digital channels are sometimes used in conjunction with
   channel associated signaling, such as "MF R2".  Media gateways that
   support these signaling functions shall be able to detect and produce
   the corresponding signals, such as for example "wink" or "A",
   according to the event signaling and reporting procedures defined in
   MGCP.

2.1.1.2 Analog Line

   Analog lines can be used either as a "client" interface, providing
   service to a classic telephone unit, or as a "service" interface,
   allowing the gateway to send and receive analog calls.  When the
   media gateway also supports a NAS service, the gateway shall be
   capable of receiving audio-encoded data (modem connection) and
   convert them into data packets.

                                         +-------
                        +---------------+|
              (line) ===|analog endpoint| -------- Connections
                        +---------------+|
                                         +-------

   Media gateways should be able to establish several connections
   between the endpoint and the packet networks, or between the endpoint
   and other endpoints in the same gateway.  The audio signals
   originating from these connections shall be mixed according to the
   connection "mode", as specified later in this document.  The precise
   number of connections that an endpoint supports is a characteristic
   of the gateway, and may in fact vary according to the allocation of
   resources within the gateway.  A typical gateway should however be
   able to support two or three connections per endpoint, in order to
   support services such as "call waiting" or "three way calling".

2.1.1.3 Announcement Server Access Point

   An announcement server endpoint provides access to an announcement
   service.  Under requests from the Call Agent, the announcement server
   will "play" a specified announcement.  The requests from the Call
   Agent will follow the event signaling and reporting procedures
   defined in MGCP.

                  +----------------------+
                  | Announcement endpoint| -------- Connection
                  +----------------------+

   A given announcement endpoint is not expected to support more than
   one connection at a time.  If several connections were established to
   the same endpoint, then the same announcements would be played
   simultaneously over all the connections.

   Connections to an announcement server are typically one way, or "half
   duplex" -- the announcement server is not expected to listen to the
   audio signals from the connection.

2.1.1.4 Interactive Voice Response Access Point

   An Interactive Voice Response (IVR) endpoint provides access to an
   IVR service.  Under requests from the Call Agent, the IVR server will
   "play" announcements and tones, and will "listen" to responses, such
   as DTMF input or voice messages, from the user.  The requests from
   the Call Agent will follow the event signaling and reporting
   procedures defined in MGCP.

                      +-------------+
                      | IVR endpoint| -------- Connection
                      +-------------+

   A given IVR endpoint is not expected to support more than one
   connection at a time.  If several connections were established to the
   same endpoint, then the same tones and announcements would be played
   simultaneously over all the connections.

2.1.1.5 Conference Bridge Access Point

   A conference bridge endpoint is used to provide access to a specific
   conference.

                                           +-------
               +--------------------------+|
               |Conference bridge endpoint| -------- Connections
               +--------------------------+|
                                           +-------

   Media gateways should be able to establish several connections
   between the endpoint and the packet networks, or between the endpoint
   and other endpoints in the same gateway.  The signals originating
   from these connections shall be mixed according to the connection
   "mode", as specified later in this document.  The precise number of
   connections that an endpoint supports is a characteristic of the
   gateway, and may in fact vary according to the allocation of
   resources within the gateway.

2.1.1.6 Packet Relay

   A packet relay endpoint is a specific form of conference bridge, that
   typically only supports two connections.  Packets relays can be found
   in firewalls between a protected and an open network, or in
   transcoding servers used to provide interoperation between
   incompatible gateways, for example gateways that do not support
   compatible compression algorithms, or gateways that operate over
   different transmission networks such as IP and ATM.

                                           +-------
                   +---------------------+ |
                   |Packet relay endpoint|  2 connections
                   +---------------------+ |
                                           +-------

2.1.1.7 ATM "trunk side" Interface

   ATM "trunk side" endpoints are typically found when one or several
   ATM permanent virtual circuits are used as a replacement for the
   classic "TDM" trunks linking switches.  When ATM/AAL2 is used,
   several trunks or channels are multiplexed on a single virtual
   circuit; each of these trunks correspond to a single endpoint.

                                          +-------
                      +------------------+|
          (channel) = |ATM trunk endpoint| -------- Connections
                      +------------------+|
                                          +-------

   Media gateways should be able to establish several connections
   between the endpoint and the packet networks, or between the endpoint
   and other endpoints in the same gateway.  The signals originating
   from these connections shall be mixed according to the connection
   "mode", as specified later in this document.  The precise number of
   connections that an endpoint supports is a characteristic of the
   gateway, and may in fact vary according to the allocation of
   resources within the gateway.

2.1.2 Endpoint Identifiers

   Endpoint identifiers have two components that both are case-
   insensitive:

   * the domain name of the gateway that is managing the endpoint

   * a local name within that gateway

   Endpoint names are of the form:

      local-endpoint-name@domain-name

   where domain-name is an absolute domain-name as defined in RFC 1034
   and includes a host portion, thus an example domain-name could be:

      mygateway.whatever.net

   Also, domain-name may be an IP-address of the form defined for domain
   name in RFC 821, thus another example could be (see RFC 821 for
   details):

      [192.168.1.2]

   Both IPv4 and IPv6 addresses can be specified, however use of IP
   addresses as endpoint identifiers is generally discouraged.

   Note that since the domain name portion is part of the endpoint
   identifier, different forms or different values referring to the same
   entity are not freely interchangeable.  The most recently supplied
   form and value MUST always be used.

   The local endpoint name is case-insensitive.  The syntax of the local
   endpoint name is hierarchical, where the least specific component of
   the name is the leftmost term, and the most specific component is the
   rightmost term.  The precise syntax depends on the type of endpoint
   being named and MAY start with a term that identifies the endpoint
   type.  In any case, the local endpoint name MUST adhere to the
   following naming rules:

   1) The individual terms of the naming path MUST be separated by a
      single slash ("/", ASCII 2F hex).

   2) The individual terms are character strings composed of letters,
      digits or other printable characters, with the exception of
      characters used as delimiters ("/", "@"), characters used for
      wildcarding ("*", "$") and white spaces.

   3) Wild-carding is represented either by an asterisk ("*") or a
      dollar sign ("$") for the terms of the naming path which are to be
      wild-carded.  Thus, if the full local endpoint name is of the
      form:

          term1/term2/term3

      then the entity name field looks like this depending on which
      terms are wild-carded:

          */term2/term3 if term1 is wild-carded
          term1/*/term3 if term2 is wild-carded
          term1/term2/* if term3 is wild-carded
          term1/*/*     if term2 and term3 are wild-carded, etc.

      In each of these examples a dollar sign could have appeared
      instead of an asterisk.

   4) A term represented by an asterisk ("*") is to be interpreted as:
      "use ALL values of this term known within the scope of the Media
      Gateway".  Unless specified otherwise, this refers to all
      endpoints configured for service, regardless of their actual
      service state, i.e., in-service or out-of-service.

   5) A term represented by a dollar sign ("$") is to be interpreted as:
      "use ANY ONE value of this term known within the scope of the
      Media Gateway".  Unless specified otherwise, this only refers to
      endpoints that are in-service.

   Furthermore, it is RECOMMENDED that Call Agents adhere to the
   following:

   * Wild-carding should only be done from the right, thus if a term is
     wild-carded, then all terms to the right of that term should be
     wild-carded as well.

   * In cases where mixed dollar sign and asterisk wild-cards are used,
     dollar-signs should only be used from the right, thus if a term had
     a dollar sign wild-card, all terms to the right of that term should
     also contain dollar sign wild-cards.

   The description of a specific command may add further criteria for
   selection within the general rules given above.

   Note, that wild-cards may be applied to more than one term in which
   case they shall be evaluated from left to right.  For example, if we
   have the endpoint names "a/1", "a/2", "b/1", and "b/2", then "$/*"
   (which is not recommended) will evaluate to either "a/1, a/2", or
   "b/1, b/2".  However, "*/$" may evaluate to "a/1, b/1", "a/1, b/2",
   "a/2, b/1", or "a/2, b/2".  The use of mixed wild-cards in a command
   is considered error prone and is consequently discouraged.

   A local name that is composed of only a wildcard character refers to
   either all (*) or any ($) endpoints within the media gateway.

2.1.3 Calls and Connections

   Connections are created on the Call Agent on each endpoint that will
   be involved in the "call".  In the classic example of a connection
   between two "DS0" endpoints (EP1 and EP2), the Call Agents
   controlling the endpoints will establish two connections (C1 and C2):

                  +---+                            +---+
    (channel1) ===|EP1|--(C1)--...        ...(C2)--|EP2|===(channel2)
                  +---+                            +---+

   Each connection will be designated locally by an endpoint unique
   connection identifier, and will be characterized by connection
   attributes.

   When the two endpoints are located on gateways that are managed by
   the same Call Agent, the creation is done via the three following
   steps:

   1) The Call Agent asks the first gateway to "create a connection" on
      the first endpoint.  The gateway allocates resources to that
      connection, and responds to the command by providing a "session
      description".  The session description contains the information
      necessary for a third party to send packets towards the newly
      created connection, such as for example IP address, UDP port, and
      codec parameters.

   2) The Call Agent then asks the second gateway to "create a
      connection" on the second endpoint.  The command carries the
      "session description" provided by the first gateway.  The gateway
      allocates resources to that connection, and responds to the
      command by providing its own "session description".

   3) The Call Agent then uses a "modify connection" command to provide
      this second "session description" to the first endpoint.  Once
      this is done, communication can proceed in both directions.

   When the two endpoints are located on gateways that are managed by
   two different Call Agents, the Call Agents exchange information
   through a Call-Agent to Call-Agent signaling protocol, e.g., SIP [7],
   in order to synchronize the creation of the connection on the two
   endpoints.

   Once a connection has been established, the connection parameters can
   be modified at any time by a "modify connection" command.  The Call
   Agent may for example instruct the gateway to change the codec used
   on a connection, or to modify the IP address and UDP port to which
   data should be sent, if a connection is "redirected".

   The Call Agent removes a connection by sending a "delete connection"
   command to the gateway.  The gateway may also, under some
   circumstances, inform a gateway that a connection could not be
   sustained.

   The following diagram provides a view of the states of a connection,
   as seen from the gateway:

           Create connection
              received
                  |
                  V
         +-------------------+
         |resource allocation|-(failed)-+
         +-------------------+          |
                  |           (connection refused)
            (successful)
                  |
                  v
     +----------->+
     |            |
     |   +-------------------+
     |   |  remote session   |
     |   |   description     |----------(yes)--------+
     |   |    available ?    |                       |
     |   +-------------------+                       |
     |            |                                  |
     |          (no)                                 |
     |            |                                  |
     |      +-----------+                         +------+
     | +--->| half open |------> Delete   <-------| open |<----------+
     | |    |  (wait)   |      Connection         |(wait)|           |
     | |    +-----------+       received          +------+           |
     | |          |                 |                |               |
     | |   Modify Connection        |         Modify Connection      |
     | |      received              |            received            |
     | |          |                 |                |               |
     | | +--------------------+     |       +--------------------+   |
     | | |assess modification |     |       |assess modification |   |
     | | +--------------------+     |       +--------------------+   |
     | |    |             |         |          |             |       |
     | |(failed)     (successful)   |      (failed)     (successful) |
     | |    |             |         |          |             |       |
     | +<---+             |         |          +-------------+-------+
     |                    |         |
     +<-------------------+         |
                                    |
                           +-----------------+
                           | Free connection |
                           | resources.      |
                           | Report.         |
                           +-----------------+
                                    |
                                    V

2.1.3.1 Names of Calls

   One of the attributes of each connection is the "call identifier",
   which as far as the MGCP protocol is concerned has little semantic
   meaning, and is mainly retained for backwards compatibility.

   Calls are identified by unique identifiers, independent of the
   underlying platforms or agents.  Call identifiers are hexadecimal
   strings, which are created by the Call Agent.  The maximum length of
   call identifiers is 32 characters.

   Call identifiers are expected to be unique within the system, or at a
   minimum, unique within the collection of Call Agents that control the
   same gateways.  From the gateway's perspective, the Call identifier
   is thus unique.  When a Call Agent builds several connections that
   pertain to the same call, either on the same gateway or in different
   gateways, these connections that belong to the same call should share
   the same call-id.  This identifier can then be used by accounting or
   management procedures, which are outside the scope of MGCP.

2.1.3.2 Names of Connections

   Connection identifiers are created by the gateway when it is
   requested to create a connection.  They identify the connection
   within the context of an endpoint.  Connection identifiers are
   treated in MGCP as hexadecimal strings.  The gateway MUST make sure
   that a proper waiting period, at least 3 minutes, elapses between the
   end of a connection that used this identifier and its use in a new
   connection for the same endpoint (gateways MAY decide to use
   identifiers that are unique within the context of the gateway).  The
   maximum length of a connection identifier is 32 characters.

2.1.3.3 Management of Resources, Attributes of Connections

   Many types of resources will be associated to a connection, such as
   specific signal processing functions or packetization functions.
   Generally, these resources fall in two categories:

   1) Externally visible resources, that affect the format of "the bits
      on the network" and must be communicated to the second endpoint
      involved in the connection.

   2) Internal resources, that determine which signal is being sent over
      the connection and how the received signals are processed by the
      endpoint.

   The resources allocated to a connection, and more generally the
   handling of the connection, are chosen by the gateway under
   instructions from the Call Agent.  The Call Agent will provide these
   instructions by sending two sets of parameters to the gateway:

   1) The local directives instruct the gateway on the choice of
      resources that should be used for a connection,

   2) When available, the "session description" provided by the other
      end of the connection (referred to as the remote session
      description).

   The local directives specify such parameters as the mode of the
   connection (e.g., send-only, or send-receive), preferred coding or
   packetization methods, usage of echo cancellation or silence
   suppression.  (A detailed list can be found in the specification of
   the LocalConnectionOptions parameter of the CreateConnection
   command.)  Depending on the parameter, the Call Agent MAY either
   specify a value, a range of values, or no value at all.  This allows
   various implementations to implement various levels of control, from
   a very tight control where the Call Agent specifies minute details of
   the connection handling to a very loose control where the Call Agent
   only specifies broad guidelines, such as the maximum bandwidth, and
   lets the gateway choose the detailed values subject to the
   guidelines.

   Based on the value of the local directives, the gateway will
   determine the resources to allocate to the connection.  When this is
   possible, the gateway will choose values that are in line with the
   remote session description - but there is no absolute requirement
   that the parameters be exactly the same.

   Once the resources have been allocated, the gateway will compose a
   "session description" that describes the way it intends to send and
   receive packets.  Note that the session description may in some cases
   present a range of values.  For example, if the gateway is ready to
   accept one of several compression algorithms, it can provide a list
   of these accepted algorithms.

                 Local Directives
                (from Call Agent 1)
                        |
                        V
                 +-------------+
                 | resource    |
                 | allocation  |
                 | (gateway 1) |
                 +-------------+
                   |         |
                   V         |
                 Local       |
              Parameters     V
                   |      Session
                   |    Description               Local Directives
                   |         |                   (from Call Agent 2)
                   |         +---> Transmission----+      |
                   |                (CA to CA)     |      |
                   |                               V      V
                   |                           +-------------+
                   |                           | resource    |
                   |                           | allocation  |
                   |                           | (gateway 2) |
                   |                           +-------------+
                   |                               |      |
                   |                               |      V
                   |                               |    Local
                   |                               |  Parameters
                   |                            Session
                   |                          Description
                   |         +---- Transmission<---+
                   |         |      (CA to CA)
                   V         V
                 +-------------+
                 | modification|
                 | (gateway 1) |
                 +-------------+
                   |
                   V
                 Local
              Parameters

      -- Information flow: local directives & session descriptions --

2.1.3.4 Special Case of Local Connections

   Large gateways include a large number of endpoints which are often of
   different types.  In some networks, we may often have to set-up
   connections between endpoints that are located within the same
   gateway.  Examples of such connections may be:

   * Connecting a call to an Interactive Voice-Response unit,

   * Connecting a call to a Conferencing unit,

   * Routing a call from one endpoint to another, something often
     described as a "hairpin" connection.

   Local connections are much simpler to establish than network
   connections.  In most cases, the connection will be established
   through some local interconnecting device, such as for example a TDM
   bus.

   When two endpoints are managed by the same gateway, it is possible to
   specify the connection in a single command that conveys the names of
   the two endpoints that will be connected.  The command is essentially
   a "Create Connection" command which includes the name of the second
   endpoint in lieu of the "remote session description".

2.1.4 Names of Call Agents and Other Entities

   The media gateway control protocol has been designed to allow the
   implementation of redundant Call Agents, for enhanced network
   reliability.  This means that there is no fixed binding between
   entities and hardware platforms or network interfaces.

   Call Agent names consist of two parts, similar to endpoint names.
   Semantically, the local portion of the name does not exhibit any
   internal structure.  An example Call Agent name is:

      ca1@ca.whatever.net

   Note that both the local part and the domain name have to be
   supplied. Nevertheless, implementations are encouraged to accept call
   agent names consisting of only the domain name.

   Reliability can be improved by using the following procedures:

   * Entities such as endpoints or Call Agents are identified by their
     domain name, not their network addresses.  Several addresses can be

     associated with a domain name.  If a command or a response cannot
     be forwarded to one of the network addresses, implementations MUST
     retry the transmission using another address.

   * Entities MAY move to another platform.  The association between a
     logical name (domain name) and the actual platform is kept in the
     domain name service.  Call Agents and Gateways MUST keep track of
     the time-to-live of the record they read from the DNS.  They MUST
     query the DNS to refresh the information if the time to live has
     expired.

   In addition to the indirection provided by the use of domain names
   and the DNS, the concept of "notified entity" is central to
   reliability and fail-over in MGCP.  The "notified entity" for an
   endpoint is the Call Agent currently controlling that endpoint.  At
   any point in time, an endpoint has one, and only one, "notified
   entity" associated with it.  The "notified entity" determines where
   the endpoint will send commands to; when the endpoint needs to send a
   command to the Call Agent, it MUST send the command to its current
   "notified entity".  The "notified entity" however does not determine
   where commands can be received from; any Call Agent can send commands
   to the endpoint.  Please refer to Section 5 for the relevant security
   considerations.

   Upon startup, the "notified entity" MUST be set to a provisioned
   value.  Most commands sent by the Call Agent include the ability to
   explicitly name the "notified entity" through the use of a
   "NotifiedEntity" parameter.  The "notified entity" will stay the same
   until either a new "NotifiedEntity" parameter is received or the
   endpoint does a warm or cold (power-cycle) restart.

   If a "NotifiedEntity" parameter is sent with an "empty" value, the
   "notified entity" for the endpoint will be set to empty.  If the
   "notified entity" for an endpoint is empty or has not been set
   explicitly (neither by a command nor by provisioning), the "notified
   entity" will then default to the source address (i.e., IP address and
   UDP port number) of the last successful non-audit command received
   for the endpoint.  Auditing will thus not change the "notified
   entity".  Use of an empty "NotifiedEntity" parameter value is
   strongly discouraged as it is error prone and eliminates the DNS-
   based fail-over and reliability mechanisms.

2.1.5 Digit Maps

   The Call Agent can ask the gateway to collect digits dialed by the
   user.  This facility is intended to be used with residential gateways
   to collect the numbers that a user dials; it can also be used with

   trunking gateways and access gateways alike, to collect access codes,
   credit card numbers and other numbers requested by call control
   services.

   One procedure is for the gateway to notify the Call Agent of each
   individual dialed digit, as soon as they are dialed.  However, such a
   procedure generates a large number of interactions.  It is preferable
   to accumulate the dialed numbers in a buffer, and to transmit them in
   a single message.

   The problem with this accumulation approach, however, is that it is
   hard for the gateway to predict how many numbers it needs to
   accumulate before transmission.  For example, using the phone on our
   desk, we can dial the following numbers:

        ------------------------------------------------------
       |  0                     |  Local operator             |
       |  00                    |  Long distance operator     |
       |  xxxx                  |  Local extension number     |
       |  8xxxxxxx              |  Local number               |
       |  #xxxxxxx              |  Shortcut to local number at|
       |                        |  other corporate sites      |
       |  *xx                   |  Star services              |
       |  91xxxxxxxxxx          |  Long distance number       |
       |  9011 + up to 15 digits|  International number       |
        ------------------------------------------------------

   The solution to this problem is to have the Call Agent load the
   gateway with a digit map that may correspond to the dial plan.  This
   digit map is expressed using a syntax derived from the Unix system
   command, egrep.  For example, the dial plan described above results
   in the following digit map:

      (0T|00T|[1-7]xxx|8xxxxxxx|#xxxxxxx|*xx|91xxxxxxxxxx|9011x.T)

   The formal syntax of the digit map is described by the DigitMap rule
   in the formal syntax description of the protocol (see Appendix A) -
   support for basic digit map letters is REQUIRED while support for
   extension digit map letters is OPTIONAL.  A gateway receiving a digit
   map with an extension digit map letter not supported SHOULD return
   error code 537 (unknown digit map extension).

   A digit map, according to this syntax, is defined either by a (case
   insensitive) "string" or by a list of strings.  Each string in the
   list is an alternative numbering scheme, specified either as a set of
   digits or timers, or as an expression over which the gateway will
   attempt to find a shortest possible match.  The following constructs
   can be used in each numbering scheme:

   * Digit:    A digit from "0" to "9".
   * Timer:    The symbol "T" matching a timer expiry.
   * DTMF:     A digit, a timer, or one of the symbols "A", "B", "C",
               "D", "#", or "*".  Extensions may be defined.
   * Wildcard: The symbol "x" which matches any digit ("0" to "9").
   * Range:    One or more DTMF symbols enclosed between square brackets
               ("[" and "]").
   * Subrange: Two digits separated by hyphen ("-") which matches any
               digit between and including the two.  The subrange
               construct can only be used inside a range construct,
               i.e., between "[" and "]".
   * Position: A period (".") which matches an arbitrary number,
               including zero, of occurrences of the preceding
               construct.

   A gateway that detects events to be matched against a digit map MUST
   do the following:

   1) Add the event code as a token to the end of an internal state
      variable for the endpoint called the "current dial string".

   2) Apply the current dial string to the digit map table, attempting a
      match to each expression in the digit map.

   3) If the result is under-qualified (partially matches at least one
      entry in the digit map and doesn't completely match another
      entry), do nothing further.

   If the result matches an entry, or is over-qualified (i.e., no
   further digits could possibly produce a match), send the list of
   accumulated events to the Call Agent.  A match, in this
   specification, can be either a "perfect match," exactly matching one
   of the specified alternatives, or an impossible match, which occurs
   when the dial string does not match any of the alternatives.
   Unexpected timers, for example, can cause "impossible matches".  Both
   perfect matches and impossible matches trigger notification of the
   accumulated digits (which may include other events - see Section
   2.3.3).

   The following example illustrates the above.  Assume we have the
   digit map:

      (xxxxxxx|x11)

   and a current dial string of "41".  Given the input "1" the current
   dial string becomes "411".  We have a partial match with "xxxxxxx",
   but a complete match with "x11", and hence we send "411" to the Call
   Agent.

   The following digit map example is more subtle:

     (0[12].|00|1[12].1|2x.#)

   Given the input "0", a match will occur immediately since position
   (".") allows for zero occurrences of the preceding construct.  The
   input "00" can thus never be produced in this digit map.

   Given the input "1", only a partial match exists.  The input "12" is
   also only a partial match, however both "11" and "121" are a match.

   Given the input "2", a partial match exists.  A partial match also
   exists for the input "23", "234", "2345", etc.  A full match does not
   occur here until a "#" is generated, e.g., "2345#".  The input "2#"
   would also have been a match.

   Note that digit maps simply define a way of matching sequences of
   event codes against a grammar.  Although digit maps as defined here
   are for DTMF input, extension packages can also be defined so that
   digit maps can be used for other types of input represented by event
   codes that adhere to the digit map syntax already defined for these
   event codes (e.g., "1" or "T").  Where such usage is envisioned, the
   definition of the particular event(s) SHOULD explicitly state that in
   the package definition.

   Since digit maps are not bounded in size, it is RECOMMENDED that
   gateways support digit maps up to at least 2048 bytes per endpoint.

2.1.6 Packages

   MGCP is a modular and extensible protocol, however with extensibility
   comes the need to manage, identify, and name the individual
   extensions.  This is achieved by the concept of packages, which are
   simply well-defined groupings of extensions.  For example, one
   package may support a certain group of events and signals, e.g.,
   off-hook and ringing, for analog access lines.  Another package may
   support another group of events and signals for analog access lines
   or for another type of endpoint such as video.  One or more packages
   may be supported by a given endpoint.

   MGCP allows the following types of extensions to be defined in a
   package:

   * BearerInformation

   * LocalConnectionOptions

   * ExtensionParameters

   * ConnectionModes

   * Events

   * Signals

   * Actions

   * DigitMapLetters

   * ConnectionParameters

   * RestartMethods

   * ReasonCodes

   * Return codes

   each of which will be explained in more detail below.  The rules for
   defining each of these extensions in a package are described in
   Section 6, and the encoding and syntax are defined in Section 3 and
   Appendix A.

   With the exception of DigitMapLetters, a package defines a separate
   name space for each type of extension by adding the package name as a
   prefix to the extension, i.e.:

      package-name/extension

   Thus the package-name is followed by a slash ("/") and the name of
   the extension.

   An endpoint supporting one or more packages may define one of those
   packages as the default package for the endpoint.  Use of the package
   name for events and signals in the default package for an endpoint is
   OPTIONAL, however it is RECOMMENDED to always include the package
   name.  All other extensions, except DigitMapLetter, defined in the
   package MUST include the package-name when referring to the
   extension.

   Package names are case insensitive strings of letters, hyphens and
   digits, with the restriction that hyphens shall never be the first or
   last character in a name.  Examples of package names are "D", "T",
   and "XYZ".  Package names are not case sensitive - names such as
   "XYZ", "xyz", and "xYz" are equal.

   Package definitions will be provided in other documents and with
   package names and extensions names registered with IANA.  For more
   details, refer to section 6.

   Implementers can gain experience by using experimental packages.  The
   name of an experimental package MUST start with the two characters
   "x-"; the IANA SHALL NOT register package names that start with these
   characters, or the characters "x+", which are reserved.  A gateway
   that receives a command referring to an unsupported package MUST
   return an error (error code 518 - unsupported package, is
   RECOMMENDED).

2.1.7 Events and Signals

   The concept of events and signals is central to MGCP.  A Call Agent
   may ask to be notified about certain events occurring in an endpoint
   (e.g., off-hook events) by including the name of the event in a
   RequestedEvents parameter (in a NotificationRequest command - see
   Section 2.3.3).

   A Call Agent may also request certain signals to be applied to an
   endpoint (e.g., dial-tone) by supplying the name of the event in a
   SignalRequests parameter.

   Events and signals are grouped in packages, within which they share
   the same name space which we will refer to as event names in the
   following.  Event names are case insensitive strings of letters,
   hyphens and digits, with the restriction that hyphens SHALL NOT be
   the first or last character in a name.  Some event codes may need to
   be parameterized with additional data, which is accomplished by
   adding the parameters between a set of parentheses.  Event names are
   not case sensitive - values such as "hu", "Hu", "HU" or "hU" are
   equal.

   Examples of event names can be "hu" (off hook or "hang-up"
   transition), "hf" (hook-flash) or "0" (the digit zero).

   The package name is OPTIONAL for events in the default package for an
   endpoint, however it is RECOMMENDED to always include the package
   name.  If the package name is excluded from the event name, the
   default package name for that endpoint MUST be assumed.  For example,
   for an analog access line which has the line package ("L") as a
   default with dial-tone ("dl") as one of the events in that package,
   the following two event names are equal:

      L/dl

   and

      dl

   For any other non-default packages that are associated with that
   endpoint, (such as the generic package for an analog access
   endpoint-type for example), the package name MUST be included with
   the event name.  Again, unconditional inclusion of the package name
   is RECOMMENDED.

   Digits, or letters, are supported in some packages, notably "DTMF".
   Digits and letters are defined by the rules "Digit" and "Letter" in
   the definition of digit maps.  This definition refers to the digits
   (0 to 9), to the asterisk or star ("*") and orthotrope, number or
   pound sign ("#"), and to the letters "A", "B", "C" and "D", as well
   as the timer indication "T".  These letters can be combined in "digit
   string" that represents the keys that a user punched on a dial.  In
   addition, the letter "X" can be used to represent all digits (0 to
   9).  Also, extensions MAY define use of other letters.  The need to
   easily express the digit strings in earlier versions of the protocol
   has a consequence on the form of event names:

   An event name that does not denote a digit MUST always contain at
   least one character that is neither a digit, nor one of the letters
   A, B, C, D, T or X (such names also MUST NOT just contain the special
   signs "*", or "#").  Event names consisting of more than one
   character however may use any of the above.

   A Call Agent may often have to ask a gateway to detect a group of
   events.  Two conventions can be used to denote such groups:

   * The "*" and "all" wildcard conventions (see below) can be used to
     detect any event belonging to a package, or a given event in many
     packages, or any event in any package supported by the gateway.

   * The regular expression Range notation can be used to detect a range
     of digits.

   The star sign (*) can be used as a wildcard instead of a package
   name, and the keyword "all" can be used as a wildcard instead of an
   event name:

   * A name such as "foo/all" denotes all events in package "foo".

   * A name such as "*/bar" denotes the event "bar" in any package
     supported by the gateway.

   * The name "*/all" denotes all events supported by the endpoint.

   This specification purposely does not define any additional detail
   for the "all packages" and "all events" wildcards.  They provide
   limited benefits, but introduce significant complexity along with the
   potential for errors.  Their use is consequently strongly
   discouraged.

   The Call Agent can ask a gateway to detect a set of digits or letters
   either by individually describing those letters, or by using the
   "range" notation defined in the syntax of digit strings.  For
   example, the Call Agent can:

   * Use the letter "x" to denote" digits from 0 to 9.
   * Use the notation "[0-9#]" to denote the digits 0 to 9 and the pound
     sign.

   The individual event codes are still defined in a package though
   (e.g., the "DTMF" package).

   Events can by default only be generated and detected on endpoints,
   however events can be also be defined so they can be generated or
   detected on connections rather than on the endpoint itself (see
   Section 6.6).  For example, gateways may be asked to provide a
   ringback tone on a connection.  When an event is to be applied on a
   connection, the name of the connection MUST be added to the name of
   the event, using an "at" sign (@) as a delimiter, as in:

      G/rt@0A3F58

   where "G" is the name of the package and "rt" is the name of the
   event.  Should the connection be deleted while an event or signal is
   being detected or applied on it, that particular event detection or
   signal generation simply stops.  Depending on the signal, this may
   generate a failure (see below).

   The wildcard character "*" (star) can be used to denote "all
   connections".  When this convention is used, the gateway will
   generate or detect the event on all the connections that are
   connected to the endpoint.  This applies to existing as well as
   future connections created on the endpoint.  An example of this
   convention could be:

      R/qa@*

   where "R" is the name of the package and "qa" is the name of the
   event.

   When processing a command using the "all connections" wildcard, the
   "*" wildcard character applies to all current and future connections
   on the endpoint, however it will not be expanded.  If a subsequent
   command either explicitly (e.g., by auditing) or implicitly (e.g., by
   persistence) refers to such an event, the "*" value will be used.
   However, when the event is actually observed, that particular
   occurrence of the event will include the name of the specific
   connection it occurred on.

   The wildcard character "$" can be used to denote "the current
   connection".  It can only be used by the Call Agent, when the event
   notification request is "encapsulated" within a connection creation
   or modification command.  When this convention is used, the gateway
   will generate or detect the event on the connection that is currently
   being created or modified.  An example of this convention is:

      G/rt@$

   When processing a command using the "current connection" wildcard,
   the "$" wildcard character will be expanded to the value of the
   current connection.  If a subsequent command either explicitly (e.g.,
   by auditing) or implicitly (e.g., by persistence) refers to such an
   event, the expanded value will be used.  In other words, the "current
   connection" wildcard is expanded once, which is at the initial
   processing of the command in which it was explicitly included.

   The connection id, or a wildcard replacement, can be used in
   conjunction with the "all packages" and "all events" conventions. For
   example, the notation:

      */all@*

   can be used to designate all events on all current and future
   connections on the endpoint.  However, as mentioned before, the use
   of the "all packages" and "all events" wildcards are strongly
   discouraged.

   Signals are divided into different types depending on their behavior:

   * On/off (OO):  Once applied, these signals last until they are
     turned off.  This can only happen as the result of a reboot/restart
     or a new SignalRequests where the signal is explicitly turned off
     (see later).  Signals of type OO are defined to be idempotent, thus
     multiple requests to turn a given OO signal on (or off) are

     perfectly valid and MUST NOT result in any errors.  An On/Off
     signal could be a visual message-waiting indicator (VMWI).  Once
     turned on, it MUST NOT be turned off until explicitly instructed to
     by the Call Agent, or as a result of an endpoint restart, i.e.,
     these signals will not turn off as a result of the detection of a
     requested event.

   * Time-out (TO):  Once applied, these signals last until they are
     either cancelled (by the occurrence of an event or by not being
     included in a subsequent (possibly empty) list of signals), or a
     signal-specific period of time has elapsed.  A TO signal that times
     out will generate an "operation complete" event.  A TO signal could
     be "ringback" timing out after 180 seconds.  If an event occurs
     prior to the 180 seconds, the signal will, by default, be stopped
     (the "Keep signals active" action - see Section 2.3.3 - will
     override this behavior).  If the signal is not stopped, the signal
     will time out, stop and generate an "operation complete" event,
     about which the Call Agent may or may not have requested to be
     notified.  If the Call Agent has asked for the "operation complete"
     event to be notified, the "operation complete" event sent to the
     Call Agent SHALL include the name(s) of the signal(s) that timed
     out (note that if parameters were passed to the signal, the
     parameters will not be reported).  If the signal was generated on a
     connection, the name of the connection SHALL be included as
     described above.  Time-out signals have a default time-out value
     defined for them, which MAY be altered by the provisioning process.
     Also, the time-out period may be provided as a parameter to the
     signal (see Section 3.2.2.4).  A value of zero indicates that the
     time-out period is infinite.  A TO signal that fails after being
     started, but before having generated an "operation complete" event
     will generate an "operation failure" event which will include the
     name of the signal that failed.  Deletion of a connection with an
     active TO signal will result in such a failure.

   * Brief (BR):  The duration of these signals is normally so short
     that they stop on their own.  If a signal stopping event occurs, or
     a new SignalRequests is applied, a currently active BR signal will
     not stop.  However, any pending BR signals not yet applied MUST be
     cancelled (a BR signal becomes pending if a NotificationRequest
     includes a BR signal, and there is already an active BR signal). As
     an example, a brief tone could be a DTMF digit. If the DTMF digit
     "1" is currently being played, and a signal stopping event occurs,
     the "1" would play to completion.  If a request to play DTMF digit
     "2" arrives before DTMF digit "1" finishes playing, DTMF digit "2"
     would become pending.

   Signal(s) generated on a connection MUST include the name of that
   connection.

2.2 Usage of SDP

   The Call Agent uses the MGCP to provide the endpoint with the
   description of connection parameters such as IP addresses, UDP port
   and RTP profiles.  These descriptions will follow the conventions
   delineated in the Session Description Protocol which is now an IETF
   proposed standard, documented in RFC 2327.

2.3 Gateway Control Commands

2.3.1 Overview of Commands

   This section describes the commands of the MGCP.  The service
   consists of connection handling and endpoint handling commands.
   There are currently nine commands in the protocol:

   * The Call Agent can issue an EndpointConfiguration command to a
     gateway, instructing the gateway about the coding characteristics
     expected by the "line-side" of the endpoint.

   * The Call Agent can issue a NotificationRequest command to a
     gateway, instructing the gateway to watch for specific events such
     as hook actions or DTMF tones on a specified endpoint.

   * The gateway will then use the Notify command to inform the Call
     Agent when the requested events occur.

   * The Call Agent can use the CreateConnection command to create a
     connection that terminates in an "endpoint" inside the gateway.

   * The Call Agent can use the ModifyConnection command to change the
     parameters associated with a previously established connection.

   * The Call Agent can use the DeleteConnection command to delete an
     existing connection.  The DeleteConnection command may also be used
     by a gateway to indicate that a connection can no longer be
     sustained.

   * The Call Agent can use the AuditEndpoint and AuditConnection
     commands to audit the status of an "endpoint" and any connections
     associated with it.  Network management beyond the capabilities
     provided by these commands is generally desirable.  Such
     capabilities are expected to be supported by the use of the Simple
     Network Management Protocol (SNMP) and definition of a MIB which is
     outside the scope of this specification.

   * The Gateway can use the RestartInProgress command to notify the
     Call Agent that a group of endpoints managed by the gateway is
     being taken out-of-service or is being placed back in-service.

   These services allow a controller (normally, the Call Agent) to
   instruct a gateway on the creation of connections that terminate in
   an "endpoint" attached to the gateway, and to be informed about
   events occurring at the endpoint.  An endpoint may be for example:

   * A specific trunk circuit, within a trunk group terminating in a
     gateway,

   * A specific announcement handled by an announcement server.

   Connections are logically grouped into "calls" (the concept of a
   "call" has however little semantic meaning in MGCP itself).  Several
   connections, that may or may not belong to the same call, can
   terminate in the same endpoint.  Each connection is qualified by a
   "mode" parameter, which can be set to "send only" (sendonly),
   "receive only" (recvonly), "send/receive" (sendrecv), "conference"
   (confrnce), "inactive" (inactive), "loopback", "continuity test"
   (conttest), "network loop back" (netwloop) or "network continuity
   test" (netwtest).

   Media generated by the endpoint is sent on connections whose mode is
   either "send only", "send/receive", or "conference", unless the
   endpoint has a connection in "loopback" or "continuity test" mode.
   However, media generated by applying a signal to a connection is
   always sent on the connection, regardless of the mode.

   The handling of the media streams received on connections is
   determined by the mode parameters:

   * Media streams received through connections in "receive",
     "conference" or "send/receive" mode are mixed and sent to the
     endpoint, unless the endpoint has another connection in "loopback"
     or "continuity test" mode.

   * Media streams originating from the endpoint are transmitted over
     all the connections whose mode is "send", "conference" or
     "send/receive", unless the endpoint has another connection in
     "loopback" or "continuity test" mode.

   * In addition to being sent to the endpoint, a media stream received
     through a connection in "conference" mode is forwarded to all the
     other connections whose mode is "conference".  This also applies

     when the endpoint has a connection in "loopback" or "continuity
     test" mode.  The details of this forwarding, e.g., RTP translator
     or mixer, is outside the scope of this document.

   Note that in order to detect events on a connection, the connection
   must by default be in one of the modes "receive", "conference",
   "send/receive", "network loopback" or "network continuity test".  The
   event detection only applies to the incoming media.  Connections in
   "sendonly", "inactive", "loopback", or "continuity test" mode will
   thus normally not detect any events, although requesting to do so is
   not considered an error.

   The "loopback" and "continuity test" modes are used during
   maintenance and continuity test operations.  An endpoint may have
   more than one connection in either "loopback" or "continuity test"
   mode.  As long as there is one connection in that particular mode,
   and no other connection on the endpoint is placed in a different
   maintenance or test mode, the maintenance or test operation shall
   continue undisturbed.  There are two flavors of continuity test, one
   specified by ITU and one used in the US.  In the first case, the test
   is a loopback test.  The originating switch will send a tone (the go
   tone) on the bearer circuit and expects the terminating switch to
   loopback the tone.  If the originating switch sees the same tone
   returned (the return tone), the COT has passed.  If not, the COT has
   failed.  In the second case, the go and return tones are different.
   The originating switch sends a certain go tone.  The terminating
   switch detects the go tone, it asserts a different return tone in the
   backwards direction.  When the originating switch detects the return
   tone, the COT is passed.  If the originating switch never detects the
   return tone, the COT has failed.

   If the mode is set to "loopback", the gateway is expected to return
   the incoming signal from the endpoint back into that same endpoint.
   This procedure will be used, typically, for testing the continuity of
   trunk circuits according to the ITU specifications.  If the mode is
   set to "continuity test", the gateway is informed that the other end
   of the circuit has initiated a continuity test procedure according to
   the GR specification (see [22]).  The gateway will place the circuit
   in the transponder mode required for dual-tone continuity tests.

   If the mode is set to "network loopback", the audio signals received
   from the connection will be echoed back on the same connection.  The
   media is not forwarded to the endpoint.

   If the mode is set to "network continuity test", the gateway will
   process the packets received from the connection according to the
   transponder mode required for dual-tone continuity test, and send the
   processed signal back on the connection.  The media is not forwarded

   to the endpoint.  The "network continuity test" mode is included for
   backwards compatibility only and use of it is discouraged.

2.3.2 EndpointConfiguration

   The EndpointConfiguration command can be used to specify the encoding
   of the signals that will be received by the endpoint.  For example,
   in certain international telephony configurations, some calls will
   carry mu-law encoded audio signals, while others will use A-law.  The
   Call Agent can use the EndpointConfiguration command to pass this
   information to the gateway.  The configuration may vary on a call by
   call basis, but can also be used in the absence of any connection.

         ReturnCode,
         [PackageList]
         <-- EndpointConfiguration(EndpointId,
                                   [BearerInformation])

   EndpointId is the name of the endpoint(s) in the gateway where
   EndpointConfiguration executes.  The "any of" wildcard convention
   MUST NOT be used.  If the "all of" wildcard convention is used, the
   command applies to all the endpoints whose name matches the wildcard.

   BearerInformation is a parameter defining the coding of the data sent
   to and received from the line side.  The information is encoded as a
   list of sub-parameters.  The only sub-parameter defined in this
   version of the specification is the bearer encoding, whose value can
   be set to "A-law" or "mu-law".  The set of sub-parameters may be
   extended.

   In order to allow for extensibility, while remaining backwards
   compatible, the BearerInformation parameter is conditionally optional
   based on the following conditions:

   * if Extension Parameters (vendor, package or other) are not used,
     the BearerInformation parameter is REQUIRED,

   * otherwise, the BearerInformation parameter is OPTIONAL.

   When omitted, BearerInformation MUST retain its current value.

   ReturnCode is a parameter returned by the gateway.  It indicates the
   outcome of the command and consists of an integer number optionally
   followed by commentary.

   PackageList is a list of supported packages that MAY be included with
   error code 518 (unsupported package).

2.3.3 NotificationRequest

   The NotificationRequest command is used to request the gateway to
   send notifications upon the occurrence of specified events in an
   endpoint.  For example, a notification may be requested for when a
   gateway detects that an endpoint is receiving tones associated with
   fax communication.  The entity receiving this notification may then
   decide to specify use of a different type of encoding method in the
   connections bound to this endpoint and instruct the gateway
   accordingly with a ModifyConnection Command.

         ReturnCode,
         [PackageList]
         <-- NotificationRequest(EndpointId,
                                 [NotifiedEntity,]
                                 [RequestedEvents,]
                                 RequestIdentifier,
                                 [DigitMap,]
                                 [SignalRequests,]
                                 [QuarantineHandling,]
                                 [DetectEvents,]
                                 [encapsulated EndpointConfiguration])

   EndpointId is the identifier for the endpoint(s) in the the gateway
   where the NotificationRequest executes.  The "any of" wildcard MUST
   NOT be used.

   NotifiedEntity is an optional parameter that specifies a new
   "notified entity" for the endpoint.

   RequestIdentifier is used to correlate this request with the
   notifications that it triggers.  It will be repeated in the
   corresponding Notify command.

   RequestedEvents is a list of events, possibly qualified by event
   parameters (see Section 3.2.2.4), that the gateway is requested to
   detect and report.  Such events may include, for example, fax tones,
   continuity tones, or on-hook transition.  Unless otherwise specified,
   events are detected on the endpoint, however some events can be
   detected on a connection.  A given event MUST NOT appear more than
   once in a RequestedEvents.  If the parameter is omitted, it defaults
   to empty.

   To each event is associated one or more actions, which can be:

   * Notify the event immediately, together with the accumulated list of
     observed events,

   * Swap audio,

   * Accumulate the event in an event buffer, but don't notify yet,

   * Accumulate according to Digit Map,

   * Keep Signal(s) active,

   * Process the Embedded Notification Request,

   * Ignore the event.

   Support for Notify, Accumulate, Keep Signal(s) Active, Embedded
   Notification Request, and Ignore is REQUIRED.  Support for Accumulate
   according to Digit Map is REQUIRED on any endpoint capable of
   detecting DTMF.  Support for any other action is OPTIONAL.  The set
   of actions can be extended.

   A given action can by default be specified for any event, although
   some actions will not make sense for all events.  For example, an
   off-hook event with the Accumulate according to Digit Map action is
   valid, but will of course immediately trigger a digit map mismatch
   when the off-hook event occurs.  Needless to say, such practice is
   discouraged.

   Some actions can be combined as shown in the table below, where "Y"
   means the two actions can be combined, and "N" means they cannot:

       --------------------------------------------------------------
      |       | Notif | Swap | Accum | AccDi | KeSiA | EmbNo | Ignor |
      |--------------------------------------------------------------|
      | Notif |   N   |   Y  |   N   |   N   |   Y   |   Y*  |   N   |
      | Swap  |   -   |   N  |   Y   |   N   |   N   |   N   |   Y   |
      | Accum |   -   |   -  |   N   |   N   |   Y   |   Y   |   N   |
      | AccDi |   -   |   -  |   -   |   N   |   Y   |   N   |   N   |
      | KeSiA |   -   |   -  |   -   |   -   |   N   |   Y   |   Y   |
      | EmbNo |   -   |   -  |   -   |   -   |   -   |   N   |   N   |
      | Ignor |   -   |   -  |   -   |   -   |   -   |   -   |   N   |
       --------------------------------------------------------------

      Note (*):  The "Embedded Notification Request" can only be
      combined with "Notify", if the gateway is allowed to issue more
      than one Notify command per Notification request (see below and
      Section 4.4.1).

   If no action is specified, the Notify action will be applied.  If one
   or more actions are specified, only those actions apply.  When two or
   more actions are specified, each action MUST be combinable with all

   the other actions as defined by the table above - the individual
   actions are assumed to occur simultaneously.

   If a client receives a request with an invalid or unsupported action
   or an illegal combination of actions, it MUST return an error to the
   Call Agent (error code 523 - unknown or illegal combination of
   actions, is RECOMMENDED).

   In addition to the RequestedEvents parameter specified in the
   command, some MGCP packages may contain "persistent events" (this is
   generally discouraged though - see Appendix B for an alternative).
   Persistent events in a given package are always detected on an
   endpoint that implements that package.  If a persistent event is not
   included in the list of RequestedEvents, and the event occurs, the
   event will be detected anyway and processed like all other events, as
   if the persistent event had been requested with a Notify action.  A
   NotificationRequest MUST still be in place for a persistent event to
   trigger a Notify though. Thus, informally, persistent events can be
   viewed as always being implicitly included in the list of
   RequestedEvents with an action to Notify, although no glare
   detection, etc., will be performed.

   Non-persistent events are those events that need to be explicitly
   included in the RequestedEvents list. The (possibly empty) list of
   requested events completely replaces the previous list of requested
   events.  In addition to the persistent events, only the events
   specified in the requested events list will be detected by the
   endpoint.  If a persistent event is included in the RequestedEvents
   list, the action specified will replace the default action associated
   with the event for the life of the RequestedEvents list, after which
   the default action is restored.  For example, if "off-hook"was a
   persistent event, the "Ignore off-hook" action was specified, and a
   new request without any off-hook instructions were received, the
   default "Notify off-hook" operation would be restored.

   The gateway will detect the union of the persistent events and the
   requested events.  If an event is not included in either list, it
   will be ignored.

   The Call Agent can send a NotificationRequest with an empty (or
   omitted) RequestedEvents list to the gateway.  The Call Agent can do
   so, for example, to a gateway when it does not want to collect any
   more DTMF digits.  However, persistent events will still be detected
   and notified.

   The Swap Audio action can be used when a gateway handles more than
   one connection on an endpoint.  This will be the case for call
   waiting, and possibly other feature scenarios.  In order to avoid the

   round-trip to the Call Agent when just changing which connection is
   attached to the audio functions of the endpoint, the
   NotificationRequest can map an event (usually hook flash, but could
   be some other event) to a local swap audio function, which selects
   the "next" connection in a round robin fashion.  If there is only one
   connection, this action is effectively a no-op.  If there are more
   than two connections, the order is undefined.  If the endpoint has
   exactly two connections, one of which is "inactive", the other of
   which is in "send/receive" mode, then swap audio will attempt to make
   the "send/receive" connection "inactive", and vice versa.  This
   specification intentionally does not provide any additional detail on
   the swap audio action.

   If signal(s) are desired to start when an event being looked for
   occurs, the "Embedded NotificationRequest" action can be used.  The
   embedded NotificationRequest may include a new list of
   RequestedEvents, SignalRequests and a new digit map as well.  The
   semantics of the embedded NotificationRequest is as if a new
   NotificationRequest was just received with the same NotifiedEntity,
   RequestIdentifier, QuarantineHandling and DetectEvents.  When the
   "Embedded NotificationRequest" is activated, the "current dial
   string" will be cleared; however the list of observed events and the
   quarantine buffer will be unaffected (if combined with a Notify, the
   Notify will clear the list of observed events though - see Section
   4.4.1).  Note, that the Embedded NotificationRequest action does not
   accumulate the triggering event, however it can be combined with the
   Accumulate action to achieve that.  If the Embedded
   NotificationRequest fails, an Embedded NotificationRequest failure
   event SHOULD be generated (see Appendix B).

   MGCP implementations SHALL be able to support at least one level of
   embedding.  An embedded NotificationRequest that respects this
   limitation MUST NOT contain another Embedded NotificationRequest.

   DigitMap is an optional parameter that allows the Call Agent to
   provision the endpoint with a digit map according to which digits
   will be accumulated.  If this optional parameter is absent, the
   previously defined value is retained.  This parameter MUST be
   defined, either explicitly or through a previous command, if the
   RequestedEvents parameter contains a request to "accumulate according
   to the digit map".  The collection of these digits will result in a
   digit string.  The digit string is initialized to a null string upon
   reception of the NotificationRequest, so that a subsequent
   notification only returns the digits that were collected after this
   request.  Digits that were accumulated according to the digit map are
   reported as any other accumulated event, in the order in which they
   occur.  It is therefore possible that other events accumulated are

   found in between the list of digits.  If the gateway is requested to
   "accumulate according to digit map" and the gateway currently does
   not have a digit map for the endpoint in question, the gateway MUST
   return an error (error code 519 - endpoint does not have a digit map,
   is RECOMMENDED).

   SignalRequests is an optional parameter that contains the set of
   signals that the gateway is asked to apply.  When omitted, it
   defaults to empty.  When multiple signals are specified, the signals
   MUST be applied in parallel.  Unless otherwise specified, signals are
   applied to the endpoint.  However some signals can be applied to a
   connection.  Signals are identified by their name, which is an event
   name, and may be qualified by signal parameters (see Section
   3.2.2.4).  The following are examples of signals:

   * Ringing,

   * Busy tone,

   * Call waiting tone,

   * Off hook warning tone,

   * Ringback tones on a connection.

   Names and descriptions of signals are defined in the appropriate
   package.

   Signals are, by default, applied to endpoints.  If a signal applied
   to an endpoint results in the generation of a media stream (audio,
   video, etc.), then by default the media stream MUST NOT be forwarded
   on any connection associated with that endpoint, regardless of the
   mode of the connection.  For example, if a call-waiting tone is
   applied to an endpoint involved in an active call, only the party
   using the endpoint in question will hear the call-waiting tone.
   However, individual signals may define a different behavior.

   When a signal is applied to a connection that has received a
   RemoteConnectionDescriptor, the media stream generated by that signal
   will be forwarded on the connection regardless of the current mode of
   the connection (including loopback and continuity test).  If a
   RemoteConnectionDescriptor has not been received, the gateway MUST
   return an error (error code 527 - missing RemoteConnectionDescriptor,
   is RECOMMENDED).  Note that this restriction does not apply to
   detecting events on a connection.

   When a (possibly empty) list of signal(s) is supplied, this list
   completely replaces the current list of active time-out signals.
   Currently active time-out signals that are not provided in the new
   list MUST be stopped and the new signal(s) provided will now become
   active.  Currently active time-out signals that are provided in the
   new list of signals MUST remain active without interruption, thus the
   timer for such time-out signals will not be affected.  Consequently,
   there is currently no way to restart the timer for a currently active
   time-out signal without turning the signal off first.  If the time-
   out signal is parameterized, the original set of parameters MUST
   remain in effect, regardless of what values are provided
   subsequently.  A given signal MUST NOT appear more than once in a
   SignalRequests.  Note that applying a signal S to an endpoint,
   connection C1 and connection C2, constitutes three different and
   independent signals.

   The action triggered by the SignalRequests is synchronized with the
   collection of events specified in the RequestedEvents parameter.  For
   example, if the NotificationRequest mandates "ringing" and the
   RequestedEvents asks to look for an "off-hook" event, the ringing
   SHALL stop as soon as the gateway detects an off-hook event.  The
   formal definition is that the generation of all "Time Out" signals
   SHALL stop as soon as one of the requested events is detected, unless
   the "Keep signals active" action is associated to the detected event.
   The RequestedEvents and SignalRequests may refer to the same event
   definitions.  In one case, the gateway is asked to detect the
   occurrence of the event, and in the other case it is asked to
   generate it.  The specific events and signals that a given endpoint
   can detect or perform are determined by the list of packages that are
   supported by that endpoint.  Each package specifies a list of events
   and signals that can be detected or performed.  A gateway that is
   requested to detect or perform an event belonging to a package that
   is not supported by the specified endpoint MUST return an error
   (error code 518 - unsupported or unknown package, is RECOMMENDED).
   When the event name is not qualified by a package name, the default
   package name for the endpoint is assumed.  If the event name is not
   registered in this default package, the gateway MUST return an error
   (error code 522 - no such event or signal, is RECOMMENDED).

   The Call Agent can send a NotificationRequest whose requested signal
   list is empty.  It will do so for example when a time-out signal(s)
   should stop.

   If signal(s) are desired to start as soon as a "looked-for" event
   occurs, the "Embedded NotificationRequest" action can be used.  The
   embedded NotificationRequest may include a new list of
   RequestedEvents, SignalRequests and a new Digit Map as well.  The
   embedded NotificationRequest action allows the Call Agent to set up a

   "mini-script" to be processed by the gateway immediately following
   the detection of the associated event.  Any SignalRequests specified
   in the embedded NotificationRequest will start immediately.
   Considerable care must be taken to prevent discrepancies between the
   Call Agent and the gateway.  However, long-term discrepancies should
   not occur as a new SignalRequests completely replaces the old list of
   active time-out signals, and BR-type signals always stop on their
   own.  Limiting the number of On/Off-type signals is encouraged.  It
   is considered good practice for a Call Agent to occasionally turn on
   all On/Off signals that should be on, and turn off all On/Off signals
   that should be off.

   The Ignore action can be used to ignore an event, e.g., to prevent a
   persistent event from being notified.  However, the synchronization
   between the event and an active time-out signal will still occur by
   default (e.g., a time-out dial-tone signal will stop when an off-hook
   occurs even if off-hook was a requested event with action "Ignore").
   To prevent this synchronization from happening, the "Keep Signal(s)
   Active" action will have to be specified as well.

   The optional QuarantineHandling parameter specifies the handling of
   "quarantine" events, i.e., events that have been detected by the
   gateway before the arrival of this NotificationRequest command, but
   have not yet been notified to the Call Agent.  The parameter provides
   a set of handling options (see Section 4.4.1 for details):

   * whether the quarantined events should be processed or discarded
     (the default is to process them).

   * whether the gateway is expected to generate at most one
     notification (step by step), or multiple notifications (loop), in
     response to this request (the default is at most one).

   When the parameter is absent, the default value is assumed.

   We should note that the quarantine-handling parameter also governs
   the handling of events that were detected and processed but not yet
   notified when the command is received.

   DetectEvents is an optional parameter, possibly qualified by event
   parameters, that specifies a list of events that the gateway is
   requested to detect during the quarantine period.  When this
   parameter is absent, the events to be detected in the quarantine
   period are those listed in the last received DetectEvents list.  In
   addition, the gateway will also detect persistent events and the
   events specified in the RequestedEvents list, including those for
   which the "ignore" action is specified.

   Some events and signals, such as the in-line ringback or the quality
   alert, are performed or detected on connections terminating in the
   endpoint rather than on the endpoint itself.  The structure of the
   event names (see Section 2.1.7) allows the Call Agent to specify the
   connection(s) on which the events should be performed or detected.

   The NotificationRequest command may carry an encapsulated
   EndpointConfiguration command, that will apply to the same
   endpoint(s).  When this command is present, the parameters of the
   EndpointConfiguration command are included with the normal parameters
   of the NotificationRequest, with the exception of the EndpointId,
   which is not replicated.

   The encapsulated EndpointConfiguration command shares the fate of the
   NotificationRequest command.  If the NotificationRequest is rejected,
   the EndpointConfiguration is not executed.

   ReturnCode is a parameter returned by the gateway.  It indicates the
   outcome of the command and consists of an integer number optionally
   followed by commentary.

   PackageList is a list of supported packages that MAY be included with
   error code 518 (unsupported package).

2.3.4 Notify

   Notifications with the observed events are sent by the gateway via
   the Notify command when a triggering event occurs.

         ReturnCode,
         [PackageList]
         <-- Notify(EndpointId,
                    [NotifiedEntity,]
                    RequestIdentifier,
                    ObservedEvents)

   EndpointId is the name for the endpoint in the gateway which is
   issuing the Notify command.  The identifier MUST be a fully qualified
   endpoint identifier, including the domain name of the gateway.  The
   local part of the name MUST NOT use any of the wildcard conventions.

   NotifiedEntity is a parameter that identifies the entity which
   requested the notification.  This parameter is equal to the
   NotifiedEntity parameter of the NotificationRequest that triggered
   this notification.  The parameter is absent if there was no such
   parameter in the triggering request.  Regardless of the value of the
   NotifiedEntity parameter, the notification MUST be sent to the
   current "notified entity" for the endpoint.

   RequestIdentifier is a parameter that repeats the RequestIdentifier
   parameter of the NotificationRequest that triggered this
   notification.  It is used to correlate this notification with the
   request that triggered it.  Persistent events will be viewed here as
   if they had been included in the last NotificationRequest.  An
   implicit NotificationRequest MAY be in place right after restart -
   the RequestIdentifier used for it will be zero ("0") - see Section
   4.4.1 for details.

   ObservedEvents is a list of events that the gateway detected and
   accumulated.  A single notification may report a list of events that
   will be reported in the order in which they were detected (FIFO).

   The list will only contain the identification of events that were
   requested in the RequestedEvents parameter of the triggering
   NotificationRequest.  It will contain the events that were either
   accumulated (but not notified) or treated according to digit map (but
   no match yet), and the final event that triggered the notification or
   provided a final match in the digit map.  It should be noted that
   digits MUST be added to the list of observed events as they are
   accumulated, irrespective of whether they are accumulated according
   to the digit map or not.  For example, if a user enters the digits
   "1234" and some event E is accumulated between the digits "3" and "4"
   being entered, the list of observed events would be "1, 2, 3, E, 4".
   Events that were detected on a connection SHALL include the name of
   that connection as in "R/qa@0A3F58" (see Section 2.1.7).

   If the list of ObservedEvents reaches the capacity of the endpoint,
   an ObservedEvents Full event (see Appendix B) SHOULD be generated
   (the endpoint shall ensure it has capacity to include this event in
   the list of ObservedEvents).  If the ObservedEvents Full event is not
   used to trigger a Notify, event processing continues as before
   (including digit map matching); however, the subsequent events will
   not be included in the list of ObservedEvents.

   ReturnCode is a parameter returned by the Call Agent.  It indicates
   the outcome of the command and consists of an integer number
   optionally followed by commentary.

   PackageList is a list of supported packages that MAY be included with
   error code 518 (unsupported package).

2.3.5 CreateConnection

   This command is used to create a connection between two endpoints.

         ReturnCode,
         [ConnectionId,]
         [SpecificEndPointId,]
         [LocalConnectionDescriptor,]
         [SecondEndPointId,]
         [SecondConnectionId,]
         [PackageList]
         <-- CreateConnection(CallId,
                              EndpointId,
                              [NotifiedEntity,]
                              [LocalConnectionOptions,]
                              Mode,
                              [{RemoteConnectionDescriptor |
                              SecondEndpointId}, ]
                              [Encapsulated NotificationRequest,]
                              [Encapsulated EndpointConfiguration])

   A connection is defined by its endpoints.  The input parameters in
   CreateConnection provide the data necessary to build a gateway's
   "view" of a connection.

   CallId is a parameter that identifies the call (or session) to which
   this connection belongs.  This parameter SHOULD, at a minimum, be
   unique within the collection of Call Agents that control the same
   gateways.  Connections that belong to the same call SHOULD share the
   same call-id.  The call-id has little semantic meaning in the
   protocol; however it can be used to identify calls for reporting and
   accounting purposes.  It does not affect the handling of connections
   by the gateway.

   EndpointId is the identifier for the connection endpoint in the
   gateway where CreateConnection executes.  The EndpointId can be
   fully-specified by assigning a value to the parameter EndpointId in
   the function call or it may be under-specified by using the "any of"
   wildcard convention.  If the endpoint is underspecified, the endpoint
   identifier SHALL be assigned by the gateway and its complete value
   returned in the SpecificEndPointId parameter of the response.  When
   the "any of" wildcard is used, the endpoint assigned MUST be in-
   service and MUST NOT already have any connections on it.  If no such
   endpoint is available, error code 410 (no endpoint available) SHOULD
   be returned.  The "all of" wildcard MUST NOT be used.

   The NotifiedEntity is an optional parameter that specifies a new
   "notified entity" for the endpoint.

   LocalConnectionOptions is an optional structure used by the Call
   Agent to direct the handling of the connection by the gateway.  The
   fields contained in a LocalConnectionOptions structure may include
   one or more of the following (each field MUST NOT be supplied more
   than once):

   * Codec compression algorithm:  One or more codecs, listed in order
     of preference.  For interoperability, it is RECOMMENDED to support
     G.711 mu-law encoding ("PCMU").  See Section 2.6 for details on the
     codec selection process.

   * Packetization period:  A single millisecond value or a range may be
     specified.  The packetization period SHOULD NOT contradict the
     specification of the codec compression algorithm.  If a codec is
     specified that has a frame size which is inconsistent with the
     packetization period, and that codec is selected, the gateway is
     authorized to use a packetization period that is consistent with
     the frame size even if it is different from that specified.  In so
     doing, the gateway SHOULD choose a non-zero packetization period as
     close to that specified as possible.  If a packetization period is
     not specified, the endpoint SHOULD use the default packetization
     period(s) for the codec(s) selected.

   * Bandwidth:  The allowable bandwidth, i.e., payload plus any header
     overhead from the transport layer and up, e.g., IP, UDP, and RTP.
     The bandwidth specification SHOULD NOT contradict the specification
     of codec compression algorithm or packetization period.  If a codec
     is specified, then the gateway is authorized to use it, even if it
     results in the usage of a larger bandwidth than specified.  Any
     discrepancy between the bandwidth and codec specification will not
     be reported as an error.

   * Type of Service:  This indicates the class of service to be used
     for this connection.  When the Type of Service is not specified,
     the gateway SHALL use a default value of zero unless provisioned
     otherwise.

   * Usage of echo cancellation:  By default, the telephony gateways
     always perform echo cancellation on the endpoint.  However, it may
     be necessary, for some calls, to turn off these operations.  The
     echo cancellation parameter can have two values, "on" (when the
     echo cancellation is requested) and "off" (when it is turned off).
     The parameter is optional.  If the parameter is omitted when
     creating a connection and there are no other connections on the
     endpoint, the endpoint SHALL apply echo cancellation initially.  If
     the parameter is omitted when creating a connection and there are
     existing connections on the endpoint, echo cancellation is
     unchanged.  The endpoint SHOULD subsequently enable or disable echo

     cancellation when voiceband data is detected - see e.g., ITU-T
     recommendation V.8, V.25, and G.168.  Following termination of
     voiceband data, the handling of echo cancellation SHALL then revert
     to the current value of the echo cancellation parameter.  It is
     RECOMMENDED that echo cancellation handling is left to the gateway
     rather than having this parameter specified by the Call Agent.

   * Silence Suppression:  The telephony gateways may perform voice
     activity detection, and avoid sending packets during periods of
     silence.  However, it is necessary, for example for modem calls, to
     turn off this detection.  The silence suppression parameter can
     have two values, "on" (when the detection is requested) and "off"
     (when it is not requested).  The default is "off" (unless
     provisioned otherwise).  Upon detecting voiceband data, the
     endpoint SHOULD disable silence suppression.  Following termination
     of voiceband data, the handling of silence suppression SHALL then
     revert to the current value of the silence suppression parameter.

   * Gain Control:  The telephony gateways may perform gain control on
     the endpoint, in order to adapt the level of the signal.  However,
     it is necessary, for example for some modem calls, to turn off this
     function.  The gain control parameter may either be specified as
     "automatic", or as an explicit number of decibels of gain.  The
     gain specified will be added to media sent out over the endpoint
     (as opposed to the connection) and subtracted from media received
     on the endpoint.  The parameter is optional.  When there are no
     other connections on the endpoint, and the parameter is omitted,
     the default is to not perform gain control (unless provisioned
     otherwise), which is equivalent to specifying a gain of 0 decibels.
     If there are other connections on the endpoint, and the parameter
     is omitted, gain control is unchanged.  Upon detecting voiceband
     data, the endpoint SHOULD disable gain control if needed.
     Following termination of voiceband data, the handling of gain
     control SHALL then revert to the current value of the gain control
     parameter.  It should be noted, that handling of gain control is
     normally best left to the gateway and hence use of this parameter
     is NOT RECOMMENDED.

   * RTP security:  The Call agent can request the gateway to enable
     encryption of the audio Packets.  It does so by providing a key
     specification, as specified in RFC 2327.  By default, encryption is
     not performed.

   * Network Type:  The Call Agent may instruct the gateway to prepare
     the connection on a specified type of network.  If absent, the
     value is based on the network type of the gateway being used.

   * Resource reservation:  The Call Agent may instruct the gateway to
     use network resource reservation for the connection.  See Section
     2.7 for details.

   The Call Agent specifies the relevant fields it cares about in the
   command and leaves the rest to the discretion of the gateway.  For
   those of the above parameters that were not explicitly included, the
   gateway SHOULD use the default values if possible.  For a detailed
   list of local connection options included with this specification
   refer to section 3.2.2.10.  The set of local connection options can
   be extended.

   The Mode indicates the mode of operation for this side of the
   connection.  The basic modes are "send", "receive", "send/receive",
   "conference", "inactive", "loopback", "continuity test", "network
   loop back" and "network continuity test".  The expected handling of
   these modes is specified in the introduction of the "Gateway Control
   Commands", Section 2.3.  Note that signals applied to a connection do
   not follow the connection mode.  Some endpoints may not be capable of
   supporting all modes.  If the command specifies a mode that the
   endpoint does not support, an error SHALL be returned (error 517 -
   unsupported mode, is RECOMMENDED).  Also, if a connection has not yet
   received a RemoteConnectionDescriptor, an error MUST be returned if
   the connection is attempted to be placed in any of the modes "send
   only", "send/receive", "conference", "network loopback", "network
   continuity test", or if a signal (as opposed to detecting an event)
   is to be applied to the connection (error code 527 - missing
   RemoteConnectionDescriptor, is RECOMMENDED).  The set of modes can be
   extended.

   The gateway returns a ConnectionId, that uniquely identifies the
   connection within the endpoint, and a LocalConnectionDescriptor,
   which is a session description that contains information about the
   connection, e.g., IP address and port for the media, as defined in
   SDP.

   The SpecificEndPointId is an optional parameter that identifies the
   responding endpoint.  It is returned when the EndpointId argument
   referred to an "any of" wildcard name and the command succeeded.
   When a SpecificEndPointId is returned, the Call Agent SHALL use it as
   the EndpointId value in successive commands referring to this
   connection.

   The SecondEndpointId can be used instead of the
   RemoteConnectionDescriptor to establish a connection between two
   endpoints located on the same gateway.  The connection is by
   definition a local connection.  The SecondEndpointId can be fully-
   specified by assigning a value to the parameter SecondEndpointId in

   the function call or it may be under-specified by using the "any of"
   wildcard convention.  If the SecondEndpointId is underspecified, the
   second endpoint identifier will be assigned by the gateway and its
   complete value returned in the SecondEndPointId parameter of the
   response.

   When a SecondEndpointId is specified, the command really creates two
   connections that can be manipulated separately through
   ModifyConnection and DeleteConnection commands.  In addition to the
   ConnectionId and LocalConnectionDescriptor for the first connection,
   the response to the creation provides a SecondConnectionId parameter
   that identifies the second connection.  The second connection is
   established in "send/receive" mode.

   After receiving a "CreateConnection" request that did not include a
   RemoteConnectionDescriptor parameter, a gateway is in an ambiguous
   situation.  Because it has exported a LocalConnectionDescriptor
   parameter, it can potentially receive packets.  Because it has not
   yet received the RemoteConnectionDescriptor parameter of the other
   gateway, it does not know whether the packets that it receives have
   been authorized by the Call Agent.  It must thus navigate between two
   risks, i.e., clipping some important announcements or listening to
   insane data.  The behavior of the gateway is determined by the value
   of the Mode parameter:

   * If the mode was set to ReceiveOnly, the gateway MUST accept the
     media and transmit them through the endpoint.

   * If the mode was set to Inactive, Loopback, or Continuity Test, the
     gateway MUST NOT transmit the media through to the endpoint.

   Note that the mode values SendReceive, Conference, SendOnly, Network
   Loopback and Network Continuity Test do not make sense in this
   situation.  They MUST be treated as errors, and the command MUST be
   rejected (error code 527 - missing RemoteConnectionDescriptor, is
   RECOMMENDED).

   The command may optionally contain an encapsulated Notification
   Request command, which applies to the EndpointId, in which case a
   RequestIdentifier parameter MUST be present, as well as, optionally,
   other parameters of the NotificationRequest with the exception of the
   EndpointId, which is not replicated.  The encapsulated
   NotificationRequest is executed simultaneously with the creation of
   the connection.  For example, when the Call Agent wants to initiate a
   call to a residential gateway, it could:

   * ask the residential gateway to prepare a connection, in order to be
     sure that the user can start speaking as soon as the phone goes off
     hook,

   * ask the residential gateway to start ringing,

   * ask the residential gateway to notify the Call Agent when the phone
     goes off-hook.

   This can be accomplished in a single CreateConnection command, by
   also transmitting the RequestedEvents parameters for the off-hook
   event, and the SignalRequests parameter for the ringing signal.

   When these parameters are present, the creation and the
   NotificationRequest MUST be synchronized, which means that both MUST
   be accepted, or both MUST be refused.  In our example, the
   CreateConnection may be refused if the gateway does not have
   sufficient resources, or cannot get adequate resources from the local
   network access, and the off-hook NotificationRequest can be refused
   in the glare condition, if the user is already off-hook.  In this
   example, the phone must not ring if the connection cannot be
   established, and the connection must not be established if the user
   is already off-hook.

   The NotifiedEntity parameter, if present, defines the new "notified
   entity" for the endpoint.

   The command may carry an encapsulated EndpointConfiguration command,
   which applies to the EndpointId.  When this command is present, the
   parameters of the EndpointConfiguration command are included with the
   normal parameters of the CreateConnection with the exception of the
   EndpointId, which is not replicated.  The EndpointConfiguration
   command may be encapsulated together with an encapsulated
   NotificationRequest command.  Note that both of these apply to the
   EndpointId only.

   The encapsulated EndpointConfiguration command shares the fate of the
   CreateConnection command.  If the CreateConnection is rejected, the
   EndpointConfiguration is not executed.

   ReturnCode is a parameter returned by the gateway.  It indicates the
   outcome of the command and consists of an integer number optionally
   followed by commentary.

   PackageList is a list of supported packages that MAY be included with
   error code 518 (unsupported package).

2.3.6 ModifyConnection

   This command is used to modify the characteristics of a gateway's
   "view" of a connection.  This "view" of the call includes both the
   local connection descriptor as well as the remote connection
   descriptor.

         ReturnCode,
         [LocalConnectionDescriptor,]
         [PackageList]
         <-- ModifyConnection(CallId,
                              EndpointId,
                              ConnectionId,
                              [NotifiedEntity,]
                              [LocalConnectionOptions,]
                              [Mode,]
                              [RemoteConnectionDescriptor,]
                              [Encapsulated NotificationRequest,]
                              [Encapsulated EndpointConfiguration])

   The parameters used are the same as in the CreateConnection command,
   with the addition of a ConnectionId that identifies the connection
   within the endpoint.  This parameter was returned by the
   CreateConnection command, in addition to the local connection
   descriptor.  It uniquely identifies the connection within the context
   of the endpoint.  The CallId used when the connection was created
   MUST be included as well.

   The EndpointId MUST be a fully qualified endpoint identifier.  The
   local name MUST NOT use the wildcard conventions.

   The ModifyConnection command can be used to affect parameters of a
   connection in the following ways:

   * Provide information about the other end of the connection, through
     the RemoteConnectionDescriptor.  If the parameter is omitted, it
     retains its current value.

   * Activate or deactivate the connection, by changing the value of the
     Mode parameter.  This can occur at any time during the connection,
     with arbitrary parameter values.  If the parameter is omitted, it
     retains its current value.

   * Change the parameters of the connection through the
     LocalConnectionOptions, for example by switching to a different
     coding scheme, changing the packetization period, or modifying the
     handling of echo cancellation.  If one or more
     LocalConnectionOptions parameters are omitted, then the gateway

     SHOULD refrain from changing that parameter from its current value,
     unless another parameter necessitating such a change is explicitly
     provided.  For example, a codec change might require a change in
     silence suppression.  Note that if a RemoteConnectionDescriptor is
     supplied, then only the LocalConnectionOptions actually supplied
     with the ModifyConnection command will affect the codec negotiation
     (as described in Section 2.6).

   Connections can only be fully activated if the
   RemoteConnectionDescriptor has been provided to the gateway.  The
   receive-only mode, however, can be activated without the provision of
   this descriptor.

   The command will only return a LocalConnectionDescriptor if the local
   connection parameters, such as RTP ports, were modified.  Thus, if,
   for example, only the mode of the connection is changed, a
   LocalConnectionDescriptor will not be returned.  Note however, that
   inclusion of LocalConnectionOptions in the command is not a
   prerequisite for local connection parameter changes to occur.  If a
   connection parameter is omitted, e.g., silence suppression, the old
   value of that parameter will be retained if possible.  If a parameter
   change necessitates a change in one or more unspecified parameters,
   the gateway is free to choose suitable values for the unspecified
   parameters that must change.  This can for instance happen if the
   packetization period was not specified.  If the new codec supported
   the old packetization period, the value of this parameter would not
   change, as a change would not be necessary.  However, if it did not
   support the old packetization period, it would choose a suitable
   value.

   The command may optionally contain an encapsulated Notification
   Request command, in which case a RequestIdentifier parameter MUST be
   present, as well as, optionally, other parameters of the
   NotificationRequest with the exception of the EndpointId, which is
   not replicated.  The encapsulated NotificationRequest is executed
   simultaneously with the modification of the connection.  For example,
   when a connection is accepted, the calling gateway should be
   instructed to place the circuit in send-receive mode and to stop
   providing ringing tones.  This can be accomplished in a single
   ModifyConnection command, by also transmitting the RequestedEvents
   parameters, for the on-hook event, and an empty SignalRequests
   parameter, to stop the provision of ringing tones.

   When these parameters are present, the modification and the
   NotificationRequest MUST be synchronized, which means that both MUST
   be accepted, or both MUST be refused.

   The NotifiedEntity parameter, if present, defines the new "notified
   entity" for the endpoint.

   The command may carry an encapsulated EndpointConfiguration command,
   that will apply to the same endpoint.  When this command is present,
   the parameters of the EndpointConfiguration command are included with
   the normal parameters of the ModifyConnection with the exception of
   the EndpointId, which is not replicated.  The EndpointConfiguration
   command may be encapsulated together with an encapsulated
   NotificationRequest command.

   The encapsulated EndpointConfiguration command shares the fate of the
   ModifyConnection command.  If the ModifyConnection is rejected, the
   EndpointConfiguration is not executed.

   ReturnCode is a parameter returned by the gateway.  It indicates the
   outcome of the command and consists of an integer number optionally
   followed by commentary.

   PackageList is a list of supported packages that MAY be included with
   error code 518 (unsupported package).

2.3.7 DeleteConnection (from the Call Agent)

   This command is used to terminate