MGCP (Media Gateway Control Protocol) is a protocol used within a Voice over IP (VoIP) system. This internal protocol was primarily developed to address the demands of carrier-based IP telephone networks. MGCP is a complementary protocol for both H.323 and SIP, which was designed as an internal protocol between the Media Gateway Controller and the Media Gateway. In MGCP, an MGC primarily handles all the call processing by linking with the IP network through constant communications with an IP signaling device, for example an SIP Server or an H.323 gatekeeper.

MGCP is comprised of a Call Agent, one MG (media gateway) which performs the conversion of media signals between circuits and packets, and one SG (signaling gateway) when connected to the PSTN (Public Switched Telephone Network). MGCP is widely used between elements of a decomposed multimedia gateway. The gateway has a Call Agent, which is comprised of the call control "intelligence" and a media gateway boasting the media functions, for example conversion from TDM voice to Voice over IP.

Media Gateways feature endpoints for the Call Agent to create and manage media sessions with other multimedia endpoints. Endpoints are sources and/or sinks of data that can be physical or virtual. For creating physical endpoints, hardware installation is needed while virtual endpoint can be created using available software.

Call Agents come with the capability of creating new connections, or modify an existing connection. Generally, a media gateway is a network element which provides conversion between the data packets carried over the Internet or other packet networks and the voice signals carried by telephone lines. The Call Agent provides instructions to the endpoints to check for any events and – if there is any – create signals. The endpoints are designed in such a way as to automatically communicate changes in service state to the Call Agent. The Call Agent can audit endpoints and the connections on endpoints.

MGCP Connections

MGCP connections can be point to point or multipoint. Point to point connection can be a connection between two endpoints for transmitting data between these endpoints. Once the connection is setup between two endpoints, data transfer takes place between the endpoints. In a multipoint connection, the connection is set up between an endpoint and a multipoint session. In a multipoint connection, connections can be created over various types of bearer networks.

MGCP Architecture

MGCP came to be a much sought after application of VoIP technology because it is not involved in the frustrating work of encoding, decoding, and transferring voice signals. Though, the MGCP Call Agent works as a software switch for a VoIP network, it really does nothing more than simply direct the media gateways and signaling gateways which perform all the work. One of the main tasks in building a Call Agent is implementing the numerous possibilities in the protocol. There are various informational RFCs which may explain the expected behavior under a wide range of conditions.

In MGCP architecture, each and every command features a transaction ID, gets an acknowledgement and receives a response. This can be better understood as subscription architecture, as the Call Agent informs the media gateways and the signaling gateways as to what events it takes care of and what events it leaves unattended.

MGCP packets are generally found wrapped in UDP port 2427. Similar to what you might find in TCP protocols, MGCP datagrams are formatted with whitespace. An MGCP packer can either be a command or a response. Commands start with a four-letter verb while "responses" start with a three number response code.