RFC 2705
Media Gateway Control Protocol (MGCP) Version 1.0
Media Gateway Control Protocol (MGCP) Version 1.0 ๐
okay bestie, this is RFC 2705 ๐ It came out in October 1999 from the Network Working Group, and it's labelled Informational ๐ธ That means it's here to share info with the community, not to be a standard. The authors are M. Arango (RSL COM), A. Dugan and I. Elliott (both Level3 Communications), C. Huitema (Telcordia), and S. Pickett (Vertical Networks) ๐ซถ The header doesn't say it obsoletes or updates anything, so it's its own little moment โจ
Status of this Memo โจ
so this memo is giving "for information only" ๐ It 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 (1999). All Rights Reserved. ๐
IESG NOTE: ๐
okay this part is important, so listen up ๐ 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 developments in the IETF Megaco Working Group and ITF-T SG16, who are currently working on a potential successor to this protocol. so if you're building with it, keep an eye on those groups ๐
Abstract ๐ง
okay so this doc describes an application programming interface and a corresponding protocol called MGCP, which controls Voice over IP (VoIP) Gateways from external call control elements ๐ MGCP assumes a call control architecture where the call control "intelligence" lives outside the gateways and gets handled by external call control elements. it's giving outsourcing, but make it protocol ๐
The document is structured in 6 main sections, and I'm obsessed with how it's organised ๐
- The introduction presents the basic assumptions and how things relate to other protocols like H.323, RTSP, SAP or SIP ๐ธ
- The interface section gives a conceptual overview of MGCP. It covers naming conventions, how the session description protocol SDP gets used, and the procedures that make up MGCP: Notifications Request, Notification, Create Connection, Modify Connection, Delete Connection, AuditEndpoint, AuditConnection and RestartInProgress โจ
- The protocol description section covers the MGCP encodings, which are based on simple text formats, and the transmission procedure over UDP ๐ฆ
- The security section covers MGCP's security requirements and how it uses IP security services (IPSEC) ๐
- The event packages section gives an initial definition of packages and event names ๐
- The last section describes the changes made when SGCP 1.1 and IPDC were combined to create MGCP 1.0 ๐ฅ
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
2. Media Gateway Control Interface ........................... 9
2.1. Model and naming conventions. ........................ 10
2.1.1. Types of endpoints .............................. 10
2.1.1.1. Digital channel (DS0) ...................... 11
2.1.1.2. Analog line ................................ 11
2.1.1.3. Annoucement server access point ............ 12
2.1.1.4. Interactive Voice Response access point .... 12
2.1.1.5. Conference bridge access point ............. 13
2.1.1.6. Packet relay ............................... 13
2.1.1.7. Wiretap access point ....................... 14
2.1.1.8. ATM "trunk side" interface. ................ 14
2.1.2. Endpoint identifiers ............................ 15
2.1.3. Calls and connections ........................... 17
2.1.3.1. Names of calls ............................. 20
2.1.3.2. Names of connections ....................... 20
2.1.3.3. Management of resources, attributes of ..... 20
2.1.3.4. Special case of local connections .......... 23
2.1.4. Names of Call Agents and other entities ......... 23
2.1.5. Digit maps ...................................... 24
2.1.6. Names of events ................................. 26
2.2. Usage of SDP ......................................... 29
2.3. Gateway Control Commands ............................. 30
2.3.1. EndpointConfiguration ........................... 32
2.3.2. NotificationRequest ............................. 33
2.3.3. CreateConnection ................................ 38
2.3.4. ModifyConnection ................................ 44
2.3.5. DeleteConnection (from the Call Agent) .......... 46
2.3.6. DeleteConnection (from the VoIP gateway) ........ 51
2.3.7. DeleteConnection (multiple connections, from the 51
2.3.8. Audit Endpoint .................................. 52
2.3.9. Audit Connection ................................ 55
2.3.10. Restart in progress ............................ 56
2.4. Return codes and error codes. ........................ 58
2.5. Reason Codes ......................................... 61
3. Media Gateway Control Protocol ............................ 61
3.1. General description .................................. 62
3.2. Command Header ....................................... 62
3.2.1. Command line .................................... 62
3.2.1.1. Coding of the requested verb ............... 63
3.2.1.2. Transaction Identifiers .................... 63
3.2.1.3. Coding of the endpoint identifiers and ..... 64
3.2.1.4. Coding of the protocol version ............. 65
3.2.2. Parameter lines ................................. 65
3.2.2.1. Response Acknowledgement ................... 68
3.2.2.2. Local connection options ................... 68
3.2.2.3. Capabilities ............................... 70
3.2.2.4. Connection parameters ...................... 71
3.2.2.5. Reason Codes ............................... 72
3.2.2.6. Connection mode ............................ 73
3.2.2.7. Coding of event names ...................... 73
3.2.2.8. RequestedEvents ............................ 74
3.2.2.9. SignalRequests ............................. 76
3.2.2.10. ObservedEvent ............................. 76
3.2.2.11. RequestedInfo ............................. 76
3.2.2.12. QuarantineHandling ........................ 77
3.2.2.13. DetectEvents .............................. 77
3.2.2.14. EventStates ............................... 77
3.2.2.15. RestartMethod ............................. 78
3.2.2.16. Bearer Information ........................ 78
3.3. Format of response headers ........................... 78
3.4. Formal syntax description of the protocol ............ 81
3.5. Encoding of the session description .................. 86
3.5.1. Usage of SDP for an audio service ............... 86
3.5.2. Usage of SDP in a network access service ........ 87
3.5.3. Usage of SDP for ATM connections ................ 90
3.5.4. Usage of SDP for local connections .............. 91
3.6. Transmission over UDP ................................ 91
3.6.1. Providing the At-Most-Once functionality ........ 91
3.6.2. Transaction identifiers and three ways handshake. 92
3.6.3. Computing retransmission timers ................. 93
3.6.4. Piggy backing ................................... 94
3.6.5. Provisional responses ........................... 94
4. States, failover and race conditions. ..................... 95
4.1. Basic Asumptions ..................................... 95
4.2. Security, Retransmission, and Detection of Lost ...... 96
4.3. Race conditions ...................................... 99
4.3.1. Quarantine list ................................. 99
4.3.2. Explicit detection ..............................103
4.3.3. Ordering of commands, and treatment of disorder .104
4.3.4. Fighting the restart avalanche ..................105
4.3.5. Disconnected Endpoints ..........................107
1. A "disconnected" timer is initialized to a random value, .107
2. The gateway then waits for either the end of this timer, .107
3. When the "disconnected" timer elapses, when a command is .107
4. If the "disconnected" procedure still left the endpoint ..107
5. Security requirements .....................................108
5.1. Protection of media connections ......................109
6. Event packages and end point types ........................109
6.1. Basic packages .......................................110
6.1.1. Generic Media Package ...........................110
6.1.2. DTMF package ....................................112
6.1.3. MF Package ......................................113
6.1.4. Trunk Package ...................................114
6.1.5. Line Package ....................................116
6.1.6. Handset emulation package .......................119
6.1.7. RTP Package .....................................120
6.1.8. Network Access Server Package ...................121
6.1.9. Announcement Server Package .....................122
6.1.10. Script Package .................................122
6.2. Basic endpoint types and profiles ....................123
7. Versions and compatibility ................................124
7.1. Differences between version 1.0 and draft 0.5 ........124
7.2. Differences between draft-04 and draft-05 ............125
7.3. Differences between draft-03 and draft-04 ............125
7.4. Differences between draft-02 and draft-03 ............125
7.5. Differences between draft-01 and draft-02 ............126
7.6. The making of MGCP from IPDC and SGCP ................126
7.7. Changes between MGCP and initial versions of SGCP ....126
8. Security Considerations ...................................128
9. Acknowledgements ..........................................128
10. References ................................................129
11. Authors' Addresses ........................................130
12. Appendix A: Proposed "MoveConnection" command .............132
12.1. Proposed syntax modification ........................133
13. Full Copyright Statement ..................................134
1. Introduction โจ
okay bestie, so this doc is about an abstract application programming interface and a protocol called MGCP ๐ . It's how outside call control boxes, called media gateway controllers or call agents, tell telephony gateways what to do ๐. A telephony gateway is the element that converts the audio on telephone circuits into data packets for the Internet or other packet networks ๐.
Here are the kinds of gateways:
- Trunking gateways, which sit between the telephone network and a Voice over IP network ๐ฅ. They usually handle a large number of digital circuits.
- Voice over ATM gateways, which work pretty much the same way as voice over IP trunking gateways, except they connect to an ATM network ๐ฆ.
- Residential gateways, which give you a classic analog (RJ11) interface to a Voice over IP network ๐ . Examples include cable modem/cable set-top boxes, xDSL devices, and broad-band wireless devices.
- Access gateways, which offer a classic analog (RJ11) or digital PBX interface to a Voice over IP network ๐ฑ. Examples include small-scale voice over IP gateways.
- Business gateways, which offer a traditional digital PBX interface or an integrated "soft PBX" interface to a Voice over IP network ๐ผ.
- Network Access Servers, which can attach a "modem" to a telephone circuit and give data access to the Internet ๐ธ. The authors expect that, in the future, the same gateways will combine Voice over IP services and Network Access services, which is so iconic.
- 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" lives outside the gateways and is handled by external call control elements ๐ง . It also assumes that these call control elements, or Call Agents, will synchronize with each other so they send coherent commands to the gateways they control ๐ซถ. MGCP doesn't define a mechanism for synchronizing Call Agents, though ๐. Honestly it's a master/slave protocol, where the gateways are expected to carry out the commands the Call Agents send ๐. So this document goes super deep on the expected behavior of the gateways, but only covers the parts of a call agent implementation, like timer management, that are mandated for the protocol to work properly ๐.
MGCP assumes a connection model where the basic building blocks are endpoints and connections ๐. Endpoints are sources or sinks of data, and they 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 trunk 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 ๐ถ. Creating physical endpoints takes hardware installation, but virtual endpoints can be created with software ๐ป.
Connections can be point to point or multipoint ๐ฆ. A point to point connection is an association between two endpoints for transmitting data between them. Once that association is set up for both endpoints, data can flow ๐ซถ. A multipoint connection is made by connecting the endpoint to a multipoint session ๐.
Connections can be set up over several types of bearer networks ๐ :
- Audio packets sent using RTP and UDP over a TCP/IP network ๐.
- Audio packets sent using AAL2, or another adaptation layer, over an ATM network ๐ฐ๏ธ.
- Packets sent over an internal connection, like the TDM backplane or the interconnection bus of a gateway ๐. This is used especially for "hairpin" connections, which terminate in a gateway but get immediately rerouted over the telephone network ๐.
For point-to-point connections, the endpoints of a connection can be in separate gateways or in the same gateway ๐.
1.1. Relation with the H.323 standards
MGCP is designed as an internal protocol inside a distributed system that looks like a single VoIP gateway from the outside ๐. This system has a Call Agent, which may or may not be spread across several computer platforms, plus a set of gateways. That set includes at least one "media gateway" that converts media signals between circuits and packets, and at least one "signalling gateway" when connecting to an SS7 controlled network ๐ฅ. In a typical setup, this distributed gateway system faces one side with one or more telephony (i.e. circuit) switches, and the other side with H.323 conformant systems, as shown in the table below ๐.
___________________________________________________________________
| 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 job, while the Call Agent handles the signaling and call processing ๐โโ๏ธ. So the Call Agent implements the "signaling" layers of the H.323 standard, and shows up 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
H.323 is the recognized standard for VoIP terminals ๐, but the IETF has also produced specs for other kinds of multi-media applications ๐ฌ. These other specs include:
- the Session Description Protocol (SDP), RFC 2327,
- the Session Announcement Protocol (SAP),
- the Session Initiation Protocol (SIP),
- the Real Time Streaming Protocol (RTSP), RFC 2326.
The last three are alternative signaling standards that let you send a session description to an interested party ๐. SAP is used by multicast session managers to distribute a multicast session description to a big group of recipients ๐ข. SIP is used to invite one individual user to join a point-to-point or unicast session ๐ฏ. RTSP is used to interface with a server that provides real time data ๐ฅ. In all three cases the session description follows SDP, and when audio is sent, it goes through the Real-time Transport Protocol, RTP ๐ง.
The distributed gateway systems and MGCP will let PSTN telephony users get into sessions set up using SAP, SIP or RTSP ๐โจ. The Call Agent handles the signaling conversion, like this:
_____________________________________________________________________
| 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 | |
| | | synchronization| |
| | | 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 is pivotal in this architecture ๐ท. We'll see in the description that follows that MGCP also uses it to carry session descriptions ๐.
1.3. Definitions
Trunk: A communication channel between two switching systems. E.g., a DS0 on a T1 or E1 line ๐.
2. Media Gateway Control Interface ๐ง
The interface functions handle connection control and endpoint control ๐๏ธ. Both use the same system model and the same naming conventions, which keeps things so consistent ๐.
2.1. Model and naming conventions
MGCP assumes a connection model where the basic constructs are endpoints and connections ๐. Connections are grouped into calls, and one or more connections can belong to one call ๐ฆ. Connections and calls get set up at the initiative of one or several Call Agents ๐ซถ.
2.1.1. Types of endpoints โจ
Okay so, remember those gateway classes we talked about in the intro? ๐ They can be lowkey misleading, bestie. Manufacturers can totally decide to pack several kinds of service into one box ๐ฆ. A single product could provide some trunk connections to telephony switches, some primary rate connections and some analog line interfaces, so it shares the vibes of what we called "trunking", "access" and "residential" gateways. MGCP doesn't make assumptions about these groupings ๐ซถ. We just assume that media gateways support collections of endpoints. The type of the endpoint determines its functionalities. After all our digging, we've isolated these basic endpoint types:
- Digital channel (DS0),
- Analog line,
- Annoucement server access point,
- Interactive Voice Response access point,
- Conference bridge access point,
- Packet relay,
- Wiretap access point,
- ATM "trunk side" interface.
In this section, we're gonna develop the expected behavior of these endpoints ๐ .
This list is not limitative, which means it's not a closed list ๐ง. Other endpoint types could show up later, like a test endpoint for checking network quality, or frame-relay endpoints for managing audio channels multiplexed over a frame-relay virtual circuit.
2.1.1.1. Digital channel (DS0)
Digital channels give you an 8Khz*8bit service ๐. You'll find them in trunk and ISDN interfaces, and they're typically part of digital multiplexes like T1, E1, T3 or E3 interfaces. Media gateways that support these channels can translate the digital signals received on the channel into audio packets. Those signals may be encoded according to A or mu-law, and they can use either the complete set of 8 bits or only 7 of them. When the media gateway also supports a NAS service, the gateway shall be capable of receiving either audio-encoded data (modem connection) or binary data (ISDN connection) and converting 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 coming from these connections shall be mixed according to the connection "mode", which we'll cover later in this document. The precise number of connections an endpoint supports is a characteristic of the gateway, and it may actually vary depending on how resources are allocated inside the gateway.
Sometimes digital channels carry signalling, like SS7 "F" links or ISDN "D" channels ๐. Media gateways that support these signalling functions shall be able to send and receive signalling packets to and from a call agent, using the "back haul" procedures defined by the SIGTRAN working group of the IETF. Digital channels are also sometimes used with channel associated signalling, such as "MF R2". Media gateways that support these signalling functions shall be able to detect and produce the matching signals, like "wink" or "A", according to the event signalling and reporting procedures defined in MGCP ๐.
2.1.1.2. Analog line
Analog lines can be used in two ways ๐ธ. As a "client" interface, they provide service to a classic telephone unit. As a "service" interface, they let the gateway 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 converting it 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 an endpoint supports is a characteristic of the gateway, and it may vary depending on how resources are allocated inside it. A typical gateway should, however, be able to support two or three connections per endpoint, so you can get fancy stuff like "call waiting" or "three ways calling" ๐โจ.
2.1.1.3. Annoucement server access point
An announcement server endpoint provides access to an announcement service ๐ข. When the call agent asks, the announcement server will "play" a specified announcement. The requests from the call agent follow the event signalling and reporting procedures defined in MGCP.
+----------------------+
| Announcement endpoint| -------- Connection
+----------------------+
A given announcement endpoint is not supposed to support more than one connection at a time ๐ โโ๏ธ. If several connections were established to the same endpoint, the same announcements would be played simultaneously over all of them.
Connections to an announcement server are typically oneway, or "half duplex" -- the announcement server isn't 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 ๐๏ธ. When the call agent asks, the IVR server will "play" announcements and tones, and it will "listen" to responses from the user. The requests from the call agent follow the event signalling and reporting procedures defined in MGCP.
+-------------+
| IVR endpoint| -------- Connection
+-------------+
A given IVR endpoint is not supposed to support more than one connection at a time. If several connections were established to the same endpoint, the same tones and announcements would be played simultaneously over all of them ๐ญ.
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 an endpoint supports is a characteristic of the gateway, and it may vary depending on how resources are allocated inside 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 that provide interoperation between incompatible gateways. Those gateways might not support compatible compression algorithms, or they might operate over different transmission networks, like IP and ATM ๐.
+-------
+---------------------+ |
|Packet relay endpoint| 2 connections
+---------------------+ |
+-------
2.1.1.7. Wiretap access point
A wiretap access point provides access to a wiretap service ๐ต๏ธโโ๏ธ. That service can provide either a recording or a live playback of a connection.
+-----------------+
| Wiretap endpoint| -------- Connection
+-----------------+
A given wiretap endpoint is not supposed to support more than one connection at a time. If several connections were established to the same endpoint, the recording or playback would mix the audio signals received on those connections ๐.
Connections to a wiretap endpoint are typically oneway, or "half duplex" -- the wiretap server is not expected to signal its presence in a call ๐คซ.
2.1.1.8. 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, and each of these trunks corresponds 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 an endpoint supports is a characteristic of the gateway, and it may vary depending on how resources are allocated inside the gateway. Iconic endpoint, no notes ๐.
2.1.2. Endpoint identifiers โจ
okay so endpoint identifiers have two components, and both are case insensitive ๐:
- the domain name of the gateway that is managing the endpoint,
- a local name within that gateway.
the syntax of the local name depends on what type of endpoint you're naming ๐. but the local name is always hierarchical for each type, starting with a term that identifies the physical gateway holding the endpoint and ending with a term that picks out the one individual endpoint. with that in mind, the following rules for building and reading the Entity Name field MUST be supported ๐ซถ:
- The individual terms of the naming path MUST be separated by a single slash (
/, ASCII 2F hex). - The individual terms are character strings made of letters, digits or other printable characters, except for characters used as delimitors (
/,@), characters used for wildcarding (*,$) and white spaces ๐ธ. - Wild-carding is written with an asterisk (
*) or a dollar sign ($) for each term of the naming path you want wild-carded. so if the full naming path looks like this:
term1/term2/term3
then the Entity Name field looks like this, depending on which terms get 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 every one of these examples a dollar sign could have shown up instead of an asterisk ๐.
- a term written as an asterisk means: "use ALL values of this term known within the scope of the Media Gateway". a term written as a dollar sign means: "use ANY ONE value of this term known within the scope of the Media Gateway". a specific command's description can add extra criteria for picking values on top of these general rules ๐ .
if the Media Gateway controls multiple physical gateways, the first term of the naming MUST identify the physical gateway containing the entity you want ๐. if the Media Gateway controls only a single physical gateway, the first term of the naming string MAY identify that physical gateway, depending on local practice. and a local name made of nothing but a wildcard character refers to either all (*) or any ($) endpoints within the media gateway ๐ง.
the naming rules are the same everywhere, so don't get tripped up by the wildcards! one asterisk is "all", one dollar sign is "any one" ๐
in the case of trunking gateways, endpoints are trunk circuits linking a gateway to a telephone switch ๐. these circuits are usually grouped into a digital multiplex, which connects to the gateway through a physical interface. those circuits get named in three different contexts, bestie:
- In the ISUP protocol, trunks are grouped into trunk groups, identified by the SS7 point codes of the switches that the group connects. circuits inside a trunk group are identified by a circuit number (CIC in ISUP) ๐ฆ.
- In the gateway configuration files, physical interfaces are usually identified by the name of the interface, which is an arbitrary text string. when the interface multiplexes several circuits, the individual circuits are usually identified by a circuit number โจ.
- In MGCP, the endpoints are identified by an endpoint identifier ๐.
the Call Agents use configuration databases to map ranges of circuit numbers within an ISUP trunk group to matching ranges of circuits in a multiplex connected to a gateway through a physical interface ๐. the gateway will be identified, in MGCP, by a domain name. the local name gets structured to encode both the name of the physical interface, for example X35V3+A4, and the circuit number inside the multiplex connected to that interface, for example 13. the circuit number is separated from the interface name by a fraction bar, like this:
X35V3+A4/13
other types of endpoints use different conventions. for example, in gateways were physical interfaces by construction only control one circuit, the circuit number gets left off. the exact syntax of those names should be specified in the corresponding server specification ๐.
2.1.3. Calls and connections
okay, connections get created on the call agent for each endpoint that's going to 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 establish two connections (C1 and C2):
+---+ +---+
(channel1) ===|EP1|--(C1)--... ...(C2)--|EP2|===(channel2)
+---+ +---+
each connection gets designated locally by a connection identifier, and it's characterized by connection attributes ๐ฆ.
when the two endpoints sit on gateways managed by the same call agent, the creation happens in three steps ๐ซถ:
- 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 needed for a third party to send packets towards the newly created connection, such as for example IP address, UDP port, and packetization parameters ๐.
- 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" ๐ธ.
- The call agent uses a "modify connection" command to give this second "session description" to the first endpoint. Once that's done, communication can go both ways ๐ฅ.
when the two endpoints sit on gateways managed by different call agents, those two call agents shall exchange information through a call-agent to call-agent signalling protocol, so they can synchronize the creation of the connection on the two endpoints ๐.
once a connection is established, its parameters can be changed at any time with a "modify connection" command ๐. the call agent may for example tell the gateway to change the compression algorithm used on a connection, or to change the IP address and UDP port that data gets sent to, if a connection is "redirected" โจ.
the call agent removes a connection by sending the gateway a "delete connection" command. the gateway may also, under some circumstances, inform a gateway that a connection could not be sustained ๐.
here's a diagram of the states a connection goes through, 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" ๐.
calls are identified by unique identifiers, independent of the underlying platforms or agents. these identifiers are created by the Call Agent, and MGCP treats them as unstructured octet strings ๐ท.
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. when a Call Agent builds several connections that belong to the same call, whether they're on the same gateway or on different gateways, those connections share the same call-id โจ. that 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 get created by the gateway when it's asked to create a connection ๐ฆ. they identify the connection within the context of an endpoint. MGCP treats them as unstructured octet strings. the gateway should 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.) ๐
2.1.3.3. Management of resources, attributes of connections โจ
Okay so, connections are basically packed with resources, like signal processing functions or packetization functions ๐ . Generally they fall into two categories, and bestie, these are super important:
- Externally visible resources, which affect the format of "the bits on the network" and have to be communicated to the second endpoint in the connection ๐.
- Internal resources, which decide what signal is being sent over the connection and how the endpoint processes the signals it receives ๐ง .
The resources allocated to a connection, and more generally how the connection is handled, are chosen by the gateway, but it's following instructions from the call agent ๐. The call agent sends two sets of parameters to the gateway to give those instructions:
- The local directives tell the gateway which resources to use for a connection ๐.
- When it's available, the "session description" from the other end of the connection ๐.
The local directives can specify things like the mode of the connection (for example send only, or send-receive), preferred coding or packetization methods, and whether echo cancellation or silence suppression is used ๐ง. (A detailed list is in the specification of the LocalConnectionOptions parameter of the CreateConnection command.) For each of these parameters, the call agent can specify a value, a range of values, or no value at all ๐ซถ. This lets different implementations have different levels of control, which is so iconic ๐. The call agent can be super strict and specify tiny details of how the connection gets handled, or super chill and only give broad guidelines, like the maximum bandwidth, and let the gateway pick the detailed values ๐ฆ.
Based on the local directives, the gateway works out which resources get allocated to the connection ๐ฅ. When it's possible, the gateway picks values that line up with the remote session description, but there's no absolute requirement that the parameters be exactly the same ๐.
Once the resources are allocated, the gateway writes a "session description" that describes how it intends to receive packets ๐จ. Note that the session description can sometimes show a range of values ๐. For example, if the gateway can accept one of several compression algorithms, it can give a list of those accepted algorithms โจ.
Local Directives
(from call agent 1)
|
V
+-------------+
| resources |
| allocation |
| (gateway 1) |
+-------------+
| |
V |
Local |
Parameters V
| Session
| Description Local Directives
| | (from call agent 2)
| +---> Transmission----+ |
| (CA to CA) | |
| V V
| +-------------+
| | resources |
| | 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 have a huge number of endpoints, and they're often different types ๐ข. In some networks, we often have to set up connections between endpoints that live in the same gateway, and examples include:
- Connecting a trunk line to a wiretap device,
- 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 way simpler to set up than network connections ๐. In most cases, the connection goes through some local interconnecting device, such as a TDM bus ๐.
When two endpoints are managed by the same gateway, you can specify the connection in a single command that names the two endpoints that get connected ๐. The command is basically a "Create Connection" command that includes the name of the second endpoint in place of the "remote session description" ๐.
2.1.4. Names of Call Agents and other entities ๐
The media gateway control protocol was designed to allow redundant Call Agents, for better network reliability ๐ก๏ธ. That means there's no fixed binding between entities and hardware platforms or network interfaces ๐ฆ.
Reliability can be improved with the following precautions:
- 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 should 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 should keep track of the time-to-live of the record they read from the DNS. They should query the DNS to refresh the information if the time to live has expired โฐ.
In addition to the indirection that domain names and the DNS provide, 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. When the endpoint needs to send a command to the Call Agent, it MUST send the command to the current "notified entity" for which endpoint(s) the command pertains ๐ฎ. Upon startup, the "notified entity" MUST be set to a provisioned value ๐. Most commands sent by the Call Agent can explicitly name the "notified entity" through a "NotifiedEntity" parameter ๐ฏ. The "notified entity" stays the same until either a new "NotifiedEntity" parameter is received or the endpoint reboots ๐. If the "notified entity" for an endpoint is empty or hasn't been set explicitly, it defaults to the source address of the last connection handling command or notification request received for the endpoint. Auditing will therefore not change the "notified entity" ๐.
2.1.5. Digit maps ๐ข
The Call Agent can ask the gateway to collect digits that the user dials ๐ฑ. This is meant for residential gateways, to collect the numbers a user dials. It can also be used with trunking gateways and access gateways, to collect access codes, credit card numbers, and other numbers requested by call control services ๐ณ.
An alternative is for the gateway to notify the Call Agent of each dialed digit as soon as it's dialed. But that creates a huge number of interactions, so it's better to accumulate the dialed numbers in a buffer and send them in a single message ๐ฆ.
The catch with the accumulation approach is that it's hard for the gateway to predict how many numbers it needs to accumulate before transmitting ๐ค. For example, here's what you can dial from the phone on our desk โ๏ธ:
_______________________________________________________
| 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 is to load the gateway with a digit map that corresponds to the dial plan ๐บ๏ธ. This digit map is expressed with a syntax derived from the Unix system command, egrep ๐ง. For example, the dial plan 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 (section 3.4). According to this syntax, a Digit-Map is defined either by a "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 a regular expression ๐. A gateway that detects digits, letters, or timers will:
- Add the event parameter code as a token to the end of an internal state variable called the "current dial string" โ.
- Apply the current dial string to the digit map table, attempting a match to each regular expression in the Digit Map in lexical order ๐.
- If the result is under-qualified (partially matches at least one entry in the digit map), do nothing further ๐คซ.
If the result matches, or is over-qualified (i.e., no further digits could possibly produce a match), send the current digit string to the Call Agent ๐ค. In this specification, a match can be either a "perfect match," which exactly matches one of the specified alternatives, or an impossible match, which occurs when the dial string doesn't 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 ๐ฅ.
Digit maps are provided to the gateway by the Call Agent whenever the Call Agent tells the gateway to listen for digits ๐.
2.1.6. Names of events โจ
okay bestie, events and signals are literally the heart of MGCP ๐ A Call Agent can ask to be notified when something happens on an endpoint (like an off-hook event ๐), and it can also ask for a signal to be applied to an endpoint (like dial-tone ๐ถ).
Events and signals get grouped into packages, and everything in a package shares the same namespace. We'll just call those event names from here on ๐ซถ A package is basically a bundle of the events and signals that a particular type of endpoint supports. One package might cover a group for analog access lines, and another might cover a different group for video lines ๐บ An endpoint-type can have one or more packages ๐ฆ
Event names are case insensitive ๐ and they're made of two logical parts: a package name and an event name. Both are strings of letters, hyphens and digits, but hyphens SHALL never be the first or last characters in a name. Package and event names are not case sensitive, so values like "hu", "Hu", "HU" or "hU" SHOULD be considered equal ๐
Examples of package names are "D" (DTMF), "M" (MF), "T" (Trunk) or "L" (Line) ๐ Examples of event names can be "hu" (off hook or "hang-up" transition), "hf" (flash hook) or "0" (the digit zero) โจ
In text, the package name (when there is one) is separated from the event name by a slash (/). The package name is actually optional ๐ธ Each endpoint-type has a default package attached to it, and if you leave the package name off, the default package for that endpoint-type is assumed. For example, for an analog access line, these two event names are equal:
l/dl dial-tone in the line package for an analog access line.
dl dial-tone in the line package (default) for an analog access
line.
This document defines a basic set of package names and event names, and additional ones can be registered with the IANA ๐ A package definition SHALL define the name of the package, plus the definition of each event in it. The event definition SHALL include the precise name of the event (the code used in MGCP), a plain text definition of the event and, when it makes sense, the precise definition of the matching signals. For example, that means the exact frequencies of audio signals like dial tones or DTMF tones ๐ฅ
Implementers can also learn by trying out experimental packages ๐งช The names of experimental packages MUST start with the two characters "x-", and the IANA SHALL NOT register package names that start with those characters ๐
โโ๏ธ
Digits (and letters) show up in lots of packages, especially "DTMF" and "MF" ๐ข They're defined by the rules "Digit" and "Letter" in the digit map definition. That definition covers the digits (0 to 9), the asterisk or star (*), the orthotrope, number or pound sign (#), the letters "A", "B", "C" and "D", and the timer indication "T". These can be combined into a "digit string" that represents the keys a user punched on a dial ๐ฑ On top of that, the letter "X" stands for all digits, and the sign "$" can be used in wildcard notations. Since digit strings need to be easy to write, event names have to follow this rule:
An event name that does not denote a digit SHOULD 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 SHOULD NOT contain the special signs "*", "#", "/" or "$".)
A Call Agent may often have to ask a gateway to detect a whole group of events, and there are two conventions for saying that ๐ฆ
- The wildcard convention can detect any event in a package, a given event across many packages, or any event in any package the gateway supports.
- The regular expression Range notation can detect a range of digits.
The star sign (*) can stand in for a package name, and the keyword "all" can stand in for 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 names "*" or "*/all" denote all events supported by the
gate way.
A Call Agent can also ask a gateway to detect a set of digits or letters, either by describing each letter individually or by using the "range" notation from the digit string syntax ๐ For example, the Call Agent can:
Use the letter "x" to denote "any letter or digit."
Use the notation "[0-9#]" to denote the digits 0 to 9 and the pound
sign.
Sometimes Call Agents ask the gateway to generate or detect events on connections instead of on the endpoint itself ๐ For example, a gateway might be asked to provide a ringback tone on a connection. When an event applies to a connection, the connection's name gets added to the event name, using an "at" sign (@) as the delimiter, like this:
G/rt@0A3F58
The wildcard character * (star) can mean "all connections" ๐ซง When that convention is used, the gateway will generate or detect the event on all the connections attached to the endpoint. An example:
R/qa@*
The wildcard character $ means "the current connection" ๐ฏ It SHOULD only be used by the Call Agent, when the event notification request is "encapsulated" inside a command 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:
G/rt@$
The connection ID (or a wildcard replacement) can be used together with the "all packages" and "all events" conventions. For example:
*/all@*
can be used to designate all events on all connections ๐
Events and signals are described in packages. The package description MUST provide, for each event, the following information:
- The description of the event and its purpose. This SHOULD mean the actual signal the client generates (for example, xx ms FSK tone) as well as the resulting result the user observes (for example, MW light on/off) ๐ก
- The detailed characteristics of the event, such as frequencies and amplitude of audio signals, modulations and repetitions ๐ถ
- The typical and maximum duration of the event โฑ๏ธ
Signals are divided into types based on how they behave ๐ง
- On/off (OO): Once applied, these signals last forever until they are turned off. This can happen as the result of an event or a new SignalRequests (more on that later) ๐
- Time-out (TO): Once applied, these signals last until they're turned off (by an event or SignalRequests) or a signal-specific period of time has elapsed. Depending on package specifications, a signal that times out may generate an "operation complete" event โฐ
- Brief (BR): These signals are so short that they stop on their own. If an event occurs, the signal will not stop. However, if a new SignalRequests is applied, the signal will stop. (Note: this point SHOULD be debated. One could make a case that events such as strings of DTMF digits should in fact be allowed to complete. ๐ค)
TO signals are normally used to alert the endpoint's users and tell them they're expected to do something specific, like hang up the phone (ringing) ๐ Transmission of these signals SHOULD typically be interrupted as soon as the first of the requested events has been produced ๐
Package descriptions SHOULD describe the type (OO, TO, BR) of all signals. They SHOULD also describe the maximum duration of the TO signals ๐
2.2. Usage of SDP โจ
okay so the Call Agent uses MGCP to provision the gateways with connection parameters like IP addresses, UDP ports and RTP profiles ๐ธ These descriptions follow the conventions of the Session Description Protocol, which is now an IETF proposed standard and is documented in RFC 2327 ๐
SDP can describe multimedia conferences, but this version limits SDP usage to setting up audio circuits and data access circuits ๐ง The initial session descriptions contain exactly one media description, of type "audio" for audio connections and "nas" for data access ๐ซถ
2.3. Gateway Control Commands โจ
okay so this section is the MGCP command menu ๐ The service has connection handling and endpoint handling commands, and there are nine commands in the protocol ๐
- The Call Agent can issue an EndpointConfiguration command to a gateway, telling the gateway which coding characteristics the "line-side" of the endpoint should expect ๐
- The Call Agent can issue a NotificationRequest command to a gateway, telling it to watch for specific events like hook actions or DTMF tones on a specified endpoint ๐
- The gateway then uses the Notify command to tell the Call Agent when the requested events happen ๐
- 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 of a connection that already exists ๐ฆ
- The Call Agent can use the DeleteConnection command to delete an existing connection. A gateway can also use DeleteConnection to say a connection can't be sustained anymore ๐
- The Call Agent can use the AuditEndpoint and AuditConnection commands to check the status of an "endpoint" and any connections attached to it. Anything beyond these commands, like info about the gateway's status, is generally desirable but out of scope here. That stuff is expected to be handled by the Simple Network Management Protocol (SNMP) and a MIB definition, which is outside this specification ๐ง
- The Gateway can use the RestartInProgress command to tell the Call Agent that the gateway, or a group of endpoints it manages, is being taken out of service or put back in service ๐
These services let a controller (normally the Call Agent) tell a gateway to create connections that terminate in an "endpoint" attached to the gateway, and keep it posted about events happening at that endpoint ๐ An endpoint could be, for example:
- A specific trunk circuit, inside a trunk group that terminates in a gateway ๐
- A specific announcement handled by an announcement server ๐ฃ
Connections get grouped into "calls" โจ Several connections, which may or may not belong to the same call, can terminate in the same endpoint ๐ซถ Each connection has a "mode" parameter, which can be set to "send only" (sendonly), "receive only" (recvonly), "send/receive" (sendrecv), "conference" (confrnce), "data", "inactive" (inactive), "loopback", "continuity test" (conttest), "network loop back" (netwloop) or "network continuity test" (netwtest) ๐
The mode parameter decides what the gateway does with the audio signals it gets on these connections:
- Audio signals arriving in data packets through connections in "receive", "conference" or "send/receive" mode get mixed and sent to the endpoint ๐ถ
- Audio signals coming from the endpoint go out over all the connections whose mode is "send", "conference" or "send/receive." ๐ค
- On top of being sent to the endpoint, audio signals arriving in data packets through connections in "conference" mode get copied to all the other connections whose mode is "conference." ๐ฏโโ๏ธ
The "loopback" and "continuity test" modes are for maintenance and continuity test operations ๐ง There are two flavors of continuity test, one from ITU and one used in the US ๐บ๐ธ In the ITU version it's a loopback test. The originating switch sends a tone (the go tone) on the bearer circuit and expects the terminating switch to loop the circuit back. If the originating switch gets the same tone back (the return tone), the COT passed ๐ If not, the COT failed ๐ญ In the US version the go and return tones are different. The originating switch sends a certain go tone. The terminating switch detects that go tone and puts a different return tone on the backwards direction. When the originating switch detects the return tone, the COT passes โ If the originating switch never detects the return tone, the COT failed โ
If the mode is "loopback", the gateway is expected to send the incoming signal from the endpoint right back into that same endpoint ๐ This is usually used for testing trunk circuit continuity under the ITU specifications ๐งช
If the mode is "continuity test", the gateway is told that the other end of the circuit started a continuity test procedure under the GR specification ๐ The gateway then puts the circuit into the transponder mode needed for dual-tone continuity tests ๐ต
If the mode is "network loopback", the audio signals received from the connection get echoed back on that same connection ๐ฃ๏ธ
If the mode is "network continuity test", the gateway processes the packets it receives from the connection according to the transponder mode needed for dual-tone continuity tests, and sends the processed signal back on the connection ๐
2.3.1. EndpointConfiguration
okay the EndpointConfiguration commands are how you tell an endpoint what encoding the incoming signals are using ๐ง For example, in certain international telephony setups, some calls carry mu-law encoded audio while others use A-law ๐ The Call Agent uses the EndpointConfiguration command to pass this info to the gateway. The config can change call by call, but it can also be used when there are no connections at all ๐
ReturnCode
<-- EndpointConfiguration( EndpointId,
BearerInformation)
EndpointId is the name of the endpoint in the gateway where EndpointConfiguration runs, as defined in section 2.1.1 ๐ท๏ธ The "any of" wildcard convention SHALL NOT be used ๐ซ If the "all of" wildcard convention is used, the command applies to all the endpoints whose names match the wildcard ๐
BearerInformation is a parameter that defines the coding of the data received from the line side ๐๏ธ This info is encoded as a list of sub-parameters. The only sub-parameter defined in this version of the specification is the encoding method, which can be set to "A-law" and "mu-law" ๐ซง
ReturnCode is a parameter the gateway sends back. It shows the outcome of the command and is made up of an integer, optionally followed by commentary ๐ฌ
2.3.2. NotificationRequest
the NotificationRequest commands ask the gateway to send notifications when specified events happen in an endpoint ๐ For example, you can ask to be notified when a gateway detects that an endpoint is receiving tones associated with fax communication ๐ The entity receiving that notification might decide to use a different encoding method on the connections bound to this endpoint ๐ฆ
ReturnCode
<-- NotificationRequest( EndpointId,
[NotifiedEntity,]
[RequestedEvents,]
RequestIdentifier,
[DigitMap,]
[SignalRequests,]
[QuarantineHandling,]
[DetectEvents,]
[encapsulated EndpointConfiguration])
EndpointId is the name of the endpoint in the gateway where NotificationRequest runs, as defined in section 2.1.1 ๐ท๏ธ
NotifiedEntity is an optional parameter that says where the notifications should go. When it's absent, the notifications SHOULD be sent to the originator of the NotificationRequest ๐ฎ
RequestIdentifier is used to match this request up with the notifications it triggers ๐
RequestedEvents is a list of events the gateway is asked to detect and report. These include things like fax tones, continuity tones, or on-hook transitions ๐ Each event has an associated action, which can be:
- Notify the event right away, 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 ๐
Some actions can be combined, and here's how:
- The "swap audio" action can be combined with "Notify", "Accumulate" and "Ignore." ๐
- The "keep signal active" action can be combined with "Notify", "Accumulate", "Accumulate according to Digit Map", "Ignore" and "Embedded Notification Request." ๐ก
- The "Embedded Notification Request" can be combined with "Accumulate" and with "Keep signals active." It can also be combined with Notify, if the gateway is allowed to issue several Notify commands in response to a single Notification request. ๐ช
Besides the requestedEvents parameter in the command, some MGCP profiles have introduced the idea of "persistent events" โจ Under those profiles, the persistent event list is configured in the endpoint, through means outside the scope of MGCP. The basic MGCP spec doesn't define any persistent events ๐คทโโ๏ธ
If a persistent event isn't in the RequestedEvents list and it happens anyway, it still gets detected and processed like every other event, as if it had been requested with a Notify action ๐ So informally, persistent events act like they're always implicitly in the RequestedEvents list with a Notify action, although no glare detection and so on will happen ๐ซ
Non-persistent events are the ones explicitly in the RequestedEvents list. The (possibly empty) list of requested events completely replaces the previous list ๐ Besides the persistent events, the endpoint only detects the events in the requested events list ๐ฏ If a persistent event shows up in the RequestedEvents list, its action replaces the default action for the life of that RequestedEvents list, and then the default action comes back ๐ For example, if "Ignore off-hook" was specified, and then a new request came in with no off-hook instructions, the default "Notify off-hook" operation would be restored ๐ด
A given event MUST NOT appear more than once in a RequestedEvents ๐ซ
The gateway detects the union of the persistent events and the requested events. If an event is in neither list, it gets ignored ๐
The Swap Audio action is for when a gateway handles more than one active connection on an endpoint ๐ That happens with three-way calling, call waiting, and maybe other feature scenarios ๐ฑ To avoid a round-trip to the Call Agent just to change which connection is attached to the audio functions of the endpoint, the NotificationRequest can map an event (usually hook flash, but it could be some other event) to a local swap audio function. That function picks the "next" connection in round robin fashion ๐ If there's only one connection, the action is effectively a no-op ๐
So if you want signals to kick in when an event happens, the "Embedded NotificationRequest" action is your friend ๐ฆ. The embedded one can bring its own fresh list of RequestedEvents, SignalRequests, and even a new digit map ๐ง. It works like a brand-new NotificationRequest just showed up, with the same NotifiedEntity and RequestIdentifier ๐ . When it gets activated, the "current dial string" gets cleared ๐งน, but the list of observed events and the quarantine buffer stay exactly as they were.
MGCP implementations shall be able to support at least one level of embedding. An embedded NotificationRequest that respects this limitation shall not contain another Embedded NotificationRequest ๐ซถ.
DigitMap is an optional parameter that lets the Call Agent provision the gateways with a digit map, which tells them how to pile up digits ๐. 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 RequestedEvent parameters contain a request to "accumulate according to the digit map." โจ The collected digits add up to a digit string. That string gets reset to a null string as soon as the NotificationRequest is received, so a later notification only returns the digits collected after this request ๐. Digits accumulated according to the digit map are reported like any other accumulated event, in the order they happen. So it's totally possible for other events to be sneaking in between the digits ๐.
SignalRequests is a parameter with the set of signals the gateway is asked to apply to the endpoint, like ringing or continuity tones ๐. Signals are identified by their name, which is an event name, and they can be qualified by parameters.
The action triggered by the SignalRequests is synchronized with the events collected in the RequestedEvents parameter. For example, if the NotificationRequest asks for "ringing" and the event request looks for an "off-hook" event, the ringing shall stop as soon as the gateway detects an off-hook event ๐. The formal rule 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 with the specified event ๐.
The specific actions requested through these SignalRequests, like how long and how often a DTMF digit lasts, are totally outside the scope of MGCP ๐. That definition may vary from location to location, and therefore from gateway to gateway.
RequestedEvents and SignalRequests refer to the same event definitions ๐ฏ. In one case the gateway is asked to detect the event, and in the other it is asked to generate it. Which specific events and signals an endpoint can detect or perform depends on the list of event packages that endpoint supports ๐. Each package specifies a list of events and actions that can be detected or performed. A gateway asked to detect or perform an event from a package the specified endpoint doesn't support shall return an error ๐ซ. When the event name isn't qualified by a package name, the default package name for the endpoint is assumed. If the event name isn't registered in that default package, the gateway shall return an error ๐.
The Call Agent can send a NotificationRequest with an empty requested signal list. For example, it'll do that when tone generation should stop ๐คซ.
The optional QuarantineHandling parameter handles "quarantine" events, which are events the gateway detected before this NotificationRequest arrived but hasn't notified the Call Agent about yet ๐ฆ. The parameter gives you a set of handling options:
- 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 exactly one.)
When the parameter is absent, the default value is assumed ๐ธ.
Quick note, bestie: the quarantine-handling parameter also governs events that were detected but not yet notified when the command came in ๐.
DetectEvents is an optional parameter that lists the events the gateway is asked to detect during the quarantine period ๐. When it's absent, the events that should be detected during quarantine are the ones in the last received DetectEvents list. On top of that, the gateway should also detect the events in the request list, including the ones whose "ignore" action is specified ๐.
Some events and signals, like in-line ringback or the quality alert, get performed or detected on connections ending at the endpoint rather than on the endpoint itself ๐งต. The structure of the event names lets the Call Agent say which connection (or connections) these should happen on ๐ฏ.
The command can carry an encapsulated EndpointConfiguration command that applies to the same endpoint ๐. When it's there, the EndpointConfiguration parameters get tucked in after the normal NotificationRequest parameters, except for the EndpointId, which doesn't get copied over ๐ โโ๏ธ.
The encapsulated EndpointConfiguration shares its fate with the NotificationRequest. If the NotificationRequest is rejected, the EndpointConfiguration isn't executed either ๐ญ.
ReturnCode is a parameter the gateway sends back ๐. It tells you the outcome of the command and consists of an integer number, optionally followed by commentary.
Notifications
Notifications go out through the Notify command, and the gateway sends them when the observed events happen ๐.
ReturnCode
<-- Notify( EndpointId,
[NotifiedEntity,]
RequestIdentifier,
ObservedEvents)
EndpointId is the name of the endpoint in the gateway that's issuing the Notify command, as defined in section 2.1.1 ๐ท๏ธ. The identifier should be a fully qualified endpoint identifier, including the domain name of the gateway. The local part of the name shall not use the wildcard convention ๐ซ.
NotifiedEntity is an optional parameter that says who the notifications get sent to ๐ฌ. It's equal to the last received value of the NotifiedEntity parameter. The parameter is absent if there was no such parameter in the triggering request. The notification goes to the "current notified entity" or, if no such entity was ever specified, to the address the request came from.
RequestIdentifier repeats the RequestIdentifier of the NotificationRequest that triggered this notification ๐ชช. It's how you match this notification up with the request that set it off.
ObservedEvents is a list of events the gateway detected ๐๏ธ. A single notification can report a list of events, reported in the order they were detected. The list may only contain events that were requested in the RequestedEvents parameter of the triggering NotificationRequest. It'll include the events that were accumulated (but not notified), or treated according to the digit map (but with no match yet), plus the final event that triggered the detection or gave a final match in the digit map ๐.
ReturnCode is a parameter the call agent sends back. It tells you the outcome of the command and consists of an integer number, optionally followed by commentary ๐ .
2.3.3. CreateConnection โจ
This command is used to create a connection between two endpoints ๐.
ReturnCode,
ConnectionId,
[SpecificEndPointId,]
[LocalConnectionDescriptor,]
[SecondEndPointId,]
[SecondConnectionId]
<--- CreateConnection(CallId,
EndpointId,
[NotifiedEntity,]
[LocalConnectionOptions,]
Mode,
[{RemoteConnectionDescriptor |
SecondEndpointId}, ]
[Encapsulated NotificationRequest,]
[Encapsulated EndpointConfiguration])
A connection is defined by its endpoints ๐งฉ. The input parameters in CreateConnection give the gateway everything it needs to build its own "view" of a connection ๐.
CallId is a globally unique parameter that identifies the call (or session) this connection belongs to ๐. Connections in the same call share the same call-id. The call-id can be used to identify calls for reporting and accounting purposes ๐. It doesn't affect how the gateway handles connections, though.
EndpointId is the identifier for the connection endpoint in the gateway where CreateConnection runs ๐. The EndpointId can be fully specified by assigning a value to the EndpointId parameter in the function call, or it can be under-specified using the "anyone" wildcard convention ๐. If the endpoint is under-specified, the gateway assigns the endpoint identifier, and its complete value comes back in the SpecificEndPointId parameter of the response.
NotifiedEntity is an optional parameter that says where the Notify or DeleteConnection commands should be sent ๐ฎ. If it's absent, those commands go to the last received Notified Entity, or to the originator of the CreateConnection command if no Notified Entity was ever received for the endpoint.
LocalConnectionOptions is a parameter the Call Agent uses to direct how the gateway handles the connection ๐๏ธ. The fields inside LocalConnectionOptions are:
- Encoding Method,
- Packetization period,
- Bandwidth,
- Type of Service,
- Usage of echo cancellation,
- Usage of silence suppression or voice activity detection,
- Usage of signal level adaptation and noise level reduction, or "gain control."
- Usage of reservation service,
- Usage of RTP security,
- Type of network used to carry the connection.
This set of fields can be completed by vendor-specific optional or mandatory extensions ๐ง. The encoding of the first three fields, when they're present, will be compatible with SDP and the RTP profiles:
- The encoding method shall be specified by using one or several valid encoding names, as defined in the RTP AV Profile or registered with the IANA ๐.
- The packetization period is encoded either as the length of time in milliseconds represented by the media in a packet, as specified in the "ptime" parameter of SDP, or as a range value, specifying both the minimum and maximum acceptable packetization periods โฑ๏ธ.
- The bandwidth is encoded either as a single value or as a range, expressed as an integer number of kilobits per second ๐ถ.
For each of the first three fields, the Call Agent has three options ๐:
- It may state exactly one value, which the gateway will then use for the connection,
okay so the bandwidth bit gets a little choosy ๐
the LocalConnectionOptions can go a few ways:
- it may give a loose spec, like a list of allowed encoding methods or a range of packetization periods ๐
- it may just give a bandwidth number and leave the encoding method and packetization period up to the gateway ๐ฆ
bestie, the bandwidth spec shall not contradict the encoding methods and packetization period ๐ โโ๏ธ and if an encoding method is specified, the gateway is authorized to use it, even if that ends up eating more bandwidth than you asked for ๐ญ that's giving "the rules are the rules" energy fr
the LocalConnectionOptions parameter may be absent for a data call ๐ธ
the Type of Service tells us which class of service the connection gets ๐ when the connection goes over an IP network, the parameter encodes the 8-bit type of service value of the IP header ๐ง if Type of Service isn't specified, the gateway shall use a default or configured value ๐
now the reservation vibes โจ gateways can be told to make a reservation (like with RSVP) on a connection ๐ when that happens, the call agent specifies the reservation profile, which is either controlled load or guaranteed service ๐ no reservation is indicated by asking for best effort, which is the default value ๐ when a reservation has been asked for, the gateway will:
- start emitting RSVP
PATHmessages if the connection is insend-only,send-receive,conference,network loop backornetwork continuity testmode (if a remote connection descriptor has been received) ๐ซถ - start emitting RSVP
RESVmessages as soon as it receivesPATHmessages if the connection is inreceive-only,send-receive,conference,network loop backornetwork continuity testmode ๐ฅ
the RSVP filters get deduced from the characteristics of the connection ๐ฆ and the RSVP resource profiles get deduced from the connection's bandwidth and packetization period ๐
echo cancellation is on by default for telephony gateways ๐ง but some calls need it off, so the parameter has two values: on (when echo cancellation is requested) and off (when it's turned off) ๐
telephony gateways may do gain control to adapt the signal level ๐ถ but for things like modem calls, you wanna turn that off ๐
โโ๏ธ the gain control parameter can be automatic or an explicit number of decibels of gain ๐ซ the default is no gain control, which is the same as asking for 0 decibels ๐ท
telephony gateways may also do voice activity detection and skip sending packets during silence ๐คซ but again, modem calls need it off ๐ญ the silence suppression parameter has two values, on (when detection is requested) and off (when it's turned off), and the default is off ๐ซง
the call agent can ask the gateway to encrypt the audio packets ๐ it does that by providing a key specification, as specified in RFC 2327 ๐ by default, encryption is not used โจ
the call agent may tell the gateway to prepare the connection on a specific type of network ๐ the type of network is encoded like the connection-field parameter of the SDP standard ๐ the possible values are IN (Internet), ATM and LOCAL ๐ฆ this parameter is optional, and if it's absent, the gateway type decides the network ๐ซถ
now the RemoteConnectionDescriptor ๐ it's the connection descriptor for the remote side, on the other side of the IP network ๐
it has the same fields as the LocalConnectionDescriptor, meaning the fields that describe a session per the SDP standard ๐ this parameter may have a null value when the remote end's info isn't known yet ๐ that happens because the entity building the connection starts by sending a CreateConnection to one of the two gateways involved ๐ง the first CreateConnection issued has no info about the other side at all โจ that info might show up later through a ModifyConnection call ๐ for data connections (mode=data), this parameter describes the characteristics of the data connection ๐
the SecondEndpointId can be used instead of the RemoteConnectionDescriptor to set up a connection between two endpoints on the same gateway ๐ by definition, that's a local connection ๐ the SecondEndpointId can be fully specified by giving it a value in the function call, or it can be under-specified using the anyone wildcard convention ๐ธ if it's under-specified, the gateway assigns the second endpoint identifier and returns its complete value in the SecondEndPointId parameter of the response ๐ซถ
the Mode parameter says how this side of the connection operates ๐ฌ the modes are send, receive, send/receive, conference, data, inactive, loopback, continuity test, network loop back or network continuity test ๐ฆ the expected handling for each one is in the introduction of the "Gateway Handling Function" section ๐ some endpoints can't support every mode, so if the command asks for a mode the endpoint can't handle, an error shall be returned ๐จ
the gateway returns a ConnectionId, which uniquely identifies the connection within one endpoint ๐ชช it also returns a LocalConnectionDescriptor, a session description with info about addresses and RTP ports, as defined in SDP ๐ถ the LocalConnectionDescriptor is not returned for data connections ๐
โโ๏ธ the SpecificEndPointId is an optional parameter that identifies the responding endpoint โจ it can be used when the EndpointId argument pointed at an "any of" wildcard name ๐ง when a SpecificEndPointId is returned, the call agent should use it as the EndpointId value in successive commands that refer to this call ๐
when a SecondEndpointId is specified, the command really creates two connections ๐ฏ each can be handled separately through ModifyConnection and DeleteConnection commands ๐ซง the response to the creation includes a SecondConnectionId parameter that identifies the second connection ๐
โ ๏ธ okay this part is kinda chaotic bestie: after receiving aCreateConnectionthat did not include aRemoteConnectionDescriptor, the gateway is in an ambiguous situation ๐ฌ because it has exported aLocalConnectionDescriptor, it can potentially receive packets ๐ก but since it hasn't received the other gateway'sRemoteConnectionDescriptor, it doesn't know whether the packets it gets were authorized by the call agent ๐ it has to navigate between two risks, which are clipping some important announcements or listening to insane data ๐ the gateway's behavior is set by the value of theModeparameter:
- if the mode was set to
ReceiveOnly, the gateway should accept the voice signals and transmit them through the endpoint ๐ง - if the mode was set to
Inactive,Loopback,Continuity Test, the gateway should refuse the voice signals ๐ซ - if the mode was set to
Network LoopbackorNetwork Continuity Test, the gateway should perform the expected echo orResponse๐
ngl the mode values SendReceive, Conference, Data and SendOnly don't make sense in this situation ๐
they should be treated as errors, and the command should be rejected (Error code 517) ๐
the command may optionally carry an encapsulated Notification Request command ๐ฌ in that case a RequestIdentifier parameter will be present, and optionally also the RequestedEvents, DigitMap, SignalRequests, QuarantineHandling and DetectEvents parameters ๐ง the encapsulated NotificationRequest runs at the same time as the connection is created โฐ for example, when the call agent wants to start a call to a residential gateway, it should:
- ask the residential gateway to prepare a connection, so the user can start talking the second 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 ๐ฃ
all of that can happen in one CreateConnection command, by also sending the RequestedEvent parameters for the off hook event, and the SignalRequest parameter for the ringing signal ๐
when these parameters are present, the creation and the NotificationRequests should be synchronized ๐ซถ that means both should be accepted, or both refused ๐ in our example, the CreateConnection may be refused if the gateway doesn't have enough resources or can't get adequate resources from the local network access ๐ and the off-hook Notification-Request can be refused in a glare condition, like if the user is already off hook ๐ต so in this example, the phone should not ring if the connection can't be established, and the connection should not be established if the user is already off hook ๐
the NotifiedEntity parameter, if present, applies to both the CreateConnection and the NotificationRequest command ๐ฎ it defines the new "notified entity" for the endpoint ๐ฆ
the command may carry an encapsulated EndpointConfiguration command that applies to the same endpoint ๐ท when it's present, the parameters of the EndpointConfiguration command get inserted after the normal parameters of the CreateConnection, except for the EndpointId, which isn't replicated ๐งฉ the EndpointConfiguration command may be encapsulated together with an encapsulated NotificationRequest command ๐ซง
the encapsulated EndpointConfiguration command shares the fate of the CreateConnection command ๐ค if the CreateConnection is rejected, the EndpointConfiguration is not executed ๐
finally, ReturnCode is a parameter the gateway returns ๐ it shows the outcome of the command and is made of an integer, optionally followed by commentary ๐
2.3.4. ModifyConnection โจ
okay so ModifyConnection is the command you use to tweak a gateway's "view" of a connection ๐ and that view has BOTH the local connection descriptors AND the remote connection descriptor ๐ฆ
ReturnCode,
[LocalConnectionDescriptor]
<--- ModifyConnection(CallId,
EndpointId,
ConnectionId,
[NotifiedEntity,]
[LocalConnectionOptions,]
[Mode,]
[RemoteConnectionDescriptor,]
[Encapsulated NotificationRequest,]
[Encapsulated EndpointConfiguration])
the params are the same ones you'd use in CreateConnection ๐ plus one extra: a ConnectionId that picks out the connection inside the endpoint ๐ง the CreateConnection function hands that ConnectionId back to you as part of the local connection descriptor, and it uniquely identifies the connection within the context of the endpoint, so it's basically the connection's main character energy โญ
the EndpointId SHOULD be a fully qualified endpoint identifier ๐ธ and the local name SHALL NOT use the wildcard convention ๐ no wildcards here, periodt
ModifyConnection can glow up a connection in a few ways ๐
- you can tell the gateway about the other end of the connection, using the RemoteConnectionDescriptor ๐ซถ
- you can turn the connection on or off by changing the Mode parameter ๐ฅ this can happen at any time during the connection, with arbitrary parameter values, so it's super flexible ๐
- you can change how the connection sends stuff, like switching to a different coding scheme, changing the packetization period, or messing with echo cancellation handling ๐
okay now the activation rules, bestie, pay attention ๐ connections can only be activated if the RemoteConnectionDescriptor has already been given to the gateway ๐ the receive only mode is the exception though, and it CAN be activated without that descriptor ๐ฆ
the command only sends back a LocalConnectionDescriptor if the local connection parameters, like RTP ports, got modified โจ (ngl, using this feature is actually still for further study ๐ฅบ)
the command MAY optionally include an encapsulated NotificationRequest command ๐ if it does, you'll have a RequestIdentifier parameter in there too, and optionally the RequestedEvents, DigitMap, SignalRequests, QuarantineHandling and DetectEvents parameters ๐ the encapsulated NotificationRequest runs at the very same time as the connection modification, so they're a power couple ๐ฏโโ๏ธ for example, when a connection gets accepted, the calling gateway SHOULD be told to put the circuit in send-receive mode AND stop providing ringing tones ๐
and yes, you can do all of that in ONE ModifyConnection command ๐คฏ just include the RequestedEvent parameters for the on hook event, plus an empty SignalRequest parameter to stop the ringing tones ๐
when these parameters show up, the modification and the NotificationRequests SHOULD be synchronized ๐ซถ which means they should both get accepted, or both get refused ๐ โโ๏ธ no splitting up the squad ๐ and the NotifiedEntity parameter, if it's there, applies to BOTH the ModifyConnection and the NotificationRequest command ๐
โ ๏ธ the command MAY carry an encapsulated EndpointConfiguration command too ๐จ it applies to the same endpoint, and its parameters get inserted after the normal ModifyConnection parameters, EXCEPT for the EndpointId, because that one doesn't get copied over ๐ the EndpointConfiguration command is allowed to be encapsulated together with an encapsulated NotificationRequest command as well ๐ง
and the encapsulated EndpointConfiguration shares the fate of the ModifyConnection ๐ if ModifyConnection gets rejected, the EndpointConfiguration is NOT executed ๐ญ it goes down with the ship, iykyk ๐ข
last but not least, ReturnCode is the parameter the gateway sends back to tell you how the command went ๐ฌ it's an integer number, optionally followed by some commentary ๐ฌ literally the gateway's little report card ๐โจ
2.3.5. DeleteConnection (from the Call Agent) ๐
Okay bestie, this is the command that ends a connection ๐ and it also collects stats on how the connection went. Iconic closing move ๐
ReturnCode,
Connection-parameters
<-- DeleteConnection(CallId,
EndpointId,
ConnectionId,
[Encapsulated NotificationRequest,]
[Encapsulated EndpointConfiguration])
So the endpoint identifier in this form of DeleteConnection SHALL be fully qualified ๐. No wildcards allowed here, they SHALL NOT be used โจ.
Normally a connection has two ends, so this command has to go to both gateways involved ๐ฆ. Some connections can use IP multicast though, and those can get deleted one at a time ๐ธ.
After the connection is gone, any loopback that was requested for it SHOULD be cancelled ๐งน. And once all the connections to an endpoint are deleted, that endpoint SHOULD be placed in inactive mode ๐ด.
When the gateway replies to DeleteConnection, it sends back a list of parameters that describe how the connection did ๐. Here they are:
- Number of packets sent: The total number of RTP data packets the sender transmitted since it started transmitting on this connection ๐. The count is not reset if the sender changes its synchronization source identifier (SSRC, as defined in RTP), for example as a result of a Modify command. The value is zero if the connection was set in "receive only" mode.
- Number of octets sent: The total number of payload octets (so not counting header or padding) sent in RTP data packets by the sender since it started transmitting on this connection ๐ง. The count is not reset if the sender changes its SSRC identifier, for example as a result of a ModifyConnection command. The value is zero if the connection was set in "receive only" mode.
- Number of packets received: The total number of RTP data packets the sender received since it started receiving on this connection ๐ฅ. The count includes packets received from different SSRC, if the sender used several values. The value is zero if the connection was set in "send only" mode.
- Number of octets received: The total number of payload octets (again, no header or padding) transmitted in RTP data packets by the sender since it started transmitting on this connection ๐ซง. The count includes packets received from different SSRC, if the sender used several values. The value is zero if the connection was set in "send only" mode.
- Number of packets lost: The total number of RTP data packets lost since the beginning of reception ๐ฉ. This is defined as the number of packets expected minus the number of packets actually received, where received packets include any that are late or duplicates. The count includes packets received from different SSRC, if the sender used several values. So packets that arrive late are NOT counted as lost, and the loss can be negative if there are duplicates. The count includes packets received from different SSRC, if the sender used several values. The number of packets expected is defined as the extended last sequence number received (more on that next), minus the initial sequence number received. The count includes packets received from different SSRC, if the sender used several values. The value is zero if the connection was set in "send only" mode. This parameter is omitted if the connection was set in "data" mode.
- Interarrival jitter: An estimate of the statistical variance of the RTP data packet interarrival time, measured in milliseconds and expressed as an unsigned integer ๐. The interarrival jitter J is defined as the mean deviation (smoothed absolute value) of the difference D in packet spacing at the receiver compared to the sender, for a pair of packets. Detailed computation algorithms are in RFC 1889. The count includes packets received from different SSRC, if the sender used several values. The value is zero if the connection was set in "send only" mode. This parameter is omitted if the connection was set in "data" mode.
- Average transmission delay: An estimate of network latency, expressed in milliseconds โฑ๏ธ. It's the average of the difference between the NTP timestamp indicated by the senders of the RTCP messages and the NTP timestamp of the receivers, measured when those messages arrive. The average comes from summing all the estimates and dividing by the number of RTCP messages received. This parameter is omitted if the connection was set in "data" mode. When the gateway's clock is not synchronized by NTP, the latency value can be computed as one half of the round trip delay, as measured through RTCP. When the gateway cannot compute the one way delay or the round trip delay, the parameter conveys a null value.
For the full definitions of these variables, check out RFC 1889 ๐.
When the connection was set up over an ATM network, these parameters can mean something different ๐:
- Number of packets sent: The total number of ATM cells transmitted since the start of transmission on this connection.
- Number of octets sent: The total number of payload octets transmitted in ATM cells.
- Number of packets received: The total number of ATM cells received since the start of reception on this connection.
- Number of octets received: The total number of payload octets received in ATM cells.
- Number of packets lost: SHOULD be determined as the number of cell losses, or set to zero if the adaptation layer does not let the gateway assess losses.
- Interarrival jitter: SHOULD be understood as the interarrival jitter between ATM cells.
- Average transmission delay: The gateway MAY NOT be able to assess this parameter over an ATM network. It could simply report a null value.
When the connection was set up over a LOCAL interconnect, the parameters mean this ๐ :
- Number of packets sent: Not significant.
- Number of octets sent: The total number of payload octets transmitted over the local connection.
- Number of packets received: Not significant.
- Number of octets received: The total number of payload octets received over the connection.
- Number of packets lost: Not significant. A value of zero is assumed.
- Interarrival jitter: Not significant. A value of zero is assumed.
- Average transmission delay: Not significant. A value of zero is assumed.
The standard set of connection parameters can be extended by creating extension parameters ๐งฉ.
This command MAY optionally include an encapsulated Notification Request command ๐. If it does, a RequestIdentifier parameter will be present, and optionnally also the RequestedEvents, DigitMap, SignalRequests, QuarantineHandling and DetectEvents parameters. The encapsulated NotificationRequest runs at the same time as the connection deletion โก. For example, when a user hangs up, the gateway should be told to delete the connection and to start looking for an off hook event ๐.
You can do all of that in one DeleteConnection command, by also sending the RequestedEvent parameters for the off hook event, plus an empty SignalRequest parameter ๐.
When these parameters are present, the DeleteConnection and the NotificationRequests SHOULD be synchronized ๐ซถ. That means both SHOULD be accepted, or both refused.
The command MAY carry an encapsulated EndpointConfiguration command that applies to the same endpoint ๐. When it's present, the EndpointConfiguration parameters get inserted after the normal DeleteConnection parameters, except for the EndpointId, which is not repeated. The EndpointConfiguration command MAY be encapsulated together with an encapsulated NotificationRequest command.
The encapsulated EndpointConfiguration command shares the fate of the DeleteConnection command ๐ค. If DeleteConnection is rejected, EndpointConfiguration does not get executed.
ReturnCode is a parameter the gateway sends back. It shows the outcome of the command and is an integer number, optionally followed by commentary ๐ฌ.
2.3.6. DeleteConnection (from the VoIP gateway) ๐ก
Sometimes a gateway has to clear a connection on its own ๐ฌ. Maybe it lost the resource tied to the connection, or it noticed the endpoint isn't able or willing to send or receive voice anymore. The gateway ends the connection with a variant of DeleteConnection:
ReturnCode,
<-- DeleteConnection( CallId,
EndpointId,
ConnectionId,
Reason-code,
Connection-parameters)
Along with the call, endpoint and connection identifiers, the gateway also sends the call's parameters that would have been returned to the Call Agent in response to a DeleteConnection command ๐งพ. The reason code tells you why the disconnection happened ๐ง.
ReturnCode is a parameter the call agent sends back. It shows the outcome of the command and is an integer number, optionally followed by commentary ๐ .
2.3.7. DeleteConnection (multiple connections, from the Call Agent) ๐งบ
Call Agents can use a variation of DeleteConnection to delete multiple connections at once ๐ซง. It can delete all the connections related to a Call for an endpoint:
ReturnCode,
<-- DeleteConnection( CallId,
EndpointId)
It can also delete all the connections that end at a given endpoint:
ReturnCode,
<-- DeleteConnection( EndpointId)
And here's the galaxy-brain part ๐: Call Agents can use the hierarchical naming structure of endpoints to delete every connection belonging to a group of endpoints. In that case, the "local name" part of the EndpointID uses the "all value" wildcard convention ๐. The "any value" convention SHALL NOT be used. For example, say endpoint names are a combo of a physical interface name and a circuit number, like "X35V3+A4/13". The Call Agent can swap the circuit number for a wildcard character "", giving "X35V3+A4/". This wildcard command tells the gateway to delete all the connections attached to circuits on the physical interface "X35V3+A4" ๐ฏ.
After the connections are deleted, the endpoint SHOULD be placed in inactive mode ๐ด. Any loopback that was requested for those connections SHOULD be cancelled ๐งน.
This command doesn't return any individual statistics or call parameters ๐.
ReturnCode is a parameter the gateway sends back. It shows the outcome of the command and is an integer number, optionally followed by commentary ๐.
2.3.8. Audit Endpoint โจ
Okay bestie, the AuditEndPoint command is how the Call Agent checks in on an endpoint and asks, "wait, are you okay?" ๐ฆ Here's the shape of it:
ReturnCode,
EndPointIdList|{
[RequestedEvents,]
[DigitMap,]
[SignalRequests,]
[RequestIdentifier,]
[NotifiedEntity,]
[ConnectionIdentifiers,]
[DetectEvents,]
[ObservedEvents,]
[EventStates,]
[BearerInformation,]
[RestartReason,]
[RestartDelay,]
[ReasonCode,]
[Capabilities]}
<--- AuditEndPoint(EndpointId,
[RequestedInfo])
The EndpointId is the endpoint being audited ๐ If you want to audit a whole group at once, you can use the "all of" wildcard convention. When you do that, the gateway should send back the list of endpoint identifiers that match the wildcard in the EndPointIdList parameter. It SHALL NOT return any parameter specific to one of these endpoints, so no spilling tea on individual endpoints ๐
When you use a non-wildcard EndpointId, the RequestedInfo parameter (which can be empty) tells the gateway what info you want about that endpoint. You can audit these items with this command:
RequestedEvents, DigitMap, SignalRequests, RequestIdentifier, NotifiedEntity, ConnectionIdentifiers, DetectEvents, ObservedEvents, EventStates, RestartReason, RestartDelay, ReasonCode, and Capabilities.
The response then gives you the details for each item you asked about:
RequestedEvents: the current value of RequestedEvents the endpoint is using, including the action linked to each event. Persistent events are included in the list ๐DigitMap: the digit map the endpoint is currently using ๐งSignalRequests: a list of the Time-Out signals that are currently active, the On/Off signals that are currently "on" for the endpoint (with or without a parameter), and any pending Brief signals. Time-Out signals that have already timed out, and Brief signals that are currently playing, are NOT included, so they're not invited to the party ๐RequestIdentifier: the RequestIdentifier for the last Notification Request received by this endpoint. This includes a NotificationRequest that's been wrapped inside Connection handling primitives. If no notification request has been received, the value zero is returned ๐ขQuarantineHandling: the QuarantineHandling for the last NotificationRequest received by this endpoint ๐ก๏ธDetectEvents: the list of events that are currently detected in quarantine mode ๐NotifiedEntity: the current notified entity for the endpoint ๐ฃConnectionIdentifiers: the list of ConnectionIdentifiers for all connections that currently exist for the specified endpoint ๐ObservedEvents: the current list of observed events for the endpoint ๐๏ธEventStates: for events that have auditable states attached, the event that matches the state the endpoint is in. For example,off-hookif the endpoint is off-hook. The definition of each event will say whether it has an auditable state associated with it ๐BearerInformation: the value of the last received BearerInformation parameter for this endpoint ๐RestartReason: the value of the restart reason parameter in the last RestartInProgress command the endpoint issued."restart"means a fully functional endpoint ๐ชRestartDelay: the value of the restart delay parameter if the endpoint issued a RestartInProgress command at the time of the response. Otherwise it's zero, if the command wouldn't include this parameter โณReasonCode: the value of the Reason-Code parameter in the last RestartInProgress or DeleteConnection command the gateway issued for the endpoint. If the endpoint's state is nominal, you get the special value000๐Capabilities: the capabilities for the endpoint, similar to the LocalConnectionOptions parameter, including event packages and connection modes. Sometimes certain parameters, like silence suppression, only work with certain codecs. So the gateway returns several capability sets, with the following items in each:- Compression Algorithm: a list of supported codecs. The rest of the parameters apply to all codecs in this list ๐ถ
- Packetization Period: a single value or a range may be specified ๐ฆ
- Bandwidth: a single value or a range corresponding to the range for packetization periods may be specified (assuming no silence suppression) ๐ถ
- Echo Cancellation: whether echo cancellation is supported or not ๐
- Silence Suppression: whether silence suppression is supported or not ๐คซ
- Type of Service: whether type of service is supported or not ๐ฆ
- Event Packages: a list of supported event packages. The first event package in the list is the default package ๐ฅ
- Modes: a list of supported connection modes ๐๏ธ
After that, the Call Agent may decide to use the AuditConnection command to get more info about the connections ๐
If you didn't ask for any info and the EndpointId refers to a valid endpoint, the gateway just sends back a positive acknowledgement. Simple, iconic โจ
If no NotifiedEntity has been specified in the last NotificationRequest, the notified entity defaults to the source address of the last NotificationRequest command received for this connection ๐
ReturnCode is a parameter the gateway sends back. It shows the outcome of the command and is made up of an integer, optionally followed by some commentary. Read the room, bestie ๐
2.3.9. Audit Connection ๐ธ
The AuditConnection command is how the Call Agent pulls up the parameters attached to a connection:
ReturnCode,
[CallId,]
[NotifiedEntity,]
[LocalConnectionOptions,]
[Mode,]
[RemoteConnectionDescriptor,]
[LocalConnectionDescriptor,]
[ConnectionParameters]
<--- AuditConnection(EndpointId,
ConnectionId,
RequestedInfo)
The EndpointId parameter says which endpoint handles the connection. The wildcard conventions SHALL NOT be used here, so no shortcuts ๐ โโ๏ธ
The ConnectionId parameter is the identifier of the connection being audited, within the context of the specified endpoint ๐
The RequestedInfo parameter (which can be empty) describes the info you want for the ConnectionId within the EndpointId. You can audit these connection items with this command:
CallId, NotifiedEntity, LocalConnectionOptions, Mode, RemoteConnectionDescriptor, LocalConnectionDescriptor, ConnectionParameters
The AuditConnectionResponse then gives you the details for each item you asked about:
CallId: the CallId for the call the connection belongs to ๐ฑNotifiedEntity: the current notified entity for the connection ๐ฃLocalConnectionOptions: the LocalConnectionOptions that were supplied for the connection ๐๏ธMode: the current mode of the connection ๐RemoteConnectionDescriptor: the RemoteConnectionDescriptor that was supplied to the gateway for the connection ๐ฐ๏ธLocalConnectionDescriptor: the LocalConnectionDescriptor the gateway supplied for the connection ๐ConnectionParameters: the current value of the connection parameters for the connection ๐งพ
If you didn't ask for any info and the EndpointId is valid, the gateway just checks that the connection exists. If it does, you get a positive acknowledgement ๐ฅฐ
If no NotifiedEntity has been specified for the connection, the notified entity defaults to the source address of the last connection handling command received for this connection ๐ฌ
ReturnCode is a parameter the gateway sends back. It shows the outcome of the command and is made up of an integer, optionally followed by some commentary ๐
2.3.10. Restart in progress โจ
okay so the RestartInProgress command is how the gateway lets the Call Agent know that an endpoint, or a whole group of endpoints, is being taken in or out of service ๐
ReturnCode,
[NotifiedEntity]
<------- RestartInProgress ( EndPointId,
RestartMethod,
[RestartDelay,]
[Reason-code])
The EndPointId tells you which endpoint is getting taken in or out of service ๐ You can use the "all of" wildcard to hit a whole group at once, like every endpoint on a given interface, or even every endpoint on a given gateway ๐ธ The "any of" wildcard shall not be used, so don't even try it ๐ โโ๏ธ
The RestartMethod says what kind of restart is happening, and there are five flavors ๐
- A
gracefulrestart means the endpoints will be taken out of service once the delay is up. Existing connections aren't affected yet, but the Call Agent should refrain from setting up new ones and should try to gently tear down the ones that already exist ๐ฆ - A
forcedrestart means the endpoints are yanked out of service right away ๐ญ Any established connections are lost. - A
restartmeans service is coming back on the endpoints after therestart delay. There are no connections currently established on them ๐ - A
disconnectedrestart means the endpoint lost its connection and is now trying to get it back ๐ Therestart delaytells you how many seconds it has been disconnected. Established connections are not affected. - A
cancel-gracefulrestart means the gateway is canceling agracefulrestart it sent earlier ๐ โโ๏ธ
The optional restart delay is a number of seconds. If it's missing, the delay is treated as null. For a graceful restart, a null delay means the Call Agent should just wait for the existing connections to finish naturally and not set up new ones โณ The restart delay is always treated as null for a forced restart.
A null restart delay on a restart means service has already come back. This usually happens after the gateway starts up or reboots ๐ง
The optional reason code tells you why the restart is happening ๐
Now the rules, which are super important so pay attention bestie ๐
Gateways SHOULD send a graceful or forced RestartInProgress message to the Call Agent as a courtesy when they're being taken out of service, like when they're shut down or pulled out of service by a network management system. The Call Agent can't rely on always getting these, though ๐ฌ
Gateways MUST send a restart RestartInProgress message with a null delay to their Call Agent once they're back in service, following the restart procedure in Section 4.3.4. The Call Agent can rely on getting this one ๐ซถ
Also, gateways MUST send a disconnected RestartInProgress message to their current "notified entity" following the disconnected procedure in Section 4.3.5 ๐
The restart delay parameter MUST NOT be used with the forced restart method. Never ever ๐
The RestartInProgress message goes to the current notified entity for the EndpointId in question. A default Call Agent, aka the notified entity, is expected to be provisioned for each endpoint, so after a reboot the default Call Agent is the notified entity for each one ๐ Gateways should take full advantage of wild-carding so they don't send a flood of RestartInProgress messages when lots of endpoints restart together and are managed by the same Call Agent ๐
ReturnCode is what the gateway gets back to say how the command went. It's an integer, optionally followed by some commentary ๐
The Call Agent can also send back a NotifiedEntity with its response ๐
- If the response is a success (return code 200, transaction executed), the restart procedure is complete, and the NotifiedEntity that comes back is the new "notified entity" for the endpoint(s) ๐
- If the Call Agent's response is an error, the restart procedure is not done yet, so it has to be started again ๐ If a NotifiedEntity came back, it's the new "notified entity" for the endpoint(s), and you have to use it when retrying the restart procedure.
2.4. Return codes and error codes ๐
All MGCP commands get acknowledged ๐ซถ The acknowledgment carries a return code that tells you how the command went. It's an integer, and there are four ranges:
- values between 100 and 199 mean a provisional response,
- values between 200 and 299 mean a successful completion,
- values between 400 and 499 mean a transient error,
- values between 500 and 599 mean a permanent error.
Here's the list of codes that have already been defined. Screenshot this one ๐ธ
100 The transaction is currently being executed. An actual
completion message will follow on later.
200 The requested transaction was executed normally.
250 The connection was deleted.
400 The transaction could not be executed, due to a transient error.
401 The phone is already off hook
402 The phone is already on hook
403 The transaction could not be executed, because the endpoint does
not have sufficient resources at this time
404 Insufficient bandwidth at this time
500 The transaction could not be executed, because the endpoint is
unknown.
01 The transaction could not be executed, because the endpoint is
not ready.
502 The transaction could not be executed, because the endpoint does
not have sufficient resources
510 The transaction could not be executed, because a protocol error
was detected.
11 The transaction could not be executed, because the command
contained an unrecognized extension.
512 The transaction could not be executed, because the gateway is
not equipped to detect one of the requested events.
513 The transaction could not be executed, because the gateway is
not equipped to generate one of the requested signals.
514 The transaction could not be executed, because the gateway
cannot send the specified announcement.
515 The transaction refers to an incorrect connection-id (may have
been already deleted)
516 The transaction refers to an unknown call-id.
517 Unsupported or invalid mode.
518 Unsupported or unknown package.
519 Endpoint does not have a digit map.
520 The transaction could not be executed, because the endpoint is
"restarting".
521 Endpoint redirected to another Call Agent.
522 No such event or signal.
523 Unknown action or illegal combination of actions
524 Internal inconsistency in LocalConnectionOptions
525 Unknown extension in LocalConnectionOptions
526 Insufficient bandwidth
527 Missing RemoteConnectionDescriptor
528 Incompatible protocol version
529 Internal hardware failure
530 CAS signaling protocol error.
531 failure of a grouping of trunks (e.g. facility failure).
2.5. Reason Codes ๐
Reason codes are how the gateway explains to the Call Agent why it's deleting a connection ๐ฃ๏ธ They can also show up in a RestartInProgress command to say why the restart is happening. It's an integer, and these values have been defined:
000 Endpoint state is nominal. (This code is used only in response
to audit requests.)
900 Endpoint malfunctioning
901 Endpoint taken out of service
902 Loss of lower layer connectivity (e.g., downstream sync)
3. Media Gateway Control Protocol ๐ฆ
okay so MGCP runs the media gateway control interface as a bunch of transactions ๐ Each transaction is a command plus a mandatory response. There are eight types of command ๐
- CreateConnection
- ModifyConnection
- DeleteConnection
- NotificationRequest
- Notify
- AuditEndpoint
- AuditConnection
- RestartInProgress
The first four are sent by the Call Agent to a gateway. The Notify command goes the other way, from the gateway to the Call Agent. The gateway may also send a DeleteConnection, as defined in 2.3.6 ๐ The Call Agent may send either of the Audit commands to the gateway. The gateway may send a RestartInProgress command to the Call Agent. ๐ง
3.1. General description โจ
All commands are made of a Command header, optionally followed by a session description ๐
All responses are made of a Response header, optionally followed by a session description ๐จ
Headers and session descriptions are text lines, separated by a carriage return and line feed (or optionally just a single line-feed character) ๐ The headers get separated from the session description by an empty line.
MGCP uses a transaction identifier to match up commands and responses ๐ซถ It's encoded as part of the command header and repeated as part of the response header (see sections 3.2.1, 3.2.1.2 and 3.3).
3.2. Command Header ๐
The command header is made of:
- A command line, which names the requested action or verb, the transaction identifier, the endpoint the action is aimed at, and the MGCP protocol version,
- A set of parameter lines, each one a parameter name followed by a parameter value.
Unless otherwise noted or dictated by other referenced standards, every component in the command header is case insensitive ๐ That goes for verbs, parameters, and values too. All comparisons MUST treat upper and lower case, and any combination of them, as equal. No exceptions, periodt ๐
3.2.1. Command line ๐
The command line is made of:
- The name of the requested verb,
- The identification of the transaction,
- The name of the endpoint that should execute the command (in notifications or restarts, the name of the endpoint that is issuing the command),
- The protocol version.
These four items are strings of printable ASCII characters, separated by white spaces, meaning the ASCII space (0x20) or tabulation (0x09) characters ๐ It is recommended to use exactly one ASCII space separator. Cute and clean โจ
3.2.1.1. Coding of the requested verb
okay so the verbs get encoded as four letter codes ๐ they can be upper or lower case, ASCII, and comparisons should be case insensitive, bestie ๐ here's the whole list:
______________________________
| Verb | Code|
|______________________|______|
| EndpointConfiguration| EPCF|
| CreateConnection | CRCX|
| ModifyConnection | MDCX|
| DeleteConnection | DLCX|
| NotificationRequest | RQNT|
| Notify | NTFY|
| AuditEndpoint | AUEP|
| AuditConnection | AUCX|
| RestartInProgress | RSIP|
|______________________|______|
the transaction identifier is a string of up to 9 decimal digits ๐ข and it sits right after the verb code in the command lines โจ
new verbs can show up in future versions of the protocol ๐ฆ and if people want to experiment, they can use new verbs before those get sanctioned in a published version. experimental verbs should start with the letter X, so something like XPER ๐ slay
3.2.1.2. Transaction Identifiers
MGCP uses a transaction identifier to match commands with their responses ๐ a gateway actually keeps two separate transaction identifier name spaces:
- a transaction identifier name space for sending transactions, and
- a transaction identifier name space for receiving transactions.
ok this part is so important ๐ญ transaction identifiers for commands sent to a given gateway MUST be unique for the maximum lifetime of the transactions across the whole group of Call Agents that control that gateway. so no matter which Call Agent sent the command, the gateway can spot a duplicate just by looking at the transaction identifier ๐ต๏ธโโ๏ธ how the Call Agents coordinate those IDs is outside the scope of this spec though, so that's their problem, not ours ๐
and the reverse is also true ๐ transaction identifiers for all commands sent from a given gateway MUST be unique for the maximum lifetime of the transactions, no matter which Call Agent the command goes to. that means a Call Agent can catch a duplicate from a gateway by checking the combo of the endpoint's domain name and the transaction identifier ๐
the transaction identifier is still a string of up to nine decimal digits, and it still comes right after the verb in the command lines ๐ง
transaction identifiers have values between 1 and 999999999 ๐ and an MGCP entity MUST NOT reuse a transaction identifier more quickly than three minutes after completion of the previous command that used it. no speed-running the ID reuse, periodt ๐
3.2.1.3. Coding of the endpoint identifiers and entity names
endpoint identifiers and entity names are encoded as case insensitive e-mail addresses, as defined in RFC 821 ๐ the domain name tells you which system the endpoint is attached to, and the left side picks out a specific endpoint on that system โจ
here are some examples ๐ฆ
______________________________________________________________________
| hrd4/56@gw23.example.net | Circuit number 56 in |
| | interface "hrd4" of the Gateway 23 |
| | of the "Example" network |
| Call-agent@ca.example.net | Call Agent for the |
| | "example" network |
| Busy-signal@ann12.example.net| The "busy signal" virtual |
| | endpoint in the announcement |
| | server number 12. |
|______________________________|______________________________________|
the name of notified entities uses the same syntax, with the option of adding a port number, like this ๐ธ
Call-agent@ca.example.net:5234
if the port number is left out, the default MGCP port (2427) gets used ๐ซถ
3.2.1.4. Coding of the protocol version
the protocol version is coded as the keyword MGCP, then a white space and the version number ๐ you can optionally add a profile name after that. the version number is a major version (a decimal number), a dot, and a minor version (also a decimal number) ๐ the version described in this document is version 1.0 โจ
the profile name, if there is one, is made of white-space separated strings of visible (printable) characters that run to the end of the line ๐ profile names can be defined for user communities who want to put restrictions or other profiling on MGCP, which is lowkey iconic ๐
in the initial messages, the version gets coded as:
MGCP 1.0
3.2.2. Parameter lines ๐
Okay so parameter lines are super simple once you see them! Each one is a parameter name (usually just a single uppercase letter, lowercase vibes are not it ๐ ), then a colon, a space, and the value. Here's the full menu of parameters that can show up in commands:
_______________________________________________________________________
|Parameter name | Code| Parameter value |
|______________________|______|_______________________________________|
|ResponseAck | K | see description |
|BearerInformation | B | see description |
|CallId | C | Hexadecimal string, at most 32 chars.|
|ConnectionId | I | Hexadecimal string, at most 32 chars.|
|NotifiedEntity | N | An identifier, in RFC 821 format, |
| | | composed of an arbitrary string and |
| | | of the domain name of the requesting |
| | | entity, possibly completed by a port |
| | | number, as in: |
| | | Call-agent@ca.example.net:5234 |
|RequestIdentifier | X | Hexadecimal string, at most 32 chars.|
|LocalConnectionOptions| L | See description |
|Connection Mode | M | See description |
|RequestedEvents | R | See description |
|SignalRequests | S | See description |
|DigitMap | D | A text encoding of a digit map |
|ObservedEvents | O | See description |
|ConnectionParameters | P | See description |
|ReasonCode | E | An arbitrary character string |
|SpecificEndpointID | Z | An identifier, in RFC 821 format, |
| | | composed of an arbitrary string, |
| | | followed by an "@" followed by the |
| | | domain name of the gateway to which |
| | | this endpoint is attached. |
|Second Endpoint ID | Z2 | Endpoint Id. |
|SecondConnectionId | I2 | Connection Id. |
|RequestedInfo | F | See description |
|QuarantineHandling | Q | See description |
|DetectEvents | T | See Description |
|RestartMethod | RM | See description |
|RestartDelay | RD | A number of seconds, encoded as |
| | | a decimal number |
|EventStates | ES | See description |
|Capabilities | A | See description |
|______________________|______|_______________________________________|
|RemoteConnection | RC | Session Description |
|Descriptor | | |
|LocalConnection | LC | Session Description |
|Descriptor | | |
|______________________|______|_______________________________________|
Not every parameter shows up in every command, though! ๐ This next table is the matchup chart. The letter M means mandatory, O means optional, and F means forbidden.
___________________________________________________________________
| Parameter name | EP| CR| MD| DL| RQ| NT| AU| AU| RS|
| | CF| CX| CX| CX| NT| FY| EP| CX| IP|
|_____________________|____|____|____|____|____|____|____|____|____|
| ResponseAck | O | O | O | O | O | O | O | O | O |
| BearerInformation | M | O | O | O | O | F | F | F | F |
| CallId | F | M | M | O | F | F | F | F | F |
| ConnectionId | F | F | M | O | F | F | F | M | F |
| RequestIdentifier | F | O+| O+| O+| M | M | F | F | F |
| LocalConnection | F | O | O | F | F | F | F | F | F |
| Options | | | | | | | | | |
| Connection Mode | F | M | M | F | F | F | F | F | F |
| RequestedEvents | F | O | O | O | O*| F | F | F | F |
| SignalRequests | F | O | O | O | O*| F | F | F | F |
| NotifiedEntity | F | O | O | O | O | O | F | F | F |
| ReasonCode | F | F | F | O | F | F | F | F | O |
| ObservedEvents | F | F | F | F | F | M | F | F | F |
| DigitMap | F | O | O | O | O | F | F | F | F |
| Connection | F | F | F | O | F | F | F | F | F |
| parameters | | | | | | | | | |
| Specific Endpoint ID| F | F | F | F | F | F | F | F | F |
| Second Endpoint ID | F | O | F | F | F | F | F | F | F |
| RequestedInfo | F | F | F | F | F | F | M | M | F |
| QuarantineHandling | F | O | O | O | O | F | F | F | F |
| DetectEvents | F | O | O | O | O | F | F | F | F |
| EventStates | F | F | F | F | F | F | F | F | F |
| RestartMethod | F | F | F | F | F | F | F | F | M |
| RestartDelay | F | F | F | F | F | F | F | F | O |
| SecondConnectionID | F | F | F | F | F | F | F | F | F |
| Capabilities | F | F | F | F | F | F | F | F | F |
|_____________________|____|____|____|____|____|____|____|____|____|
| RemoteConnection | F | O | O | F | F | F | F | F | F |
| Descriptor | | | | | | | | | |
| LocalConnection | F | F | F | F | F | F | F | F | F |
| Descriptor | | | | | | | | | |
|_____________________|____|____|____|____|____|____|____|____|____|
Two little notes to keep an eye on ๐. The (+) note: RequestIdentifier is optional in connection creation, modification and deletion commands, but it turns mandatory once the command carries an encapsulated notification request. The (*) note: RequestedEvents and SignalRequests are optional inside the NotificationRequest. If you leave them out, those lists are treated as empty.
Now, if you're experimenting with new parameters (like when you're building a new application of MGCP ๐ง), name them with a prefix of "X-" or "X+", something like this:
X-FlowerOfTheDay: Daisy
Here's the important difference between the two prefixes ๐. Names starting with X+ are critical parameter extensions. If an MGCP entity gets one it doesn't understand, it should refuse to execute the command, and respond with error code 511 (Unrecognized extension). Names starting with X- are non critical parameter extensions. If an entity gets one it doesn't understand, it can safely ignore that parameter. Iconic, honestly ๐ฆ
3.2.2.1. Response Acknowledgement โจ
The response acknowledgement attribute is how you manage the "at-most-once" facility from the "transmission over UDP" section. It's a comma separated list of "confirmed transaction-id ranges".
Each confirmed transaction-id range is either one decimal number (when the range covers exactly one transaction) or two decimal numbers joined by a single hyphen, which give the lower and higher transaction identifiers in the range. Here's an example:
K: 6234-6255, 6257, 19030-19044
3.2.2.2. Local connection options ๐ธ
Local connection options are the operational parameters the Call Agent suggests to the gateway. There are a bunch of them, and they're all optional. When you use several, separate them with a comma. Here's the lineup:
- The packetization period, in milliseconds. It's the keyword "p", then a colon and a decimal number. If the Call Agent gives a range, it's two decimal numbers separated by a hyphen.
- The preferred compression algorithm. It's the keyword "a", then a colon and a character string. If the Call Agent gives a list, the values are separated by a semicolon.
- The bandwidth, in kilobits per second (that's 1000 bits per second). It's the keyword "b", then a colon and a decimal number. Ranges work the same way as with "p": two decimal numbers separated by a hyphen.
- Echo cancellation. It's the keyword "e", then a colon and either "on" or "off".
- Gain control. It's the keyword "gc", then a colon and a value that's either the keyword "auto" or a decimal number (positive or negative) showing how many decibels of gain.
- Silence suppression. It's the keyword "s", then a colon and either "on" or "off".
- Type of service. It's the keyword "t", then a colon and a value written as two hexadecimal digits.
- Resource reservation. It's the keyword "r", then a colon and one of "g" (guaranteed service), "cl" (controlled load) or "be" (best effort).
- The encryption key. It's the keyword "k", then a colon and a key specification, defined the same way as the "K" parameter of SDP (RFC 2327).
- The type of network. It's the keyword "nt", then a colon and one of "IN", "ATM" or "LOCAL".
Here are some examples of these connection descriptors:
L: p:10, a:PCMU
L: p:10, a:G726-32
L: p:10-20, b:64
L: b:32-64, e:off
This set of attributes can be extended with extension attributes of your own ๐ซถ Each one is an attribute name, followed by a semi-colon and an attribute value. The name should start with the two characters x+ for a mandatory extension, or x- for a non mandatory extension. If a gateway gets a mandatory extension attribute it doesn't recognize, it should reject the command with error code 525 (Unknown extension in LocalConnectionOptions). Scary, but honestly very clear ๐
3.2.2.3. Capabilities ๐
okay bestie, capabilities are how an endpoint tells the Call Agent what it's actually capable of when it gets audited ๐ the encoding is basically the Local Connection Options encoding for everything they have in common ๐ and on top of that, capabilities can also carry a list of supported packages and a list of supported modes โจ
the parameters you'll see are:
- A list of supported codecs. The following parameters apply to all codecs in this list. If some parameters, like silence suppression, only work with certain codecs, the gateway will return several LocalConnectionOptions parameters, one for each set of codecs ๐ฆ
Packetization Period:A range MAY be specified. ๐ฐ๏ธBandwidth:A range corresponding to the range for packetization periods MAY be specified (assuming no silence suppression). If it's absent, the values get deduced from the codec type ๐งฎEcho Cancellation:"on"if echo cancellation is supported for this codec,"off"otherwise. The default is support ๐Silence Suppression:"on"if silence suppression is supported for this codec,"off"otherwise. The default is support ๐คซGain Control:"0"if gain control is not supported. The default is support ๐๏ธType of Service:The value"0"indicates no support for type of service, and all other values indicate support for it. The default is support ๐ฆResource Reservation:This parameter tells you which reservation services are supported, on top of best effort. The value"g"is encoded when the gateway supports both the guaranteed and the controlled load service, and"cl"when only the controlled load service is supported. The default is"best effort."๐๏ธEncryption Key:Encoding any value indicates support for encryption. The default is no support ๐Type of network:The keywordnt, followed by a colon and a semicolon-separated list of supported network types. This parameter is OPTIONAL ๐Event PackagesThe event packages this endpoint supports, encoded as the keywordv, followed by a colon and a character string. If there's a list of values, they get separated by a semicolon. The first value specified will be the default package for that endpoint ๐ฆModesThe modes this endpoint supports, encoded as the keywordm, followed by a colon and a semicolon-separated list of supported connection modes for this endpoint ๐๏ธ
3.2.2.4. Connection parameters ๐
okay so connection parameters are encoded as a string of type and value pairs ๐ the type is either a letter identifier for the parameter or an extension type, and the value is a decimal integer. Types get separated from their value by an = sign, and parameters get separated from each other by a comma ๐ง
here's the table of connection parameter types:
__________________________________________________________________
| Connection parameter| Code| Connection parameter |
| name | | value |
|_____________________|______|____________________________________|
| Packets sent | PS | The number of packets that |
| | | were sent on the connection. |
| Octets sent | OS | The number of octets that |
| | | were sent on the connection. |
| Packets received | PR | The number of packets that |
| | | were received on the connection. |
| Octets received | OR | The number of octets that |
| | | were received on the connection. |
| Packets lost | PL | The number of packets that |
| | | were not received on the |
| | | connection, as deduced from |
| | | gaps in the sequence number. |
| Jitter | JI | The average inter-packet arrival |
| | | jitter, in milliseconds, |
| | | expressed as an integer number. |
| Latency | LA | Average latency, in milliseconds, |
| | | expressed as an integer number. |
|_____________________|______|____________________________________|
extension parameter names are made of the string X- followed by a two-letter extension parameter name โจ and call agents that get unrecognized extensions SHALL silently ignore them ๐
here's an example of connection parameter encoding, it's so pretty:
P: PS=1245, OS=62345, PR=0, OR=0, PL=0, JI=0, LA=48
3.2.2.5. Reason Codes ๐จ
reason codes are three-digit numeric values ๐ข the reason code can optionally be followed by a white space and some commentary, like this:
900 Endpoint malfunctioning
and if you want the full list, it's in Section 2.5 ๐
3.2.2.6. Connection mode ๐
the connection mode describes how the connection operates ๐ธ the possible values are:
________________________________________________________
| Mode | Meaning |
|____________|__________________________________________|
| M: sendonly| The gateway SHOULD only send packets |
| M: recvonly| The gateway SHOULD only receive packets |
| M: sendrecv| The gateway SHOULD send |
| | and receive packets |
| M: confrnce| The gateway SHOULD place |
| | the connection in conference mode |
| M: inactive| The gateway SHOULD neither |
| | send nor receive packets |
| M: loopback| The gateway SHOULD place |
| | the circuit in loopback mode. |
| M: conttest| The gateway SHOULD place |
| | the circuit in test mode. |
| M: netwloop| The gateway SHOULD place |
| | the connection in network loopback mode.|
| M: netwtest| The gateway SHOULD place |
| | the connection in network |
| | continuity test mode. |
| M: data | The gateway SHOULD use the circuit |
| | for network access for data |
| | (e.g., PPP, SLIP, etc.). |
|____________|__________________________________________|
3.2.2.7. Coding of event names ๐ฏ
event names are made up of an OPTIONAL package name, separated by a slash (/) from the name of the actual event ๐ the event name can optionally be followed by an at sign (@) and the identifier of a connection where the event should be observed. Event names get used in the RequestedEvents, SignalRequests and ObservedEvents parameters ๐ฆ
every signal has one of these signal-types: On/Off (OO), Time-out (TO), or Brief (BR). These signal types come from the package definitions and aren't present in the messages ๐ง On/Off signals can be parameterized with a "+" to turn the signal on, or a "-" to turn it off. If an on/off signal isn't parameterized, it gets turned on. Both of these will turn the vmwi signal on:
vmwi(+), vmwi
here are some valid event names, the way they slay ๐
____________________________________________________________
| L/hu | on-hook transition, in the line package |
| F/0 | digit 0 in the MF package |
| fh | Flash-hook, assuming that the line package|
| | is a default package for the end point. |
| G/rt@0A3F58 | Ring back signal on |
| | connection "0A3F58". |
|_____________|_____________________________________________|
and the range and wildcard notation can be used instead of individual names in the RequestedEvents and DetectEvents parameters ๐ the star sign means "all connections", and the dollar sign means the "current" connection. Here are some valid examples of that notation:
__________________________________________________________
| M/[0-9] | Digits 0 to 9 in the MF package |
| fh | Flash-hook, assuming that the line package|
| | is a default package for the end point. |
| [0-9*#A-D]| All digits and letters in the DTMF |
| | packages (default for endpoint). |
| T/$ | All events in the trunk packages. |
| R/qa@* | The quality alert event in all |
| | connections |
| R/rt@$ | Ringback on current connection |
|___________|_____________________________________________|
3.2.2.8. RequestedEvents โจ
okay bestie, the RequestedEvent parameter is basically the list of events someone is asking for ๐ The event codes are explained in the previous section, so go check there if you forget ๐
Every event can be qualified by a requested action, or by a whole list of actions. When actions are given, they're written as keywords inside parentheses, separated by commas. Here are the action codes:
______________________________________
| Action | Code|
|______________________________|______|
| Notify immediately | N |
| Accumulate | A |
| Treat according to digit map | D |
| Swap | S |
| Ignore | I |
| Keep Signal(s) active | K |
| Embedded Notification Request| E |
|______________________________|______|
If you don't specify an action, the default is to notify the event ๐
So ft and ft(N) are totally equivalent. Any events that aren't listed just get ignored ๐
The digit-map action only works for digits, letters and interdigit timers in the MF and DTMF packages, or in other packages that define how digits and timers are encoded ๐ข
The requested list lives on a single line, with event/action groups separated by commas. Here are some examples:
R: hu(N), hf(S,N)
R: hu(N), [0-9#T](D)
Now for the enable action, which is giving it main character energy โจ The embedded notification request parameters are encoded as a list of up to three parameter groups, separated by commas. Each group starts with a one-letter identifier, followed by a list of parameters in parentheses. The first optional group, marked "R", is the enabled value of the RequestedEvents parameter. The second optional group, marked "S", is the enabled value of the SignalRequests parameter. The third optional group, marked "D", is the enabled value of the DigitMap. (Heads up, some existing implementations may encode these three in a different order ๐ซถ)
If RequestedEvents isn't there, the parameter gets set to a null value. Same deal for SignalRequest if it's missing. If DigitMap is absent, the current value should be used ๐ Here are some valid embedded requests:
R: hd(E(R([0-9#T](D),hu(N)),S(dl),D([0-9].[#T])))
R: hd(E(R([0-9#T](D),hu(N)),S(dl)))
3.2.2.9. SignalRequests ๐
The SignalRequests parameter tells you the names of the signals that have been requested. Each signal is identified by a name, just like in the previous section ๐ฆ
Some signals, like announcement or ADSI display, can be qualified with extra parameters. Those are:
- the name and parameters of the announcement,
- the string that should be displayed.
These parameters get encoded as a set of UTF8 character strings, separated by commas and enclosed in parentheses. Like so:
S: adsi("123456 Francois Gerard")
S: ann(no-such-number, 1234567)
When you request several signals at once, their codes are separated by a comma:
S: asdi(123456 Your friend), rg
3.2.2.10. ObservedEvent ๐
The observed event parameter gives you the list of events that have been observed. The event codes are the same ones used in the NotificationRequest ๐ Events that were accumulated according to the digit map may be grouped into a single string. They should be reported as lists of isolated events if other events were detected during the digit accumulation, because that's the only way to keep things clear ๐ง Here are some examples of observed events:
O: L/hu
O: 8295555T
O: 8,2,9,5,5,L/hf,5,5,T
O: L/hf, L/hf, L/hu
3.2.2.11. RequestedInfo ๐
The RequestedInfo parameter holds a comma separated list of parameter codes, as defined in the "Parameter lines" section. For example, say you want to audit the value of the NotifiedEntity, RequestIdentifier, RequestedEvents, SignalRequests, DigitMap, QuarantineHandling and DetectEvents parameters. The RequestedInfo value would be:
F:N,X,R,S,D,Q,T
The capabilities request, which lives in the AuditEndPoint command, is encoded with the keyword "A", like this:
F:A
3.2.2.12. QuarantineHandling ๐ธ
The quarantine handling parameter is a list of comma separated keywords, and there are two little groups to know about:
- The keyword "process" or "discard" tells you how quarantined events get treated. If neither one is there, "process" is assumed ๐
- The keyword "step" or "loop" says whether you should expect exactly one notification at most, or whether multiple notifications are allowed. If neither one is there, "step" is assumed ๐
These are valid values:
Q:loop
Q:process
Q:discard,loop
3.2.2.13. DetectEvents ๐
The DetectEvent parameter is a comma separated list of events, for example:
T: hu,hd,hf,[0-9#*]
It should be noted that no actions can be associated with these events ๐ โโ๏ธ
3.2.2.14. EventStates ๐ซง
The EventStates parameter is also a comma separated list of events, like this:
ES: hu
Again, it should be noted that no actions can be associated with these events ๐
3.2.2.15. RestartMethod ๐
The RestartMethod parameter is encoded as one of these keywords: "graceful", "forced", "restart", "disconnected" or "cancel-graceful". For example:
RM:restart
3.2.2.16. Bearer Information ๐ง
Bearer information values are encoded as a comma separated list of attributes. Each attribute is an attribute name, separated by a colon from an attribute value ๐ถ
The only attribute that's defined is "encoding" (code "e"). Its defined values are "A" (A-law) and "mu" (mu-law). An example looks like this:
B: e:mu
3.3. Format of response headers ๐
The response header is made of a response line, which can optionally be followed by headers that encode the response parameters โจ
Here's an example of a response header:
200 1203 OK
The response line starts with the response code, which is a three digit numeric value. After that comes a white space, the transaction identifier, and then an optional commentary that's preceded by a white space ๐ฌ
The table below describes whether each parameter is mandatory, optional or forbidden in a response header, depending on the command that triggered the response. The letter M stands for mandatory, O for optional and F for forbidden ๐ฐ
___________________________________________________________________
| Parameter name | EP| CR| MD| DL| RQ| NT| AU| AU| RS|
| | CF| CX| CX| CX| NT| FY| EP| CX| IP|
|_____________________|____|____|____|____|____|____|____|____|____|
| ResponseAck | F | F | F | F | F | F | F | F | F |
| BearerInformation | F | F | F | F | F | F | O | F | F |
| CallId | F | F | F | F | F | F | F | O | F |
| ConnectionId | F | O*| F | F | F | F | F | F | F |
| RequestIdentifier | F | F | F | F | F | F | O | F | F |
| LocalConnection | F | F | F | F | F | F | O | O | F |
| Options | | | | | | | | | |
| Connection Mode | F | F | F | F | F | F | F | O | F |
| RequestedEvents | F | F | F | F | F | F | O | F | F |
| SignalRequests | F | F | F | F | F | F | O | F | F |
| NotifiedEntity | F | F | F | F | F | F | F | F | O |
| ReasonCode | F | F | F | F | F | F | O | F | F |
| ObservedEvents | F | F | F | F | F | F | O | F | F |
| DigitMap | F | F | F | F | F | F | O | F | F |
| Connection | F | F | F | O | F | F | F | O | F |
| Parameters | | | | | | | | | |
| Specific Endpoint ID| F | O | F | F | F | F | F | F | F |
| RequestedInfo | F | F | F | F | F | F | F | F | F |
| QuarantineHandling | F | F | F | F | F | F | O | F | F |
| DetectEvents | F | F | F | F | F | F | O | F | F |
| EventStates | F | F | F | F | F | F | O | F | F |
| RestartMethod | F | F | F | F | F | F | O | F | F |
| RestartDelay | F | F | F | F | F | F | O | F | F |
| Capabilities | F | F | F | F | F | F | O | F | F |
| SecondConnectionId | F | O | F | F | F | F | F | F | F |
| SecondEndpointID | F | O | F | F | F | F | F | F | F |
|_____________________|____|____|____|____|____|____|____|____|____|
| LocalConnection | F | M | O | F | F | F | F | O*| F |
| Descriptor | | | | | | | | | |
| RemoteConnection | F | F | F | F | F | F | F | O*| F |
| Descriptor | | | | | | | | | |
|_____________________|____|____|____|____|____|____|____|____|____|
In the case of a CreateConnection message, the response line is followed by a Connection-Id parameter. It may also be followed by a Specific-Endpoint-Id parameter, if the creation request was sent to a wildcarded Endpoint-Id. The Connection-Id parameter is marked as optional in the table. In fact, it's actually mandatory for all positive responses (when a connection was created) and forbidden for negative responses (when no connection was created) ๐
In the case of a DeleteConnection message, the response line is followed by a Connection Parameters parameter, as defined in section 3.2.2.2 ๐๏ธ
A LocalConnectionDescriptor should be transmitted with a positive response (code 200) to a CreateConnection. It may also be transmitted in response to a ModifyConnection command, if the modification changed the session parameters. The LocalConnectionDescriptor is encoded as a "session description," as defined in section 3.4. It's separated from the response header by an empty line ๐ค
When several session descriptors are encoded in the same response, they're encoded one after another, separated by an empty line. This happens, for example, when the response to an audit connection request carries both a local session description and a remote session description. Like this:
200 1203 OK
C: A3C47F21456789F0
N: [128.96.41.12]
L: p:10, a:PCMU;G726-32
M: sendrecv
P: PS=1245, OS=62345, PR=780, OR=45123, PL=10, JI=27,LA=48
v=0
c=IN IP4 128.96.41.1
m=audio 1296 RTP/AVP 0
v=0
c=IN IP4 128.96.63.25
m=audio 1296 RTP/AVP 0 96
a=rtpmap:96 G726-32/8000
In this example, following the SDP syntax, each description starts with a "version" line (v=...). The local description is always sent before the remote description. If a connection descriptor is requested but doesn't exist for the audited connection, that connection descriptor will appear with only the SDP protocol version field ๐ฆ
3.4. Formal syntax description of the protocol ๐
In this section, we provide a formal description of the protocol syntax, following the "Augmented BNF for Syntax Specifications" defined in RFC 2234 ๐ง
MGCPMessage = MGCPCommand / MGCPResponse
MGCPCommand = MGCPCommandLine 0*(MGCPParameter) [EOL *SDPinformation]
Okay so the grammar keeps going, and this is where the message lines actually get built, bestie ๐ง
MGCPCommandLine = MGCPVerb 1*(WSP) <transaction-id> 1*(WSP)
<endpointName> 1*(WSP) MGCPversion EOL
MGCPVerb = "EPCF" / "CRCX" / "MDCX" / "DLCX" / "RQNT"
/ "NTFY" / "AUEP" / "AUCX" / "RSIP" / extensionVerb
extensionVerb = "X" 3(ALPHA / DIGIT)
transaction-id = 1*9(DIGIT)
endpointName = localEndpointName "@" DomainName
LocalEndpointName = LocalNamePart 0*("/" LocalNamePart)
LocalNamePart = AnyName / AllName / NameString
AnyName = "$"
AllNames = "*"
NameString = 1*(range-of-allowed-characters)
DomainName = 1*256(ALPHA / DIGIT / "." / "-") ; as defined in RFC 821
MGCPversion = "MGCP" 1*(WSP) 1*(DIGIT) "." 1*(DIGIT)
[1*(WSP) ProfileName]
ProfileName = 1*(range-of-allowed-characters)
MGCPParameter = ParameterValue EOL
ParameterValue = ("K" ":" 0*WSP <ResponseAck>) /
("B" ":" 0*WSP <BearerInformation>) /
("C" ":" 0*WSP <CallId>) /
("I" ":" 0*WSP <ConnectionId>) /
("N" ":" 0*WSP <NotifiedEntity>) /
("X" ":" 0*WSP <RequestIdentifier>) /
("L" ":" 0*WSP <LocalConnectionOptions>) /
("M" ":" 0*WSP <ConnectionMode>) /
("R" ":" 0*WSP <RequestedEvents>) /
("S" ":" 0*WSP <SignalRequests>) /
("D" ":" 0*WSP <DigitMap>) /
("O" ":" 0*WSP <ObservedEvents>) /
("P" ":" 0*WSP <ConnectionParameters>) /
("E" ":" 0*WSP <ReasonCode>) /
("Z" ":" 0*WSP <SpecificEndpointID>) /
("Z2" ":" 0*WSP <SecondEndpointID>) /
("I2" ":" 0*WSP <SecondConnectionID>) /
("F" ":" 0*WSP <RequestedInfo>) /
("Q" ":" 0*WSP <QuarantineHandling>) /
("T" ":" 0*WSP <DetectEvents>) /
("RM" ":" 0*WSP <RestartMethod>) /
("RD" ":" 0*WSP <RestartDelay>) /
("A" ":" 0*WSP <Capabilities>) /
("ES" ":" 0*WSP <EventStates>) /
(extensionParameter ":" 0*WSP <parameterString>)
ResponseAck = confirmedTransactionIdRange
*[ "," confirmedTransactionIdRange ]
confirmedTransactionIdRange = 1*9DIGIT [ "-" 1*9DIGIT ]
BearerInformation = BearerAttribute 0*("," 0*WSP BearerAttribute)
BearerAttribute = ("e" ":" <BearerEncoding>)
BearerEncoding = "A" / "mu"
CallId = 1*32(HEXDIG)
// The audit request response may include a list of identifiers
ConnectionId = 1*32(HEXDIG) 0*("," 1*32(HEXDIG))
SecondConnectionID = ConnectionId
NotifiedEntity = [LocalName "@"] DomainName [":" portNumber]
LocalName = 1*32(suitableCharacter)
portNumber = 1*5(DIGIT)
RequestIdentifier = 1*32(HEXDIG)
LocalConnectionOptions = [ LocalOptionValue 0*(WSP)
0*("," 0*(WSP) LocalOptionValue 0*(WSP)) ]
LocalOptionValue = ("p" ":" <packetizationPeriod> )
/ ("a" ":" <compressionAlgorithm> )
/ ("b" ":" <bandwidth> )
/ ("e" ":" <echoCancellation> )
/ ("gc" ":" <gainControl> )
/ ("s" ":" <silenceSuppression> )
/ ("t" ":" <typeOfService> )
/ ("r" ":" <resourceReservation> )
/ ("k" ":" <encryptionmethod>[":"<encryptionKey>])
/ ("nt" ":" <typeOfNetwork> )
/ (localOptionExtensionName ":"
/ localOptionExtensionValue)
Capabilities = [ CapabilityValue 0*(WSP)
0*("," 0*(WSP) CapabilityValue 0*(WSP)) ]
CapabilityValue = LocalOptionValue
/ ("v" ":" <supportedPackages>)
/ ("m" ":" <supportedModes> )
packetizationPeriod = 1*4(DIGIT)["-" 1*4(DIGIT)]
compressionAlgorithm = algorithmName 0*(";" algorithmName)
algorithmName = 1*32(SuitableCharacter)
bandwidth = 1*4(DIGIT)["-" 1*4(DIGIT)]
echoCancellation = "on" / "off"
gainControl = "auto" / ["-"]1*4(DIGIT)
silenceSuppression = "on" / "off"
typeOfService = 2HEXDIG
resourceReservation = "g" / "cl" / "be"
;encryption parameters are coded as in SDP (RFC 2327)
encryptiondata = ( "clear" ":" <encryptionKey> )
/ ( "base64" ":" <encodedEncryptionKey> )
/ ( "uri" ":" <URItoObtainKey> )
/ ( "prompt" ) ; defined in SDP, not usable in MGCP!
encryptionKey = 1*(SuitableCharacter / SP)
encodedEncryptionKey = 1*(ALPHA / DIGIT / "+" / "/" / "=")
URItoObtainKey = 1*(SuitableCharacter) / quotedString
typeOfNetwork = "IN" / "ATM" / "LOCAL"
supportedModes= ConnectionMode 0*(";" ConnectionMode)
supportedPackages = packageName 0*(";" packageName)
localOptionExtensionName = "x" ("+"/"-") 1*32(SuitableCharacter)
localOptionExtensionValue = 1*32(SuitableCharacter) / quotedString
ConnectionMode = "sendonly" / "recvonly" / "sendrecv" /
"confrnce" / "inactive" / "loopback" /
"conttest" / "netwloop" / "netwtest" / "data"
RequestedEvents = [requestedEvent 0*("," 0*(WSP) requestedEvent)]
requestedEvent = eventName [ "(" requestedActions ")" ]
eventName = [ (packageName / "*") "/" ] (eventId / "all" / eventRange)
[ "@" (ConnectionId / "$" / "*") ]
packageName = 1*(ALPHA / DIGIT / HYPHEN)
eventId = 1*(SuitableCharacter)
eventRange = "[" 1*(DIGIT / DTMFLetter / "*" / "#" /
(DIGIT "-" DIGIT)/(DTMFLetter "-"
DTMFLetter)) "]"
requestedActions = requestedAction 0*("," 0*(WSP) requestedAction)
requestedAction = "N" / "A" / "D" / "S" / "I" / "K" /
"E" "(" EmbeddedRequest ")"
EmbeddedRequest = ( "R" "(" EmbeddedRequestList ")"
["," "S" "(" EmbeddedSignalRequest ")" ]
["," "D" "(" EmbeddedDigitMap ")" ] )
/ ( "S" "(" EmbeddedSignalRequest ")"
["," "D" "(" EmbeddedDigitMap ")" ] )
/ ( "D" "(" EmbeddedDigitMap ")" )
EmbeddedRequestList = RequestedEvents
EmbeddedSignalRequest = SignalRequests
EmbeddedDigitMap = DigitMap
SignalRequests = [ SignalRequest 0*("," 0*(WSP) SignalRequest ) ]
SignalRequest = eventName [ "(" eventParameters ")" ]
eventParameters = eventParameter 0*("," 0*(WSP) eventParameter)
eventParameter = eventParameterString / quotedString
eventParameterString = 1*(SuitableCharacter)
DigitMap = DigitString / "(" DigitStringList ")"
DigitStringList = DigitString 0*( "|" DigitString )
DigitString = 1*(DigitStringElement)
DigitStringElement = DigitPosition ["."]
DigitPosition = DigitMapLetter / DigitMapRange
DigitMapLetter = DIGIT / "#" / "*" / "A" / "B" / "C" / "D" / "T"
DigitMapRange = "x" / "[" 1*DigitLetter "]"
DigitLetter ::= *((DIGIT "-" DIGIT ) / DigitMapLetter)
ObservedEvents = SignalRequests
EventStates = SignalRequests
ConnectionParameters = [ConnectionParameter
0*( "," 0*(WSP) ConnectionParameter )
ConnectionParameter = ( "PS" "=" packetsSent )
/ ( "OS" "=" octetsSent )
/ ( "PR" "=" packetsReceived )
/ ( "OR" "=" octetsReceived )
/ ( "PL" "=" packetsLost )
/ ( "JI" "=" jitter )
/ ( "LA" "=" averageLatency )
/ ( ConnectionParameterExtensionName "="
ConnectionParameterExtensionValue )
packetsSent = 1*9(DIGIT)
octetsSent = 1*9(DIGIT)
packetsReceived = 1*9(DIGIT)
octetsReceived = 1*9(DIGIT)
packetsLost = 1*9(DIGIT)
jitter = 1*9(DIGIT)
averageLatency = 1*9(DIGIT)
ConnectionParameterExtensionName = "X" "-" 2*ALPHA
ConnectionParameterExtensionValue = 1*9(DIGIT)
ReasonCode = 3DIGIT [SPACE 1*(%x20-7E)]
SpecificEndpointID = endpointName
SecondEndpointID = endpointName
RequestedInfo = [infoCode 0*("," infoCode)]
infoCode = "B" / "C" / "I" / "N" / "X" / "L" / "M" /
"R" / "S" / "D" / "O" / "P" / "E" / "Z" /
"Q" / "T" / "RC" / "LC" / "A" / "ES" / "RM" / "RD"
QuarantineHandling = loopControl / processControl /
(loopControl "," processControl )
loopControl = "step" / "loop"
processControl = "process" / "discard"
DetectEvents = [eventName 0*("," eventName)]
RestartMethod = "graceful" / "forced" / "restart" / "disconnected"
RestartDelay = 1*6(DIGIT)
extensionParameter = "X" ("-"/"+") 1*6(ALPHA / DIGIT)
parameterString = 1*(%x20-7F)
MGCPResponse = MGCPResponseLine 0*(MGCPParameter)
[EOL *SDPinformation]
MGCPResponseLine = (<responseCode> 1*(WSP) <transaction-id>
[1*(WSP) <responseString>] EOL)
responseCode = 3DIGIT
responseString = *(%x20-7E)
SuitableCharacter= DIGIT / ALPHA / "+" / "-" / "_" / "&" /
"!" / "'" / "|" / "=" / "#" / "?" / "/" /
"." / "$" / "*" / ";" / "@" / "[" / "]" /
"^" / "`" / "{" / "}" / "~"
quotedString = DQUOTE visibleString
0*(quoteEscape visibleString) DQUOTE
quoteEscape = DQUOTE DQUOTE
visibleString = (%x00-21 / %x23-FF)
EOL = CRLF / LF
SDPinformation = ;See RFC 2327
3.5. Encoding of the session description โจ
Now for the fun part: the session description! ๐ It gets encoded according to the session description protocol, SDP ๐ MGCP implementations are expected to be fully capable of parsing any conformant SDP message, and should send session descriptions that strictly conform to the SDP standard. Literally the whole point is that everyone speaks the same SDP dialect ๐ซถ
Which SDP flavour you get depends on the type of session, and that's decided by the "mode" parameter ๐ฆ Here's the tea:
- if the mode is set to
"data", the session description describes the configuration of a data access service. - if the mode is set to any other value, the session description is for an audio service.
For an audio service, the gateway looks at the information in SDP for the "audio" media. ๐ง For a data service, the gateway looks at the information given for the "network-access" media. ๐ Iconic, honestly ๐
3.5.1. Usage of SDP for an audio service ๐ง
okay so in a telephony gateway we only need to describe sessions that use exactly one media type, which is audio ๐ the SDP parameters that matter for telephony are:
At the session description level:
- The IP address of the remote gateway (in commands) or of the local gateway (in responses), or the multicast address of the audio conference, encoded as an SDP
connection dataparameter. This is the IP address that will be used to exchange RTP packets ๐ซถ
For the audio media:
- The media description field (
m) that specifies the audio media, the transport port used for receiving RTP packets by the remote gateway (commands) or by the local gateway (responses), theRTP/AVPtransport, and the list of formats the gateway will accept. This list should normally always include the code0(reserved for PCMU) ๐ - Optionally, RTPMAP attributes that define the encoding of dynamic audio formats ๐
- Optionally, a packetization period (packet time) attribute (
Ptime) that defines the duration of the packet โฑ๏ธ - Optionally, an attribute that defines the type of connection (
sendonly,recvonly,sendrecv,inactive). ngl this one is kinda tricky. It does not have a direct relation with the "Mode" parameter of MGCP. The SDP type of connection will most of the time be set tosendrecv, regardless of what MGCP uses. Other values are only used rarely, like for information or announcement servers that need one-way connections ๐ข - The IP address of the remote gateway (in commands) or of the local gateway (in responses), if it is not present at the session level ๐
An example of an SDP specification for an audio connection could be:
v=0
c=IN IP4 128.96.41.1
m=audio 3456 RTP/AVP 0 96
a=rtpmap:96 G726-32/8000
There is a request, in some environments, to use MGCP to negotiate connections that use other transmission channels than RTP over UDP and IP. This will be detailed in an extension to this document ๐ง
3.5.2. Usage of SDP in a network access service ๐
the SDP parameters that matter for a data network access application are:
For the data media:
- The media description field (
m) that specifies the network access media, identified by the code"m=nas/xxxx", where"xxxx"describes the access control method used for parametrizing the network access, as specified below. The field may also specify the port that should be used for contacting the server, as specified in the SDP syntax ๐ - The connection address parameter (
c=) that specifies the address, or the domain name, of the server that implements the access control method. This parameter may also be specified at the session level ๐ฆ - Optionally, a bearer type attribute (
a=bearer:) that describes the type of data connection to be used, including the modem type ๐ - Optionally, a framing type attribute (
a=framing:) that describes the type of framing that will be used on the channel ๐ - Optionally, attributes describing the called number (
a=dialed:), the number the call was delivered to (a=called:), and the calling number (a=dialing:) ๐ฑ - Optionally, attributes describing the range of addresses that the dialup client could use on its LAN (
a=subnet:) ๐ - Optionally, an encryption key, encoded as specified in the SDP protocol (
k=) ๐
The connection address shall be encoded as specified in the SDP standard. It is used together with the port in the media line to access a server, whose type will be one of the following:
__________________________________________________________
| Method name| Method description |
|____________|____________________________________________|
| radius | Authentication according |
| | to the Radius protocol. |
| tacacs | Authentication according |
| | to the TACACS+ protocol. |
| diameter | Authentication according |
| | to the Diameter protocol. |
| l2tp | Level 2 tunneling protocol. |
| | The address and port are those of the LNS.|
| login | Local login. (There is normally |
| | no server for that method.) |
| none | No authentication required. |
| | (The call was probably vetted |
| | by the Call Agent.) |
|____________|____________________________________________|
If needed, the gateway may use the key specified in the announcement to access the service. That key, in particular, may be used to establish an L2TP tunnel ๐
The bearer attribute is made of a bearer name and an optional extension. The bearer type tells you the type of modulation (modem name) or, for digital connections, the type of ISDN service (8 bits, 7 bits). When there is an extension, it is separated from the bearer name by a single slash (/). The valid values of the bearer attribute are in this table:
____________________________________________________________________
| Type of bearer description | Example of values |
|_________________________________|_________________________________|
| ITU modem standard | V.32, V.34, V.90. |
| ITU modem standard qualified | v.90/3com, |
| by a manufacturer name | v.90/rockwell, |
| | v.90/xxx |
| Well known modem types | X2, K56flex |
| ISDN transparent access, 64 kbps| ISDN64 |
| ISDN64 + V.110 | ISDN64/V.110 |
| ISDN64 + V.120 | ISDN64/V.120 |
| ISDN transparent access, 56 kbps| ISDN56 |
| Informal identification | (Requires coordination between |
| | the Call Agent and the gateway)|
|_________________________________|_________________________________|
The valid values of the framing attribute are in this table:
_________________________________________________
| Type of framing description| Example of values|
|____________________________|___________________|
| PPP, asynchronous framing | ppp-asynch |
| PPP, HDLC framing | ppp-hdlc |
| SLIP, asynchronous | slip |
| Asynchronous, no framing | asynch |
|____________________________|___________________|
The network access authentication parameter gives instructions on the access control that should be exercised for the data call. This optional attribute is encoded as:
"a=subnet:" <network type> <address type>
<connection address> "/" <prefix length>
Here, "network type", "address type", and "connection address" are formatted as defined for the connection address parameter (c=) in SDP, and "prefix length" is a decimal representation of the number of bits in the prefix ๐งฎ
Examples of SDP announcements for the network access service could be:
v=0
m=nas/radius
c=IN IP4 radius.example.net
a=bearer:v.34
a=framing:ppp-asynch
a=dialed:18001234567
a=called:12345678901
a=dialing:12340567890
v=0
m=nas/none
c=IN IP4 128.96.41.1
a=subnet:IN IP4 123.45.67.64/26
a=bearer:isdn64
a=framing:ppp-sync
a=dialed:18001234567
a=dialing:2345678901
v=0
c=IN IP4 access.example.net
m=nas/l2tp
k=clear:some-shared-secret
a=bearer:v.32
a=framing:ppp-asynch
a=dialed:18001234567
a=dialing:2345678901
3.5.3. Usage of SDP for ATM connections โก
The specification of the SDP payload for ATM connections will be described in a companion document, "Usage of MGCP to control Voice over ATM gateways." The text below is only indicative ๐ซ
The SDP payload will specify:
- That the connection is to be established over an ATM interface, using the
c=parameter of SDP to specify an address in the ATM family, the ATM addressing variant (NSAP, UNI, E.164), and the ATM address ๐ธ - The
m=audioparameter will specify the audio encoding and, if needed, the VPI and VCI ๐ถ - Additional attribute parameters (
a=) will be used to specify the ATM coding variants, such as the type of adaptation layer and the error correction or loss compensation algorithms ๐ง
An example of an SDP payload for an ATM connection could be:
v=0 c=ATM NSAP
47.0091.8100.0000.0060.3e64.fd01.0060.3e64.fd01.fe m=audio
5/1002 ATM/AVP PCMU a=connection_type:AAL2
3.5.4. Usage of SDP for local connections ๐ก
When MGCP is used to set up internal connections within a single gateway, the SDP format is used to encode the parameters of that connection. The following parameters will be used:
- The connection parameter (
C=) will specify that the connection is local, using the keywordLOCALas the network type, the keywordEPN(endpoint name) as the address type, and the name of the endpoint as the connection-address ๐งฉ - The
m=audioparameter will specify a port number, which will always be set to0, the type of protocol, always set to the keywordLOCAL, and the type of encoding, using the same conventions as RTP (RTP payload numbers). The type of encoding should normally be set to0(PCMU) ๐
An example of a local SDP payload could be:
v=0
c=LOCAL EPN X35V3+A4/13
m=audio 0 LOCAL 0
3.6. Transmission over UDP ๐ก
MGCP messages are transmitted over UDP. Commands are sent to one of the IP addresses defined in the DNS for the specified endpoint . The responses are sent back to the source address of the commands ๐ฆ
When no port is specified for the endpoint, the commands should be sent:
- by the Call Agents, to the default MGCP port for gateways,
2427. - by the Gateways, to the default MGCP port for Call Agents,
2727.
3.6.1. Providing the At-Most-Once functionality โจ
okay so MGCP messages ride along on UDP ๐ฆ, which means they can totally get lost on the way ๐ญ. when nobody answers in time, the commands just get sent again ๐. but here's the tea: most MGCP commands are not idempotent ๐. if a CreateConnection got executed several times, the gateway's state would be a total mess ๐. so the transmission procedures have to provide an "At-Most-Once" functionality ๐.
MGCP entities are expected to keep two lists in memory ๐ง . one is the responses they sent to recent transactions, and the other is the transactions that are currently being executed. when an incoming command shows up, its transaction identifier gets compared to the ids of those recent responses. if there's a match, the entity doesn't run the transaction again. it just repeats the response ๐. the remaining commands get compared to the list of current transactions, and if they match, the transaction is simply ignored ๐ โโ๏ธ.
the procedure uses a long timer, called LONG-TIMER โฐ. the timer should be set larger than the maximum duration of a transaction. that duration has to take into account the maximum number of repetitions, the maximum value of the repetition timer, and the maximum propagation delay of a packet in the network. a suggested value is 30 seconds ๐ธ.
the copy of the responses can be destroyed either LONG-TIMER seconds after the response is issued, or when the gateway (or the call agent) gets a confirmation that the response was received, through the "Response Acknowledgement attribute" ๐. for transactions that are acknowledged through this attribute, the gateway shall keep a copy of the transaction-id for LONG-TIMER seconds after the response is issued. that way it can detect and ignore duplicate copies of the transaction request that the network might produce ๐ซถ.
3.6.2. Transaction identifiers and three ways handshake ๐
transaction identifiers are integers from 0 to 999,999,999 ๐ข. call agents can decide to use a specific number space for each gateway they manage, or the same number space for all gateways in some arbitrary group ๐ง. they can also share the load of managing a big gateway between several independent processes. those processes share the same transaction number space. there are multiple ways to pull this off, like a centralized allocation of transaction identifiers, or pre-allocating non-overlapping ranges to different processes ๐ . the implementations must guarantee that unique transaction identifiers are allocated to all transactions that originate from a logical call agent, as defined in the "states, failover and race conditions" section โจ. gateways can simply detect duplicate transactions by looking at the transaction identifier only ๐.
the Response Acknowledgement Attribute can be found in any command ๐. it carries a set of "confirmed transaction-id ranges."
MGCP gateways may choose to delete the copies of responses for transactions whose id falls inside the "confirmed transaction-id ranges" received in the Response Confirmation messages ๐๏ธ. they should silently discard further commands from that Call Agent when the transaction-id falls within those ranges ๐คซ.
the "confirmed transaction-id ranges" values shall not be used if more than LONG-TIMER seconds have elapsed since the gateway issued its last response to that call agent, or when a gateway resumes operation ๐. in that situation, commands should be accepted and processed, without any test on the transaction-id ๐.
commands that carry the "Response Acknowledgement attribute" may be transmitted out of order ๐. the gateway shall retain the union of the "confirmed transaction-id ranges" received in recent commands ๐ซง.
3.6.3. Computing retransmission timers โฑ๏ธ
it's the requesting entity's job to set suitable timeouts for all outstanding commands, and to retry commands when those timeouts are exceeded ๐ฃ. and if repeated commands keep failing to get acknowledged, the requesting entity is responsible for seeking redundant services and/or clearing existing or pending connections ๐ฌ.
the specification purposely avoids naming any value for the retransmission timers, because those values are typically network dependent ๐. the retransmission timers should normally estimate the timer by measuring the time between sending a command and getting a response back. one possibility is to use the algorithm implemented in TCP-IP, which uses two variables ๐งฎ:
- the average acknowledgement delay, AAD, estimated through an exponentially smoothed average of the observed delays,
- the average deviation, ADEV, estimated through an exponentially smoothed average of the absolute value of the difference between the observed delay and the current average
in TCP, the retransmission timer is set to the sum of the average delay plus N times the average deviation. in MGCP, though, the maximum value of the timer should be bounded ๐ง. that guarantees no repeated packet will reach the gateways after LONG-TIMER seconds. a suggested maximum value is 4 seconds ๐ซ.
after any retransmission, the MGCP entity should do the following ๐:
- it should double the estimated value of the average delay, AAD
- it should compute a random value, uniformly distributed between 0.5 AAD and AAD
- it should set the retransmission timer to the sum of that random value and N times the average deviation
this procedure has two effects ๐ . because it includes an exponentially increasing component, it automatically slows down the stream of messages when there's congestion ๐ข. because it includes a random component, it breaks up the potential synchronization between notifications triggered by the same external event ๐ฒ.
3.6.4. Piggy backing ๐ท
sometimes a Call Agent wants to send several messages at the same time to the same gateways ๐ฆ. when several MGCP messages have to go in the same UDP packet, they should be separated by a line of text that contains a single dot, like in this example ๐:
200 2005 OK
DLCX 1244 card23/21@trgw-7.example.net MGCP 1.0
C: A3C47F21456789F0
I: FDE234C8
the piggy-backed messages should be processed exactly as if they had been received in several simultaneous messages ๐ซถ.
3.6.5. Provisional responses ๐
executing some transactions can take a long time ๐. long execution times can interact with the timer-based retransmission procedure, and that can lead to either an inordinate number of retransmissions, or timer values that get too long to be efficient ๐ตโ๐ซ.
gateways that can predict that a transaction will take a long time to execute may send a provisional response, with response code 100 ๐ฎ. they should send this response if they receive a repetition of a transaction that is still being executed ๐.
MGCP entities that receive a provisional response shall switch to a longer repetition timer for that transaction ๐.
4. States, failover and race conditions. โจ
to implement proper call signalling, the Call Agent has to keep track of the state of the endpoint, and the gateway has to make sure events are properly notified to the call agent ๐. there are special conditions when the gateway or the call agent restarts. the gateway must be redirected to a new call agent during "failover" procedures, and the call agent must take special action when the gateway is taken offline or restarted ๐.
4.1. Basic Asumptions ๐งธ
the support of "failover" is based on the following assumptions ๐:
- Call Agents are identified by their domain name, not their network addresses, and several addresses can be associated with a domain name ๐ท๏ธ.
- An endpoint has one NotifiedEntity associated with it at any given point in time ๐.
- The NotifiedEntity is the last value of the "NotifiedEntity" parameter received for this endpoint (including wild-carded endpoint-names). if no explicit "NotifiedEntity" parameter has been received, the "NotifiedEntity" defaults to the provisioned NotifiedEntity value. if no value was provisioned, it defaults to the source address of the last command received for the endpoint ๐ต๏ธโโ๏ธ.
- Responses to commands are always sent to the source address of the command, regardless of the NotifiedEntity ๐ฎ.
- When the "notified entity" refers to a domain name that resolves to multiple IP addresses, endpoints are capable of switching between different interfaces on the same logical call agent. however, they cannot switch to other (backup) call agent(s) on their own. a backup call agent can instruct them to switch, either directly or indirectly ๐.
- If an entire call agent becomes unavailable, the endpoints managed by that call agent will eventually become "disconnected". the only ways for these endpoints to become connected again are either for the failed call agent to become available, or for a backup call agent to contact the affected endpoints ๐.
- When a backup call agent has taken over control of a group of endpoints, it is assumed that the failed call agent will communicate and synchronize with the backup call agent to transfer control of the affected endpoints back to the original call agent (if that's even desired, maybe the failed call agent should simply become the backup call agent now) ๐ค.
we should note that handover conflict resolution between separate CA's is not in place ๐ฌ. we are relying strictly on the CA's knowing what they are doing and communicating with each other ๐ซ . (although AuditEndpoint can be used to learn about the current NotifiedEntity ๐.)
4.2. Security, Retransmission, and Detection of Lost Associations โจ
okay bestie, so MGCP is organized as a set of transactions, and each one is a command plus a response, which people also call an acknowledgement ๐ . MGCP messages ride on UDP, which means they can get lost ๐ญ. So when there's no timely response, the commands get repeated ๐. MGCP entities are expected to keep a memory list of the responses they sent to recent transactions (basically every response sent over the last LONG-TIMER seconds) and a list of the transactions that are currently being executed ๐ง .
The transaction identifiers of incoming commands get compared to the transaction identifiers of those recent responses. If there's a match, the MGCP entity doesn't execute the transaction again and just repeats the response ๐. The remaining commands get compared to the list of current transactions. If there's a match, the MGCP entity doesn't execute the transaction, and it's simply ignored. A response will show up once the command finishes running โณ.
The repetition mechanism is there to guard against four types of errors, and they're all giving chaos ๐ช๏ธ:
- transmission errors, when for example a packet is lost due to noise on a line or congestion in a queue,
- component failure, when for example an interface to a call agent becomes unavailable,
- call agent failure, when for example an entire call agent becomes unavailable,
- failover, when a new call agent is "taking over" transparently.
The elements should be able to derive from the past history an estimate of the packet loss rate due to transmission errors. In a properly configured system, this loss rate should be kept very low, typically less than 1% ๐. If a call agent or a gateway has to repeat a message more than a few times, it is very legitimate to assume that something else than a transmission error is occurring ๐จ. For example, given a loss rate of 1%, the probability that 5 consecutive transmission attempts fail is 1 in 100 billion, which is an event that should occur less than once every 10 days for a call agent that processes 1,000 transactions per second ๐คฏ. (Indeed, the number of repetitions that is considered excessive should be a function of the prevailing packet loss rate.) We should note that the "suspicion threshold", which we will call "Max1", is normally lower than the "disconnection threshold", which should be set to a larger value ๐ .
Command issued: N=0
|
transmission: N++
| +------------ retransmission: N++ -----------+
| | |
| | transmission |
| | +---to new address -+<--------------------|--+
| | | N=0 | | |
V V V | | |
+-----------+ | | |
| awaiting |- new call agent ->+ +------------+ | |
| response |--- timer elapsed --->| N > Max1 ? |-(no)+ |
+-----------+ <----------+ +------------+ ^ |
| | | | | |
| +- wrong key? -+ (yes) | |
| | | |
response received (if N=Max1, | |
| or N=Max2 | |
| check DNS) | |
v | | |
(end) +---------------+ | |
|more addresses?|(yes)|--+
+---------------+ |
| |
(no) |
| |
+------------+ |
| N > Max2 ? |(no)-+
+------------+
|
(yes)
|
v
(disconnected)
A classic retransmission algorithm would simply count the number of successive repetitions, and conclude that the association is broken after re-transmitting the packet an excessive number of times (typically between 7 and 11 times.) But to account for the possibility of an undetected or in-progress "failover", we tweak the classic algorithm as follows ๐ง:
- We request that the gateway always checks for the presence of a new call agent. It can be noticed either by
- receiving a valid multicast message announcing a failover, or
- receiving a command where the NotifiedEntity points to the new call agent, or
- receiving a redirection response pointing to a new Call Agent.
If a new call agent is detected, the gateway starts transmitting outstanding commands to that new agent. Responses to commands are still transmitted to the source address of the command ๐ฌ.
- We request that if the number of repetitions for this Call Agent is larger than "Max1", the gateway actively queries the name server in order to detect the possible change of the call agent interfaces ๐.
- The gateway may have learned several IP addresses for the call agent. If the number of repetitions is larger than "Max1" and lower than "Max2", and there are more interfaces that have not been tried, then the gateway should direct the retransmissions to alternate addresses ๐บ๏ธ.
- If there are no more interfaces to try, and the number of repetitions is Max2, then the gateway contacts the DNS one more time to see if any other interface should have become available. If not, the gateway is now disconnected ๐.
The procedure will maximize the chances of detecting an ongoing failover. It does, however, have two very specific problems: the potentially long delays of a timer based procedure, and the risk of confusion caused by the use of cryptographic protections ๐ตโ๐ซ.
To automatically adapt to network load, MGCP specifies exponentially increasing timers. If the initial timer is set to 200 milliseconds, the loss of a fifth retransmission will be detected after about 6 seconds. This is probably an acceptable waiting delay to detect a failover โฑ๏ธ. The repetitions should continue after that delay, not only to maybe overcome a transient connectivity problem, but also to allow some more time for the execution of a failover. Waiting a total delay of 30 seconds is probably acceptable ๐ซถ.
It is however important that the maximum delay of retransmissions be bounded. Prior to any retransmission, it is checked that the time elapsed since the sending of the initial datagram is no greater than T- MAX. If more than T-MAX time has elapsed, the endpoint becomes disconnected ๐. The value T-MAX is related to the LONG-TIMER value: the LONG-TIMER value is obtained by adding to T-MAX the maximum propagation delay in the network ๐งฎ.
Another potential cause of connection failure would be the reception of a "wrong key" message, sent by a call agent that could not authenticate the command, presumably because it had lost the security parameters of the association. Such messages are actually not authorized in IPSEC, and they should in fact not be taken at face value ๐ฉ. An attacker could easily forge "wrong key" messages in order to precipitate the loss of a control connection, so this is a big security red flag ๐ต๏ธโโ๏ธ. The current algorithm ignores these messages, which translates into a strict reliance on timers. The algorithm could in fact be improved, maybe by executing a check with the key server of the call agent after "Max1" repetitions ๐.
4.3. Race conditions
okay so MGCP handles race conditions through the notion of a "quarantine list" and through explicit detection of desynchronization ๐.
MGCP does not assume that the transport mechanism will maintain the order of commands and responses. This can cause race conditions, which may be obviated through a proper behavior of the call agent ๐. (Note that some race conditions are inherent to distributed systems. They would still occur even if the commands were transmitted in strict order ๐คทโโ๏ธ.)
In some cases, many gateways may decide to restart operation at the same time. This may happen, for example, if an area loses power or transmission capability during an earthquake or an ice storm ๐ฉ๏ธ. When power and transmission are reestablished, many gateways may decide to send "RestartInProgress" commands simultaneously, leading to very unstable operation ๐ญ๐ซ .
4.3.1. Quarantine list โจ
okay bestie, so MGCP controlled gateways get these "notification requests" asking them to keep an eye out for a list of "events" ๐. Three things decide how those events get handled: the "Requested Events" list, the "Digit Map", and the "Detect Events" list ๐ .
When the endpoint is first initialized, the requested events list and the digit map are both empty ๐ซง. Once a command comes in, the gateway starts observing the endpoint for the events mentioned in that list.
Events get examined as they happen, and what happens next depends on the "action" parameter attached to the event in the requested events list, plus the digit map ๐. Events marked "accumulate" or "treat according to digit map" get stacked up in a list of events. The ones marked "treated according to the digit map" also get added to the dialed string. This keeps going until one event shows up that triggers a Notification to the "notified entity" ๐ฆ.
At that point the gateway sends the notify command and puts the endpoint into a "notification" state ๐. While the endpoint is in this notification state, any events that should be detected on it get stored in a "quarantine" buffer to be processed later. They're literally quarantined ๐. Every event in the union of the RequestedEvents parameter and the most recently received DetectEvent parameter (or, if there isn't one, every event referred to in RequestedEvents) should be detected and quarantined, no matter what action is attached to it ๐.
The endpoint leaves the "notification state" once the acknowledgement of the Notify command comes back โ . The Notify command may be retransmitted while the endpoint is in the "notification state", as described in section 3.5 ๐. When the endpoint leaves the "notification state", it resets the list of observed events and the "current dial string" back to a null value ๐งน.
After that point, what the gateway does depends on the QuarantineHandling parameter in the notification request ๐ธ. If the Call Agent said it expected at most one notification in response to the notification request command, then the gateway should just keep accumulating events in the quarantine list until the next notification request command shows up ๐ซถ.
If the gateway is allowed to send multiple successive Notify commands, here's the flow ๐. When the gateway leaves the "notification state", it resets the observed events list and the "current dial string" to null and starts processing the quarantined events, using the requested events list and digit map it already has. While processing, the gateway might hit an event that needs a Notify command. In that case it can do one of two things:
- it can immediately send a Notify command that reports all the events accumulated in the list of observed events up to and including the triggering event, leaving the unprocessed events in the quarantine list,
- or it can try to empty the quarantined list and send a single Notify command that reports several sets of events and possibly several dial strings. The dial string gets reset to null after each triggering event. Events that come after the last triggering event stay in the quarantine list.
If the gateway sends a Notify command, the endpoint stays in the "notification state" until the acknowledgement arrives โณ. If the gateway doesn't find a quarantined event that asks for a Notify command, it puts the endpoint into a normal state, and events get processed as they come, exactly as if a Notification Request command had just been received ๐.
A gateway can get a brand new Notification Request command for the endpoint at any time ๐ . When one shows up while the gateway is in the notification state, the gateway shall make sure the pending notification gets received by the Call Agent before it sends a successful response to the new NotificationRequest ๐ซง. It does this with the "piggy-backing" functionality of the protocol ๐. The messages then get sent in a single packet to the source of the new NotificationRequest, no matter what the source and "notified entity" were for the old and new commands ๐ฆ. The steps go like this:
a) the gateway builds a message that carries, in a single packet, a repetition of the old pending Notify command and the acknowledgement of the new notification request ๐ฆ.
b) the endpoint is then taken out of the "notification state" without waiting for the acknowledgement of the notification command ๐โโ๏ธ.
c) a copy of the unacknowledged Notify command is kept until an acknowledgement comes in. If a timer elapses, the notification gets repeated, in a packet that also carries a repetition of the acknowledgement of the notification request โฐ.
d) if the acknowledgement gets lost, the Call Agent will retransmit the Notification Request. The gateway replies to that repetition by retransmitting, in a single packet, the unacknowledged Notify and the acknowledgement of the notification request ๐.
e) if the gateway has to send a Notify before the previous Notify is acknowledged, it should build a packet that piggybacks a repetition of the old Notify, a repetition of the acknowledgement of the last notification request, and the new Notify ๐งฉ.
f) gateways that can't piggyback several packets in the same message should choose to leave the endpoint in the "notification" state for as long as the last notification isn't acknowledged ๐ซถ.
After the gateway receives the Notification Request command, the requested events list and digit map (if a new one was provided) get replaced by the newly received parameters, and the list of observed events and accumulated dial string get reset to null ๐ซ. How all of this plays out depends on the QuarantineHandling parameter. That parameter can say quarantined events, or previously observed events, should be discarded, in which case they will be ๐๏ธ. If it says the quarantined events should be processed, the gateway starts processing the quarantined events or previously observed events using the newly received requested events list and digit map ๐. If that processing hits an event that needs a Notify command, the gateway will immediately send a Notify command reporting all events accumulated in the list of observed events up to and including the triggering event, leave the unprocessed events in the quarantine buffer, and enter the "notification state" ๐จ.
A new notification request can also show up while the gateway has accumulated events under the previous notification requests but hasn't detected a notification-triggering event yet ๐ค. Just like with the quarantined events, the quarantine handling parameters decide what happens to these not-yet-notified events:
- If the quarantine-handling parameter says quarantined events shall be ignored, the observed event list is simply reset ๐งน.
- If the quarantine-handling parameter says quarantined events shall be processed, the observed event list is transferred to the quarantined event list. The observed event list is then reset, and the quarantined event list gets processed ๐.
Call Agents SHOULD send the response to a successful Notify message and the new NotificationRequest in the same datagram using the piggy-backing mechanism ๐.
4.3.2. Explicit detection ๐
A key part of the state of several endpoints is where the hook is ๐. A race condition can happen when the user decides to go off-hook before the Call Agent has time to ask the gateway to notify an off hook event (the "glare" condition that's well known in telephony ๐ญ), or when the user goes on-hook before the Call Agent has time to request notification of the event ๐.
To avoid this race condition, the gateway should check the condition of the endpoint before acknowledging a NotificationRequest ๐ก๏ธ. It should return an error:
- if the gateway is asked to notify an "off hook" transition while the phone is already off hook,
- if the gateway is asked to notify an "on hook" or "flash hook" condition while the phone is already on hook.
It's worth noting that the condition check happens at the time the notification request is received ๐ . The actual event that caused the current condition may have already been reported, may have been ignored earlier, or may currently be quarantined ๐ง .
The other state variables of the gateway, like the list of RequestedEvent or list of requested signals, get entirely replaced after each successful NotificationRequest, which stops any long term discrepancy between the Call Agent and the gateway ๐.
When a NotificationRequest is unsuccessful, whether or not it's included in a connection-handling command, the gateway simply carries on as if the command had never been received ๐ซฅ. Like all other transactions, the NotificationRequest should operate as an atomic transaction, so any changes started because of the command should be reverted ๐.
Another race condition can happen when a Notify is issued shortly before the gateway receives a NotificationRequest ๐๏ธ. The RequestIdentifier is used to correlate Notify commands with NotificationRequest commands ๐ฏ.
4.3.3. Ordering of commands, and treatment of disorder โจ
okay so MGCP doesn't require the transport protocol to keep commands in order when they go to a gateway or an endpoint ๐ซถ. That's giving speed, and it helps actions happen on time, but it comes with a few drawbacks. ๐
- Notify commands can get delayed and show up at the Call Agent after a new
NotificationRequesthas already been sent ๐ญ. - If a new
NotificationRequestgets sent before the previous one is acknowledged, nothing guarantees the previous one won't be received in second position ๐.
If a Call Agent wants consistent behaviour from its endpoints, it can follow these rules ๐:
- When a gateway handles several endpoints, commands for the different endpoints can be sent in parallel. Think of a model where each endpoint is run by its own process or its own thread ๐ง.
- When several connections are created on the same endpoint, commands for different connections can be sent in parallel ๐ธ.
- On a given connection, there should normally be only one outstanding command (create or modify). But a
DeleteConnectioncommand can be sent at any time ๐. So a gateway may sometimes get aModifyConnectioncommand for a connection that was already deleted. Those commands should be ignored, and an error code should be returned ๐ โโ๏ธ. - On a given endpoint, there should normally be only one outstanding
NotificationRequestcommand at any time. Use theRequestIdparameter to match Notify commands with the notification request that triggered them ๐ฆ. - Sometimes an implicitly or explicitly wildcarded
DeleteConnectioncommand that targets a group of endpoints can cut in front of a pendingCreateConnectioncommand ๐ณ. The Call Agent should delete, one by one, every connection that was still being completed when the globalDeleteConnectionwas sent ๐งน. Also, newCreateConnectioncommands for the endpoints covered by the wildcard can't be sent until the wildcardedDeleteConnectionhas been acknowledged ๐. - When commands are embedded inside each other, the sequencing requirements for all of them must be followed. For example, a Create Connection command with a Notification Request inside it has to follow the sequencing rules for
CreateConnectionandNotificationRequestat the same time ๐งฉ. AuditEndpointandAuditConnectionaren't subject to any sequencing. Totally free spirits ๐ฆ.RestartInProgressmust always be the first command an endpoint sends, as defined by the restart procedure. Any other command or response must be delivered after thisRestartInProgresscommand (piggy-backing allowed) ๐.- When multiple messages are piggy-backed in a single packet, the messages are always processed in order ๐ฆ.
These rules don't change how the gateway behaves. The gateway should always respond to commands ๐ซก.
4.3.4. Fighting the restart avalanche ๐
Picture this: a big pile of gateways gets powered on at the same moment ๐ฑ. If they all started a RestartInProgress transaction at once, the Call Agent would get totally swamped, and you'd get message losses and network congestion right when service is trying to come back. Not it ๐
โโ๏ธ. To stop these avalanches, the following behaviour is suggested ๐:
- When a gateway is powered on, it should start a restart timer set to a random value, uniformly distributed between 0 and a maximum waiting delay (MWD). Care should be taken to keep the random number generation from syncing up across gateways that use the same algorithm ๐ฒ.
- The gateway should then wait for whichever comes first: the end of this timer, a command from the Call Agent, or a detected local user activity, like an off-hook transition on a residential gateway ๐.
- When the timer runs out, when a command arrives, or when an activity is detected, the gateway should start the restart procedure ๐.
The restart procedure basically means the endpoint has to make sure the first message (command or response) the Call Agent sees from it is a RestartInProgress message that tells the Call Agent about the restart ๐ฃ. The endpoint is free to make full use of piggy-backing to pull this off ๐.
Each endpoint in a gateway is expected to have a provisionable Call Agent, the "notified entity", to send that first restart message to ๐. When a gateway's endpoints are managed by more than one Call Agent, the procedure above must be performed for each group of endpoints managed by a given Call Agent ๐ฏ. The gateway MUST make full use of wild-carding to cut down on the number of RestartInProgress messages it creates when several endpoints restart and are managed by the same Call Agent ๐ซถ.
The MWD value is a configuration parameter, and it depends on what type of gateway it is. Here's the reasoning you can use to figure out this delay for residential gateways ๐ก.
Call Agents are usually sized to handle peak-hour traffic, when on average 10% of the lines are busy, with calls that last about 3 minutes ๐. Handling a call usually takes 5 to 6 MGCP transactions between each endpoint and the Call Agent ๐. Do the math and the Call Agent handles 5 to 6 transactions per endpoint every 30 minutes on average. Put another way, that's about one transaction per endpoint every 5 to 6 minutes on average โฐ. So a reasonable MWD for a residential gateway is 10 to 12 minutes. Without explicit configuration, residential gateways should use 600 seconds for MWD ๐.
MWD should be much shorter for trunking gateways and business gateways ๐ข. They handle lots of endpoints, and those endpoints are used way more than 10% during the peak busy hour. A typical figure is 60%. During the peak hour, these endpoints add roughly one transaction per minute to the Call Agent's load ๐ค. A reasonable approach is to make the MWD per "trunk" endpoint six times shorter than the MWD for a residential gateway, and also inversely proportional to the number of endpoints being restarted ๐. For example, MWD should be 2.5 seconds for a gateway that handles a T1 line, or 60 milliseconds for a gateway that handles a T3 line โก.
4.3.5. Disconnected Endpoints ๐
On top of the restart procedure, gateways also have a "disconnected" procedure. It kicks in when an endpoint becomes "disconnected", as described in Section 3.4.2 ๐. Just so you know, endpoints can only become disconnected when they try to talk to the Call Agent ๐. An endpoint that becomes "disconnected" follows these steps ๐:
- A "disconnected" timer is set to a random value, uniformly distributed between 0 and a provisionable "disconnected" initial waiting delay (Tdinit), e.g., 15 seconds. Care MUST be taken to keep the random number generation from syncing up across gateways and endpoints that use the same algorithm ๐ฒ.
- The gateway then waits for whichever comes first: the end of this timer, a command from the Call Agent, or a detected local user activity for the endpoint, like an off-hook transition ๐.
- When the "disconnected" timer runs out, when a command arrives, or when a local user activity is detected, the gateway starts the "disconnected" procedure for the endpoint. If it's local user activity, a provisionable "disconnected" minimum waiting delay (Tdmin) must also have passed since the gateway became disconnected, or since the last time it started the "disconnected" procedure. That's how the rate of the procedure gets limited ๐ข.
- If the "disconnected" procedure still leaves the endpoint disconnected, the "disconnected" timer doubles, capped by a provisionable "disconnected" maximum waiting delay (Tdmax), e.g., 600 seconds. Then the gateway goes back to step 2 ๐.
The "disconnected" procedure is a lot like the restart procedure. It says the endpoint MUST send a RestartInProgress command to the Call Agent to let it know the endpoint got disconnected. It also has to make sure the first message (command or response) the Call Agent sees from this endpoint MUST be that RestartInProgress command ๐ฃ. The endpoint MUST make full use of piggy-backing to get this done. After that, the Call Agent may decide to audit the endpoint, or just clear all connections for it ๐งน.
This spec purposely doesn't define any extra behaviour for a disconnected endpoint ๐คทโโ๏ธ. Vendors MAY, for instance, choose to provide silence, play a reorder tone, or even enable a downloaded wav file to be played ๐ถ.
The default value for Tdinit is 15 seconds, the default value for Tdmin is 15 seconds, and the default value for Tdmax is 600 seconds ๐ .
5. Security requirements ๐
Okay, this part is serious bestie ๐ญ. If unauthorized entities could use MGCP, they could set up unauthorized calls or mess with authorized ones ๐จ. We expect MGCP messages to always travel over secure Internet connections, as defined in the IP security architecture in RFC 2401, using either the IP Authentication Header defined in RFC 2402, or the IP Encapsulating Security Payload defined in RFC 2406 ๐ก๏ธ. So the full MGCP protocol stack would look like this ๐:
________________________________
| MGCP |
|_______________________________|
| UDP |
|_______________________________|
| IP security |
| (authentication or encryption)|
|_______________________________|
| IP |
|_______________________________|
| transmission media |
|_______________________________|
Connections are adequately protected when gateways and Call Agents only accept messages for which IP security has provided an authentication service โ . An encryption service adds protection against eavesdropping, which keeps third parties from watching the connections an endpoint sets up ๐.
The encryption service will also be requested if session descriptions are used to carry session keys, as defined in SDP ๐.
These procedures don't necessarily protect against denial of service attacks by misbehaving gateways or misbehaving Call Agents ๐ค. What they do provide is a way to identify those misbehaving entities, who should then be stripped of their authorization through maintenance procedures ๐ซ.
5.1. Protection of media connections ๐
Okay bestie, so MGCP lets the call agent give gateways "session keys" ๐๏ธ that can be used to encrypt the audio messages, which protects against eavesdropping ๐.
Now the big packet-network problem is "uncontrolled barge-in" ๐ญ. An attacker can aim media packets at the IP address and UDP port a connection is using. If nothing protects it, those packets get decompressed and the signals get played on the "line side" ๐. Absolutely not.
A basic protection is to only accept packets from known sources. For example, you check that the IP source address and UDP source port match the values announced in the "remote session description" ๐ง. But this has two inconveniences: it slows down connection establishment, and it can be fooled by source spoofing ๐.
- To turn on address-based protection, the call agent has to get the remote session description of the e-gress gateway and pass it to the in-gress gateway. That takes at least one network round trip, and now you're stuck in a dilemma ๐ฉ. Either let the call proceed without waiting and risk "clipping" a remote announcement, or wait for the full round trip and accept slower call set-up.
- Source spoofing only works if the attacker can get valid pairs of source and destination addresses and ports, for example by listening to a chunk of the traffic ๐. You could fight it by controlling all access points to the network, but that's super hard to pull off in practice ๐ฅฒ.
The alternative is to encrypt and authenticate the packets, using a secret key that gets conveyed during call set-up ๐. This won't slow down call set-up, and it gives strong protection against address spoofing. Iconic ๐ โจ.
6. Event packages and end point types ๐
This section gives an initial definition of packages and event names ๐. More packages can be defined in additional documents ๐ธ.
6.1. Basic packages ๐ฆ
The list of basic packages includes the following ๐:
_________________________________________
| Package | name |
|______________________________|_________|
| Generic Media Package | G |
| DTMF package | D |
| MF Package | M |
| Trunk Package | T |
| Line Package | L |
| Handset Package | H |
| RTP Package | R |
| Network Access Server Package| N |
| Announcement Server Package | A |
| Script Package | Script|
|______________________________|_________|
In the tables of events for each package, there are five columns ๐ซถ:
- Symbol: the unique symbol used for the event.
- Definition: a short description of the event.
- R: an x in this column means the event can be Requested by the call agent ๐.
- S: if nothing appears in this column for an event, then the event cannot be signaled on command by the call agent. Otherwise, these symbols tell you the type of event:
- OO: On/Off signal. The signal is turned on until the call agent commands it to turn off, and vice versa ๐.
- TO: Timeout signal. The signal lasts for a given duration unless it is superseded by a new signal โณ.
- BR: Brief signal. The event has a short, known duration โก.
- Duration: specifies the duration of TO signals.
6.1.1. Generic Media Package ๐ก
Package Name: G
The generic media package groups together the events and signals that can be observed on several types of endpoints, like trunking gateways, access gateways or residential gateways ๐ .
_____________________________________________________________________
| Symbol | Definition | R | S Duration |
|__________|____________________________|_____|______________________|
| mt | Modem detected | x | |
| ft | Fax tone detected | x | |
| ld | Long duration connection | x | |
| pat(###) | Pattern ### detected | x | OO |
| rt | Ringback tone | | TO |
| rbk(###) | ring back on connection | | TO 180 seconds |
| cf | Confirm tone | | BR |
| cg | Network Congestion tone | | TO |
| it | Intercept tone | | OO |
| pt | Preemption tone | | OO |
| of | report failure | x | |
|__________|____________________________|_____|______________________|
The signals are defined as follows ๐:
The pattern definition can be used for specific algorithms, such as answering machine detection, tone detection, and the like ๐ค.
Ring back tone (rt) ๐: an Audible Ring Tone, which is a combo of two AC tones with frequencies of 440 and 480 Hertz and levels of -19 dBm each, giving a combined level of -16 dBm. The cadence for Audible Ring Tone is 2 seconds on, followed by 4 seconds off. See GR- 506-CORE - LSSGR: SIGNALING, Section 17.2.5 ๐.
Ring back on connection ๐: a ring back tone, applied to the connection whose identifier is passed as a parameter.
The "long duration connection" is detected when a connection has been established for more than 1 hour โฐ.
6.1.2. DTMF package โ๏ธ
Package name: D
_______________________________________________________________
| Symbol | Definition | R | S Duration |
|________|___________________________|_____|___________________|
| 0 | DTMF 0 | x | BR |
| 1 | DTMF 1 | x | BR |
| 2 | DTMF 2 | x | BR |
| 3 | DTMF 3 | x | BR |
| 4 | DTMF 4 | x | BR |
| 5 | DTMF 5 | x | BR |
| 6 | DTMF 6 | x | BR |
| 7 | DTMF 7 | x | BR |
| 8 | DTMF 8 | x | BR |
| 9 | DTMF 9 | x | BR |
| # | DTMF # | x | BR |
| * | DTMF * | x | BR |
| A | DTMF A | x | BR |
| B | DTMF B | x | BR |
| C | DTMF C | x | BR |
| D | DTMF D | x | BR |
| L | long duration indicator | x | 2 seconds|
| X | Wildcard, match | x | |
| | any digit 0-9 | | |
| T | Interdigit timer | x | 4 seconds|
| of | report failure | x | |
|________|___________________________|_____|___________________|
The "interdigit timer" T is a digit input timer that can be used in two ways โฑ๏ธ:
- When timer T is used with a digit map, the timer is not started until the first digit is entered, and it gets restarted after each new digit is entered, until either a digit map match or mismatch occurs. In this case, timer T works as an inter-digit timer ๐.
- When timer T is used without a digit map, the timer starts immediately and gets simply cancelled (but not restarted) as soon as a digit is entered. In this case, timer T can be used as an interdigit timer when overlap sending is used ๐งฉ.
When it's used with a digit map, timer T takes on one of two values, T(partial) or T(critical) ๐ญ. When at least one more digit is required for the digit string to match any of the patterns in the digit map, timer T takes on the value T(partial), which corresponds to partial dial timing. If a timer is all that's required to produce a match, timer T takes on the value T(critical), which corresponds to critical timing. When timer T is used without a digit map, timer T takes on the value T(critical). The default value for T(partial) is 16 seconds, and the default value for T(critical) is 4 seconds. The provisioning process may alter both of these โ๏ธ.
The "long duration indicator" is observed when a DTMF signal is produced for a duration larger than two seconds ๐ซฃ. In this case, the gateway will detect two successive events. First, when the signal has been recognized, you get the DTMF signal. Then, 2 seconds later, you get the long duration signal ๐ฅ.
6.1.3. MF Package ๐ข
Package Name: M
________________________________________________________
| Symbol | Definition | R | S Duration |
|________|____________________|_____|___________________|
| 0 | MF 0 | x | BR |
| 1 | MF 1 | x | BR |
| 2 | MF 2 | x | BR |
| 3 | MF 3 | x | BR |
| 4 | MF 4 | x | BR |
| 5 | MF 5 | x | BR |
| 6 | MF 6 | x | BR |
| 7 | MF 7 | x | BR |
| 8 | MF 8 | x | BR |
| 9 | MF 9 | x | BR |
| X | Wildcard, match | x | |
| | any digit 0-9 | | |
| T | Interdigit timer | x | 4 seconds|
| K0 | MF K0 or KP | x | BR |
| K1 | MF K1 | x | BR |
| K2 | MF K2 | x | BR |
| S0 | MF S0 or ST | x | BR |
| S1 | MF S1 | x | BR |
| S2 | MF S2 | x | BR |
| S3 | MF S3 | x | BR |
| wk | Wink | x | BR |
| wko | Wink off | x | BR |
| is | Incoming seizure | x | OO |
| rs | Return seizure | x | OO |
| us | Unseize circuit | x | OO |
| of | report failure | x | |
|________|____________________|_____|___________________|
The definitions of the MF package events are as follows ๐:
Wink ๐: a transition from unseized to seized to unseized trunk states within a specified period. The typical seizure period is 100-350 msec.)
Incoming seizure ๐ฅ: incoming indication of a call attempt.
Return seizure ๐ค: seizure in response to an outgoing seizure.
Unseize circuit ๐: unseizure of a circuit at the end of a call.
Wink off ๐: a signal used in operator services trunks. A transition from seized to unseized to seized trunk states within a specified period of 100-350 ms. (To be checked)
6.1.4. Trunk Package ๐
Package Name: T ๐
_____________________________________________________________________
| Symbol | Definition | R | S Duration |
|________|________________________________|_____|____________________|
| co1 | Continuity tone (single tone,| x | OO |
| | or return tone) | | |
| co2 | Continuity test (go tone, | x | OO |
| | in dual tone procedures) | | |
| lb | Loopback | | OO |
| om | Old Milliwatt Tone (1000 Hz) | x | OO |
| nm | New Milliwatt Tone (1004 Hz) | x | OO |
| tl | Test Line | x | OO |
| zz | No circuit | x | OO |
| as | Answer Supervision | x | OO |
| ro | Reorder Tone | x | TO 30 seconds|
| of | report failure | x | |
| bl | Blocking | | OO |
|________|________________________________|_____|____________________|
Okay so here's the trunk package signal events, and they're giving very organized vibes ๐ Let's go through them.
Continuity Tone (co1): a tone at 2010 + or - 30 Hz. ๐ซถ
Continuity Test (co2): a tone at the 1780 + or - 30 Hz. ๐ฆ
Milliwatt Tones: Old Milliwatt Tone (1000 Hz), New Milliwatt Tone (1004 Hz) ๐ธ
Line Test: 105 Test Line test progress tone (2225 Hz + or - 25 Hz at -10 dBm0 + or -- 0.5dB). ๐ง
No circuit: (that annoying tri-tone, low to high) ๐
Answer Supervision: ๐
Reorder Tone: Reorder tone is a combination of two AC tones with frequencies of 480 and 620 Hertz and levels of -24 dBm each, to give a combined level of -21 dBm. The cadence for Station Busy Tone is 0.25 seconds on followed by 0.25 seconds off, repeating continuously. See GR-506-CORE - LSSGR: SIGNALING, Section 17.2.7. ๐ญ
Blocking: The call agent can place the circuit in a blocked state by applying the "bl(+)" signal to the endpoint. It can unblock it by applying the "bl(-)" signal. ๐ฅ
The continuity tones are used when the call agent wants to initiate a continuity test. There are two types of tests, single tone and dual tone. The Call agent is expected to know, through provisioning information, which test should be applied to a given endpoint. For example, the call agent that wants to initiate a single frequency test will send to the gateway a command of the form: โจ
RQNT 1234 epx-t1/17@tgw2.example.net
X: AB123FE0
S: co1
R: co1
If it wanted instead to initiate a dual-tone test, it would send the command: ๐
RQNT 1234 epx-t1/17@tgw2.example.net
X: AB123FE0
S: co2
R: co1
The gateway would send the requested signal, and in both cases would look for the return of the 2010 Hz tone (co1). When it detects that tone, it will send the corresponding notification. ๐
The tones are of type OO: the gateway will keep sending them until it receives a new notification request. ๐
6.1.5. Line Package ๐ธ
Package Name: L ๐ฆ
________________________________________________________________________
|Symbol | Definition | R | S Duration |
|_____________|______________________________|_____|___________________|
|adsi(string) | adsi display | | BR |
|vmwi | visual message | | OO |
| | waiting indicator | | |
|hd | Off hook transition | x | |
|hu | On hook transition | x | |
|hf | Flash hook | x | |
|aw | Answer tone | x | OO |
|bz | Busy tone | | TO 30 seconds |
|ci(ti,nu,na) | Caller-id | | BR |
|wt | Call Waiting tone | | TO 30 seconds |
|wt1, wt2, | Alternative call | | |
|wt3, wt4 | waiting tones | | |
|dl | Dial tone | | TO 16 seconds |
|mwi | Message waiting ind. | | TO 16 seconds |
|nbz | Network busy | x | OO |
| | (fast cycle busy) | | |
|ro | Reorder tone | | TO 30 seconds |
|rg | Ringing | | TO 180 seconds|
|r0, r1, r2, | Distinctive ringing | | TO 180 seconds|
|r3, r4, r5, | | | |
|r6 or r7 | | | |
|rs | Ringsplash | | BR |
|p | Prompt tone | x | BR |
|e | Error tone | x | BR |
|sl | Stutter dialtone | | TO 16 seconds |
|v | Alerting Tone | | OO |
|y | Recorder Warning Tone | | OO |
|sit | SIT tone | | |
|z | Calling Card Service Tone | | OO |
|oc | Report on completion | x | |
|ot | Off hook warning tone | | TO indefinite |
|s(###) | Distinctive tone pattern | x | BR |
|of | report failure | x | |
|_____________|______________________________|_____|___________________|
Now the tones, bestie, and these are the important bits ๐ Let's go!
Dial tone: a combined 350 + 440 Hz tone. ๐
Visual Message Waiting Indicator: The transmission of the VMWI messages will conform to the requirements in Section 2.3.2, "On-hook Data Transmission Not Associated with Ringing" in TR-H-000030 and the CPE guidelines in SR-TSV-002476. VMWI messages will only be sent from the SPCS when the line is idle. If new messages arrive while the line is busy, the VMWI indicator message will be delayed until the line goes back to the idle state. The CA should periodically refresh the CPE's visual indicator. See TR-NWT-001401 - Visual Message Waiting Indicator Generic Requirements; and GR-30-CORE - Voiceband Data Transmission Interface. ๐
Message waiting Indicator: See GR-506-CORE, 17.2.3. ๐
Alerting Tone: a 440 Hz Tone of 2 second duration followed by 1/2 second of tone every 10 seconds. ๐
Ring splash: Ringsplash, also known as "Reminder ring" is a burst of ringing that may be applied to the physical forwarding line (when idle) to indicate that a call has been forwarded and to remind the user that a CF subfeature is active. In the US, it is defined to be a 0.5(-0,+0.1) second burst of power ringing. See TR-TSY-000586 - Call Forwarding Subfeatures. โญ
Call waiting tone: Call Waiting tone is defined in GR-506-CORE, 14.2. Call Waiting feature is defined in TR-TSY-000571. By defining "wt" as a TO signal you are really defining the feature which seems wrong to me (given the spirit of MGCP), hence the definition of "wt" as a BR signal in ECS, per GR-506-CORE. Also, it turns out that there is actually four different call waiting tone patterns (see GR-506-CORE, 14.2) so we have wt1, wt2, wt3, wt4. ๐
Caller Id (ci(time, number, name)): The caller-id event carries three parameters, the time of the call, the calling number and the calling name. Each of the three fields are optional, however each of the commas will always be included. See TR-NWT-001188, GR-30-CORE, and TR-NWT-000031. ๐ชช
Recorder Warning Tone: 1400 Hz of Tone of 0.5 second duration every 15 seconds. ๐๏ธ
SIT tone: used for indicating a line is out of service. ๐ซ
Calling Card Service Tone: 60 ms of 941 + 1477 Hz and 940 ms of 350 + 440 Hz (dial tone), decaying exponentially with a time constant of 200 ms. ๐ณ
Distinctive tone pattern: where ### is any number between 000 and 999, inclusive. Can be used for distinctive ringing, customized dial tone, etc. ๐ถ
Report on completion: The report on completion event is detected when the gateway was asked to perform one or several signals of type TO on the endpoint, and when these signals were completed without being stopped by the detection of a requested event such as off-hook transition or dialed digit. The completion report may carry as parameter the name of the signal that came to the end of its live time, as in: ๐
O: L/oc(L/dl)
Ring back on connection: A ring back tone, applied to the connection whose identifier is passed as a parameter. ๐
We should note that many of these definitions vary from country to country. The frequencies listed above are the one in use in North America. There is a need to accommodate different tone sets in different countries, and there is still an ongoing debate on the best way to meet that requirement: ๐
- One solution is to define different event packages specifying for example the German dialtone as
L-DE/DL. - Another solution is to use a management interface to specify on an endpoint basis which frequency shall be associated to what tone.
6.1.6. Handset emulation package ๐ง
Package Name: H ๐
________________________________________________________________________
|Symbol | Definition | R | S Duration |
The handset emulation package is basically the line package's glow-up ๐ It extends the line package, and you use it when the gateway can emulate a handset. The big difference is that events like "off hook" can be signalled as well as detected ๐โจ
6.1.7. RTP Package ๐
Package Name: R
| Symbol | Definition | R | S Duration|
|_________|________________________________|_____|__________________|
| UC | Used codec changed | x | |
| SR(###) | Sampling rate changed | x | |
| JI(###) | Jitter buffer size changed | x | |
| PL(###) | Packet loss exceeded | x | |
| qa | Quality alert | x | |
| co1 | Continuity tone (single tone,| x | OO |
| | or return tone) | | |
| co2 | Continuity test (go tone, | x | OO |
| | in dual tone procedures) | | |
| of | report failure | x | |
|_________|________________________________|_____|__________________|
Codec Changed: Okay so when the codec changes, you send the new codec's hexadecimal number wrapped in parenthesis, like UC(15), which means the codec switched to PCM mu-law ๐ถ Codec Numbers are specified in RFC 1890, or in a new definition of the audio profiles for RTP that replaces this RFC. Some implementations of media gateways may not allow the codec to be changed upon command from the call agent. codec changed to codec hexadecimal ##.
Sampling Rate Changed: Same vibe here, but with a decimal number of milliseconds in parenthesis. SR(20) means the sampling rate changed to 20 milliseconds โฑ๏ธ Some media gateway implementations may not let a call agent change the sampling rate on command.
Jitter Buffer Size Changed: This one is so useful ๐ฅน If the media gateway can automatically adjust how deep its jitter buffer is for incoming RTP streams, the media gateway controller can ask to be told whenever it grows or shrinks to deal with network latency wobbles. To ask for that, you send JI, which means "tell me about any jitter buffer size changes". The notification from the gateway looks like JI(####), where #### is the new size in milliseconds.
Packet Loss Exceeded: This fires when the packet loss rate goes over the threshold, which is the decimal number in parenthesis, measured in packets per 100,000 packets. So PL(10) means packets are getting dropped at a rate of 1 in 10,000 packets ๐
Quality alert ๐จ This goes off when the packet loss rate, or the combo of delay and jitter, goes over a specified quality threshold.
The continuity tones are the same as the ones defined in the Trunk package. You can use them together with the Network LoopBack or Network Continuity Test modes to test the continuity of an RTP circuit ๐
The "operation failure" code can be used to report problems such as the loss of underlying connectivity. The observed event can include the reason code of the failure as a parameter ๐
6.1.8. Network Access Server Package ๐
Package Name: N
| Symbol | Definition | R | S Duration|
|________|__________________________|_____|_________________|
| pa | Packet arrival | x | |
| cbk | Call back request | x | |
| cl | Carrier lost | x | |
| au | Authorization succeeded| x | |
| ax | Authorization denied | x | |
| of | Report failure | x | |
|________|__________________________|_____|_________________|
The packet arrival event is how the gateway says "hey, at least one packet was recently sent to an Internet address that an endpoint is watching" ๐ The event report includes that Internet address, in standard ASCII encoding, between parenthesis:
O: pa(192.96.41.1)
The call back event pops up when a call back has been requested during the initial phase of a data connection ๐ฒ The report includes the identification of the user who should be called back, between parenthesis:
O: cbk(user25)
6.1.9. Announcement Server Package ๐ข
Package Name: A
| Symbol | Definition | R | S Duration|
|________________|________________________|_____|__________________|
| ann(url,parms) | Play an announcement | | TO variable|
| oc | Report on completion | x | |
| of | Report failure | x | |
|________________|________________________|_____|__________________|
The announcement action is qualified by a URL name and a set of initial parameters, like this:
S: ann(http://scripts.example.net/all-lines-busy.au)
The "operation complete" event gets detected once the announcement has finished playing ๐ง If the announcement can't be played out, an operation failure event can come back instead. The failure can come with a commentary explaining it, like so:
O: A/of(file not found)
6.1.10. Script Package ๐
Package Name: Script
| Symbol | Definition | R | S | Duration|
|___________|________________________|_____|______|___________|
| java(url) | Load a java script | | TO | variable|
| perl(url) | Load a perl script | | TO | variable|
| tcl(url) | Load a TCL script | | TO | variable|
| xml(url) | Load an XML script | | TO | variable|
| oc | Report on completion | x | | |
| of | Report failure | x | | |
|___________|________________________|_____|______|___________|
The "language" action is qualified by a URL name and a set of initial parameters, like this:
S: script/java(http://scripts.example.net/credit-
card.java,long,1234)
The current definition has keywords for the most common languages ๐ More languages may be defined in further versions of this document. For each language, an API specification will describe how the scripts can issue local "notificationRequest" commands, and receive the corresponding notifications.
The script produces an output made of one or several text strings, separated by commas. Those text strings get reported as a commentary in the report on completion, like this:
O: script/oc(21223456794567,9738234567)
The failure report may also return a string, as in:
O: script/oc(21223456794567,9738234567)
The definition of the script environment and the specific actions in that environment are for further study ๐ฎ
6.2. Basic endpoint types and profiles ๐ฆ
We define the following basic endpoint types and profiles:
- Trunk gateway (ISUP)
- Trunk gateway (MF)
- Network Access Server (NAS)
- Combined NAS/VOIP gateway
- Access Gateway
- Residential Gateway
- Announcement servers
These gateways are supposed to implement the following packages:
| Gateway | Supported packages |
|____________________________|_____________________________|
| Trunk gateway (ISUP) | GM, DTMF, TK, RTP |
| Trunk gateway (MF) | GM, MF, DTMF, TK, RTP |
| Network Access Server (NAS)| GM, MF, TK, NAS |
| Combined NAS/VOIP gateway | GM, MF, DTMF, TK, NAS, RTP|
| Access Gateway (VOIP) | GM, DTMF, MF, RTP |
| Access Gateway (VOIP+NAS) | GM, DTMF, MF, NAS, RTP |
| Residential Gateway | GM, DTMF, Line, RTP |
| Announcement Server | ANN, RTP |
|____________________________|_____________________________|
Advanced announcement servers may also support the Script package ๐
Advanced trunking servers may support the ANN package, the Script package, and in some cases the Line and Handset package as well โจ
7. Versions and compatibility ๐
7.1. Differences between version 1.0 and draft 0.5 โจ
okay so draft 0.5 dropped in February 1999 as the last update of draft version 0.1 ๐ Version 1.0 learned from actual implementation experience, and it lines up as much as possible with the CableLabs' NCS project ๐ซถ The main differences between the February draft and version 1.0 are:
- Specified more clearly that the encoding of three LocalConnectionOptions parameters, Encoding Method, Packetization Period and Bandwidth, shall follow the conventions laid out in SDP. ๐ง
- Specified how the quarantine handling parameter governs the handling of detected but not yet specified events. ๐
- Specified that unexpected timers or digits should trigger transmission of the dialed string. ๐
- Removed the digit map syntax description from section 2.1.5 (it was redundant with section 3.4.) ๐
- Corrected miscellaneous bugs in the formal syntax description. ๐
- Aligned specification of commands with the CableLabs NCS specification. This mostly affects the AuditEndpoint and RestartInProgress commands. โจ
- Aligned the handling of retransmission with the CableLabs NCS specification. ๐
- Added the provisional response return code and corresponding behavior description. ๐ธ
- Added an optional reason code parameter to restart in progress. ๐
- Added the possibility to audit the restart method, restart delay and reason code. ๐ฆ
7.2. Differences between draft-04 and draft-05 ๐
ngl the differences here are pretty minor ๐ฅน We fixed the copyright statement and a bug in the formal description, and that's the whole tea โ
7.3. Differences between draft-03 and draft-04 ๐ซง
Draft 04 cleans up a bunch of minor editing mistakes that people spotted while reviewing draft 03, which came out on February 1 ๐โจ
7.4. Differences between draft-02 and draft-03 ๐
The main differences between draft-02, issued January 22 1998, and draft 03 are giving a whole glow-up ๐
- Introduced a discussion on endpoint types. ๐ฆ
- Introduced a discussion of the connection set-up procedure, and of the role of connection parameters. ๐ง
- Introduced a notation of the connection identifier within event names. ๐ท๏ธ
- Documented the extension procedure for the LocalConnectionOptions parameter and for the ConnectionParameters parameter. ๐
- Introduced a three-way handshake procedure, using a ResponseAck parameter, in order to allow gateways to delete copies of old responses without waiting for a 30 seconds timer. ๐ค
- Expanded the security section to include a discussion of "uncontrolled barge-in." ๐จ
- Propsed a "create two connections" command, as an appendix. ๐ก
7.5. Differences between draft-01 and draft-02 ๐ท
The main differences between draft-01, issued November 1998, and draft 02 are:
- Added an ABNF description of the protocol. ๐
- Specification of an EndpointConfiguration command. ๐ ๏ธ
- Addition of a "two endpoints" mode in the create connection command. ๐ฏโโ๏ธ
- Modification of the package wildcards from "$/$" to "*/all" at the Request of early implementors. ๐
- Revision of some package definitions to better align with external specifications. ๐ง
- Addition of a specification for the handling of "failover." ๐
- Revision of the section on race conditions. ๐
7.6. The making of MGCP from IPDC and SGCP ๐ง
MGCP version 0.1 is the glow-up that came from fusing the SGCP and IPDC proposals together ๐
7.7. Changes between MGCP and initial versions of SGCP ๐
MGCP version 0.1 (which subsumes SGCP version 1.2) brings the following changes from SGCP version 1.1 ๐
- Protocol name changed to MGCP. ๐ณ๏ธโ๐
- Introduce a formal wildcarding structure in the name of endpoints, inspired from IPDC, and detailed the usage of wildcard names in each operation. ๐
- Naming scheme for events, introducing a package structure inspired from IPDC. ๐ฆ
- New operations for audit endpoint, audit connection (requested by the Cablelabs) and restart (inspired from IPDC). ๐
- New parameter to control the behavior of the notification request. ๐๏ธ
- Improved text on the detection and handling of race conditions. ๐ง
- Syntax modification for event reporting, to incorporate package names. ๐งพ
- Definition of basic event packages (inspired from IPDC). ๐
- Incorporation of mandatory and optional extension parameters, inspired by IPDC. ๐งฉ
SGCP version 1.1 brings these changes from version SGCP 1.0, and it's giving main character energy ๐
- Extension parameters (
X-??:) ๐ - Error Code 511 (Unrecognized extension). ๐ โโ๏ธ
- All event codes can be used in RequestEvent, SignalRequest and ObservedEvent parameters. ๐ฏ
- Error Code 512 (Not equipped to detect requested event). ๐
- Error Code 513 (Not equipped to generate requested signal). ๐ซ
- Error Code 514 (Unrecognized announcement). ๐ข
- Specific Endpoint-ID can be returned in creation commands. ๐ชช
- Changed the code for the ASDI display from
adtoasdito avoid conflict with the digits A and D. ๐บ - Changed the code for the answer tone from
attoawto avoid conflict with the digit A and the timer mark T. ๐ - Changed the code for the busy tone from
bttobzto avoid conflict with the digit B and the timer mark T. ๐ต - Specified that the continuity tone value is
co(CT was incorrectly used in several instances; CT conflicts with .). ๐ - Changed the code for the dial tone from
dttodlto avoid conflict with the digit D and the timer mark T. ๐ถ - Added a code point for announcement requests. ๐ฃ
- Added a code point for the "wink" event. ๐
- Set the "octet received" code in the "Connection Parameters" to
OR(was set to RO, but thenORwas used throughout all examples.) ๐ข - Added a "data" mode. ๐พ
- Added a description of SDP parameters for the network access mode (NAS). ๐
- Added four flow diagrams for the network access mode. ๐บ๏ธ
- Incorporated numerous editing suggestions to make the description easier to understand. In particular, cleared the confusion between requests, queries, functions and commands. ๐งน
- Defined the continuity test mode as specifying a dual-tone transponder, while the loopback mode can be used for a single tone test. ๐๏ธ
- Added event code
OC, operation completed. โ - Added the specification of the "quarantine list", which clarifies the expected handling of events and notifications. ๐
- Added the specification of a "wildcard delete" operation. ๐๏ธ
8. Security Considerations ๐
โ ๏ธ Security issues are discussed in section 5. Read section 5 like your life depends on it, bestie ๐ญ
9. Acknowledgements ๐ซถ
We want to thank here the many reviewers who provided us with advice on the design of SGCP and then MGCP, notably Flemming Andreasen, Sankar Ardhanari, Francois Berard, David Auerbach, Bob Biskner, David Bukovinsky, Jerry Kamitses, Oren Kudevitzki, Barry Hoffner, Troy Morley, Dave Oran, Jeff Orwick, John Pickens, Lou Rubin, Chip Sharp, Paul Sijben, Kurt Steinbrenner, Joe Stone and Stuart Wray. ๐ธ
The version 0.1 of MGCP is heavily inspired by the "Internet Protocol Device Control" (IPDC) designed by the Technical Advisory Committee set up by Level 3 Communications. Whole sets of text have been retrieved from the IP Connection Control protocol, IP Media Control protocol, and IP Device Management. The authors wish to acknowledge the contribution to these protocols made by Ilya Akramovich, Bob Bell, Dan Brendes, Peter Chung, John Clark, Russ Dehlinger, Andrew Dugan, Isaac Elliott, Cary FitzGerald, Jan Gronski, Tom Hess, Geoff Jordan, Tony Lam, Shawn Lewis, Dave Mazik, Alan Mikhak, Pete O'Connell, Scott Pickett, Shyamal Prasad, Eric Presworsky, Paul Richards, Dale Skran, Louise Spergel, David Sprague, Raj Srinivasan, Tom Taylor and Michael Thomas. ๐
10. References ๐
- Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson, "RTP: A Transport Protocol for Real-Time Applications", RFC 1889, January 1996. ๐๏ธ
- Schulzrinne, H., "RTP Profile for Audio and Video Conferences with Minimal Control", RFC 1890, January 1996. ๐ฅ
- Handley, M and V. Jacobson, "SDP: Session Description Protocol", RFC 2327, April 1998. ๐งพ
- Handley, M., "SAP - Session Announcement Protocol", Work in Progress. ๐ง
- Handley, M., Schulzrinne, H. and E. Schooler, "Session Initiation Protocol (SIP)", RFC 2543, March 1999. ๐
- Schulzrinne, H., Rao, A. and R. Lanphier, "Real Time Streaming Protocol (RTSP)", RFC 2326, April 1998. โถ๏ธ
- ITU-T, Recommendation Q.761, "FUNCTIONAL DESCRIPTION OF THE ISDN USER PART OF SIGNALLING SYSTEM No. 7", (Malaga-Torremolinos, 1984; modified at Helsinki, 1993) ๐ฐ๏ธ
- ITU-T, Recommendation Q.762, "GENERAL FUNCTION OF MESSAGES AND SIGNALS OF THE ISDN USER PART OF SIGNALLING SYSTEM No. 7", (MalagaTorremolinos, 1984; modified at Helsinki, 1993) ๐ก
- ITU-T, Recommendation H.323 (02/98), "PACKET-BASED MULTIMEDIA COMMUNICATIONS SYSTEMS." ๐ฌ
- ITU-T, Recommendation H.225, "Call Signaling Protocols and Media Stream Packetization for Packet Based Multimedia Communications Systems." ๐๏ธ
- ITU-T, Recommendation H.245 (02/98), "CONTROL PROTOCOL FOR MULTIMEDIA COMMUNICATION." ๐๏ธ
- Kent, S. and R. Atkinson, "Security Architecture for the Internet Protocol", RFC 2401, November 1998. ๐ก๏ธ
- Kent, S. and R. Atkinson, "IP Authentication Header", RFC 2402, November 1998. ๐ชช
- Kent, S. and R. Atkinson, "IP Encapsulating Security Payload (ESP)", RFC 2406, November 1998. ๐
- Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997. ๐
11. Authors' Addresses ๐
Mauricio Arango RSL COM Latin America 6300 N.W. 5th Way, Suite 100 Ft. Lauderdale, FL 33309
Phone: (954) 492-0913 EMail: marango@rslcom.com
Andrew Dugan Level3 Communications 1450 Infinite Drive Louisville, CO 80027
Phone: (303)926 3123 EMail: andrew.dugan@l3.com
Isaac Elliott Level3 Communications 1450 Infinite Drive Louisville, CO 80027
Phone: (303)926 3123 EMail: ike.elliott@l3.com
Christian Huitema Telcordia Technologies MCC 1J236B 445 South Street Morristown, NJ 07960 U.S.A.
Phone: +1 973-829-4266 EMail: huitema@research.telcordia.com
Scott Pickett Vertical Networks 1148 East Arques Ave Sunnyvale, CA 94086
Phone: (408) 523-9700 extension 200 EMail: ScottP@vertical.com
Further information is available on the SGCP web site: http://www.argreenhouse.com/SGCP/ ๐โจ
12. Appendix A: Proposed "MoveConnection" command โจ
Okay so this appendix is a proposal, not a finished feature ๐ฆ. Somebody floated the idea of a new command that would move an existing connection from one endpoint to another on the same gateway. It's giving main character energy because it'd be super useful for call services like call forwarding between endpoints that live on the same gateway ๐
[SecondEndPointId,]
[ConnectionId,]
[LocalConnectionDescriptor]
<--- ModifyConnection(CallId,
EndpointId,
ConnectionId,
SecondEndPointId,
[NotifiedEntity,]
[LocalConnectionOptions,]
[Mode,]
[RemoteConnectionDescriptor,]
[Encapsulated NotificationRequest,]
[Encapsulated EndpointConfiguration])
The parameters are the same as in ModifyConnection, plus one new thing: a SecondEndpointId that tells the gateway which endpoint the connection is heading to ๐
The EndpointId should be the fully qualified endpoint identifier of the endpoint where the connection was created. The local name shall not use the wildcard convention, so no shortcuts there bestie ๐
The SecondEndpointId shall be the endpoint identifier of the endpoint the connection is moving toward. The "any of" wildcard convention can be used, but the "all of" convention can't. If the SecondEndpointId is unqualified, the gateway picks a value and sends it back to the call agent as a response parameter โจ
So the command moves the existing connection over to the second endpoint. Depending on the gateway, the connection identifier might stay the same after the move or it might change. If it changes, the new value comes back as a response parameter ๐ธ
The whole point is a local relocation of the connection. You don't have to touch transmission parameters like IP addresses and ports, which means the call agent doesn't have to tell the remote gateway on the other end that anything changed ๐ง Gateway architectures don't always allow transparent moves though, ngl. For example, some setups might map specific IP addresses to different boards that each handle a particular group of endpoints. If the transmission parameters do have to change because of the move, the new LocalConnectionDescriptor comes back as a response parameter ๐
The LocalConnectionOptions, Mode, and RemoteConnectionDescriptor parameters, when they're present, get applied after the move ๐
The RequestedEvents, RequestIdentifier, DigitMap, SignalRequests, QuarantineHandling and DetectEvents parameters are all optional. The call agent can use them to send a NotificationRequest that runs at the same time as the move. When they show up, that NotificationRequest applies to the second endpoint ๐ฆ
When those parameters are there, the move and the NotificationRequests should be synchronized, meaning both get accepted or both get refused. The NotifiedEntity parameter, if it's present, applies to both the ModifyConnection and the NotificationRequest ๐ซถ
The command can also carry an encapsulated EndpointConfiguration command, which applies to the second endpoint too. When it's there, its parameters get inserted after the normal MoveConnection parameters, except for SecondEndpointId, since that one doesn't get copied over. The EndpointConfiguration can be encapsulated together with an encapsulated NotificationRequest as well โจ
The encapsulated EndpointConfiguration shares the fate of the MoveConnection command. If the move gets rejected, the EndpointConfiguration doesn't run either ๐ญ
12.1. Proposed syntax modification
The only syntax change needed to add the moveConnection command is putting the keyword MOVE into the authorized values in the MGCPVerb clause of the formal syntax ๐
13. Full Copyright Statement ๐
Copyright (C) The Internet Society (1999). All Rights Reserved. ๐
Here's the legal tea, bestie. You can copy this document and share it with others, and you can make derivative works that comment on or explain it, or that help people implement it. You can publish and distribute those copies and works, in whole or in part, with no restrictions at all, as long as the copyright notice and this paragraph stay on every copy and derivative work. The document itself can't be changed in any way, though. You can't remove the copyright notice or the references to the Internet Society or other Internet organizations. The exceptions are when it's needed for developing Internet standards, in which case the Internet Standards process copyright procedures have to be followed, or when it's being translated into languages other than English ๐
The limited permissions above are perpetual and won't be revoked by the Internet Society or its successors or assigns ๐
This document and the information in it are provided on an "AS IS" basis, and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ๐
Acknowledgement ๐ซถ
Funding for the RFC Editor function is currently provided by the Internet Society โจ
๐ฆ where this page comes from
- ietf: rfc2705 1999-10
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms