Skip to main content

Media Gateway Control Protocol

The Media Gateway Control Protocol (MGCP) is an implementation of the media gateway control protocol architecture for controlling media gateways on Internet Protocol (IP) networks connected to the public switched telephone network (PSTN). The protocol architecture and programming interface is described in RFC 2805 and the current specific MGCP definition is RFC 3435 which overrides RFC 2705. It is a successor to the Simple Gateway Control Protocol (SGCP) which was developed by Bellcore and Cisco. In November 1998, the Simple Gateway Control Protocol (SGCP) was combined with Level 3 Communications Internet Protocol Device Control (IPDC) to form the Media Gateway Control Protocol (MGCP).

MGCP is a text-based signaling and call control communications protocol used in Voice over IP (VoIP) systems. It implements a model similar to the structure of the PSTN with the power of the network residing in a call control center softswitch which is analogous to the central office in the telephone networks. The endpoints are low-intelligence devices, mostly executing control commands. The protocol represents a decomposition of other VoIP models, such as H.323, in which the H.323 Gatekeeper, have higher levels of signaling intelligence.

MGCP uses the Session Description Protocol (SDP) for specifying and negotiating the media streams to be transmitted in a call session and the Real-time Transport Protocol (RTP) for framing of the media streams.



Relationship between network elements in MGCP.

The media gateway control protocol architecture and its methodologies and programming interfaces are described in RFC 2805.

MGCP is a master/slave protocol that allows a call control device such as a call agent to take control of a specific port on a media gateway. In MGCP context media gateway controller is referred to as call agent. This has the advantage of centralized gateway administration and provides for largely scalable IP Telephony solutions. The distributed system is composed of a call agent, at least one media gateway (MG) that performs the conversion of media signals between circuits and packets switched networks, and at least one signaling gateway (SG) when connected to the PSTN.

MGCP assumes a call control architecture where there is limited intelligence at the edge, e.g., endpoints on media gateways, and intelligence at the core call agent. MGCP assumes that call agents, will synchronize with each other to send commands and responses to the gateways under their control.

The call agent uses MGCP to tell the media gateway which events should be reported to the call agent, how endpoints should be inter-connected, and which signals should be activated on the endpoints.

MGCP also allows the call agent to audit the current state of endpoints on a media gateway.

The media gateway uses MGCP to report events, such as off-hook or dialed digits, to the call agent.

While any signaling gateway is usually on the same physical switch as a media gateway, there is no such need. The call agent does not use MGCP to control the signaling gateway; rather, SIGTRAN protocols are used to backhaul signaling between the signaling gateway and call agent.

Typically, a media gateway is configured with a list of call agents from which it may accept programming (where that list normally comprises only one or two call agents).

In principle, event notifications may be sent to different call agents for each endpoint on the gateway (as programmed by the call agents, by setting the NotifiedEntity parameter). In practice, however, it is usually desirable that at any given moment all endpoints on a gateway should be controlled by the same call agent; other call agents are available only to provide redundancy in the event that the primary call agent fails, or loses contact with the media gateway. In the event of such a failure it is the backup call agent's responsibility to reprogram the MG so that the gateway comes under the control of the backup call agent. Care is needed in such cases; two call agents may know that they have lost contact with one another, but this does not guarantee that they are not both attempting to control the same gateway. The ability to audit the gateway to determine which call agent is currently controlling can be used to resolve such conflicts.

MGCP assumes that the multiple call agents will maintain knowledge of device state among themselves (presumably with an unspecified protocol) or rebuild it if necessary (in the face of catastrophic failure). Its failover features take into account both planned and unplanned outages.

Protocol overview

MGCP packets are unlike those generated by many other protocols. Usually wrapped in UDP port 2427, the MGCP datagrams are formatted with whitespace, much like you would expect to find in TCP protocols.

An MGCP packet is either a command or a response. Every issued MGCP command has a transaction ID and receives a response. Commands begin with a four-letter verb. Responses begin with a three number response code.

There are nine (9) command verbs:


Two verbs are used by a call agent to query (the state of) a media gateway:

 AUEP - Audit Endpoint AUCX - Audit Connection 

Three verbs are used by a call agent to manage an RTP connection on a media gateway (a media gateway can also send a DLCX when it needs to delete a connection for its self-management):

 CRCX - Create Connection DLCX - Delete Connection MDCX - Modify Connection 

One verb is used by a call agent to request notification of events on the media gateway, and to request a media gateway to apply signals:

 RQNT - Request for Notification 

One verb is used by a call agent to modify coding characteristics expected by the "line-side" on the media gateway:

 EPCF - Endpoint Configuration 

One verb is used by a media gateway to indicate to the call agent that it has detected an event for which the call agent had previously requested notification of (via the RQNT44 command verb):

 NTFY - Notify 

One verb is used by a media gateway to indicate to the call agent that it is in the process of restarting:

 RSIP - Restart In Progress 

Standards documents

  • RFC 3435 Media Gateway Control Protocol (MGCP) Version 1.0 (supersedes RFC 2705)
  • RFC 3660 Basic Media Gateway Control Protocol (MGCP) Packages (informational)
  • RFC 3661 Media Gateway Control Protocol (MGCP) Return Code Usage
  • RFC 3064 MGCP CAS Packages
  • RFC 3149 MGCP Business Phone Packages
  • RFC 3991 Media Gateway Control Protocol (MGCP) Redirect and Reset Package
  • RFC 3992 Media Gateway Control Protocol (MGCP) Lockstep State Reporting Mechanism (informational)
  • RFC 2805 Media Gateway Control Protocol Architecture and Requirements
  • RFC 2897 Proposal for an MGCP Advanced Audio Package

Modifications and profiles

MGCP has been widely implemented in PacketCable networks. The standards bodies for that industry have adopted various modifications, both extensions as well as simplifications, to the basic MGCP protocol. Network-based Call Signaling (NCP) is a standard that was enacted by Cable Television Laboratories starting in 1999, and last published and finalized in Specification PKT-SP-EC-MGCP-C01-071129 (2007). The Trunking Gateway Control Protocol was defined in 2002 by the International Telecommunications Union in Specification ITU T-REC J.171 and by the Society of Cable Telecommunication Engineers in American National Standard ANSI/SCTE 24-12 (2009). The NCP and TGCP profiles are supported in the MGCP implementations in the voice gateway routers by Cisco Systems.


Another implementation of the media gateway control protocol architecture is the H.248/Megaco protocol, a collaboration of the Internet Engineering Task Force (RFC 3525) and the International Telecommunication Union (Recommendation H.248.1). Both protocols follow the guidelines of the conceptual media gateway control protocol architecture, as described in RFC 2805. However, the protocols are incompatible and use different underlying connection models and different protocol syntax.

Source: Wikipedia, Google