What is MGCP Protocol?


The full form of MGCP is the Media Gateway Control Protocol. To understand the MGCP protocol. In this tutorial, first, we will describe the signaling and media paths in a call. MGCP protocol provides specifications to control the media gateway. Next comes to mind, what is a media gateway, and who controls it?

Media Gateway is a device or node that terminates the voice trunks in the telecom network. Voice trunks can be of multiple types, e.g., E1/T1, VoIP, ISDN, analog lines, etc. 

Call control is an application that handles the control messages for the call and sends the command to the media gateway over the MGCP protocol to reserve/release/modify the voice trunks using the MGCP protocol. 

There may be commands or events from Media Gateway to Call Control.

What is MGCP
What is the MGCP protocol?

Here we will explain in very simple terms the use of MGCP then we will discuss in detail the MGCP protocol. In another tutorial for the ss7 protocol, we addressed the signaling flow for the Call control. Here we will discuss media gateway call flow during a call.

What is Media Gateway?

Media is a stream, which can be for voice, fax, etc. Media Gateway is a device that connects two streams in each direction. One direction is towards the calling number, and the other is towards the called number. During a call, the mobile device samples the voice into a stream of data packets. Call originating exchange sends the packets to the media gateway, which sends packets to the called exchange. Before sending any packet, a voice circuit is set up in each direction from the gateway.

Media Gateway does format conversion too. For example, a PSTN subscriber dials a number in the VoIP network. In this case, the media gateway converts PSTN (E1/T1) media format to the VoIP format and vice versa.

Example Call Flow for MGCP:

This example will describe the signaling and corresponding handling and media gateway over MGCP.

Call Flow with MGCP
Call Flow with MGCP

The above example shows full call flow with signaling. Once the call control application receives a signaling message for the call, it reserves a media channel in the incoming direction. Then forwards the call message to the terminating switching center and reserve the media channel in an outgoing direction. Once a call is answered, both channels are connected. Connecting channels is called switching.   Once switching is done, both the calling and the called parties can start communicating.

MGCP protocol specification:

Till now, we have talked about the general use of MGCP protocol. Now here we will describe the exact protocol specifications. The specifications are in MGCP RFC. The communication between Call Control and Media Gateway is over UDP or TCP. MGCP uses standard port 2427 on the media gateway and 2727 on-call the control application. This means when a call control sends a request to the media gateway destination MGCP port is 2427, and when the opposite, the destination MGCP port is 2727. The format of the command is the SDP protocol type.

MGCP protocol primitives:

To set up the call, both ends issue commands to each other. The following are the commands that are present in the MGCP protocol.

  1. End Point Configuration: Call control issues this command to set coding standards for an endpoint for the call termination.
  2. Create Connection: Call control sends this command to the media gateway to create a connection to terminate in an endpoint.
  3. Notification Command. Using this command, the call agent sets event types on the media gateway (MG). These are standard events carried out in MGCP protocol from MG to a call agent. One example is DTMF.
  4. Notify Command, MG issues this command to send events to the Call agent.
  5. Modify connection for modifying an already-existing connection.
  6. Delete connection for deleting a connection.