Understanding MGCP Packets: A brief overview and example with debugs

While studying MGCP protocol messages from debugs my head was spinning like ‘what the c**p message are those!’, had an weird idea to generate the call and capture all MGCP packets and write down explanation of each of the terms. I am weak on the MGCP debugs packets from the beginning of starting voice, now I just wanted to nail it down and wished to learn whole conversations between MGCP GW and the Call Agents. Tough one for me I know but who doesn’t want to learn something new? Took the challenge and I think now it’s quite easy for me. 🙂

Before starting the derivation let’s write down the MGCP Packet verbs and code explanations:

Code Verb
AUCX    AuditConnection.
AUEP    AuditEndpoint.
CRCX    CreateConnection.
DLCX    DeleteConnection.
EPCF    EndpointConfiguration.
MDCX    ModifyConnection.
RQNT    NotificationRequest.
NTFY    Notify.
RSIP    RestartInProgress.

Code Description
200    The requested transaction was executed normally.
250    The connection was deleted.

Code Description

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.

Code Description
500    The transaction could not be executed, because the endpoint is unknown.
501    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.

I haven’t write down all the codes here to save my space on this post.
There are some more error codes can be found from the link:

http://www.networksorcery.com/enp/protocol/mgcp.htm

Now let’s collect the MGCP Packets from the gateway end with the debug command ‘debug mgcp packets’.
My setup had one PUB one SUB, phones are registered with the SUB.

The events during capturing debug packets:
First, I called one PSTN side phone from one IP Phone, collected the message for first attempt.
Second, recieved the call from PSTN phone, nothing was appeared on the gateway.
Third, when the call is established I shutted down the subscriber CallManager service, so PUB immediately took over the call.
Forth, Hanged up the call and the call was cleared.

Now lets start discussing the debug packets and understanding those one by one:

=========================================================
First, when initialing call and PSTN phone is ringing
=========================================================

– Connection Request (CRCX)
————————————————————————-
Aug  7 07:53:35.628: MGCP Packet received from 10.10.210.12:2427—>
CRCX 49 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
C: D000000002743a14000000F500000006
X: 2
L: p:20, a:PCMU, s:off, t:b8
M: recvonly
R: D/[0-9ABCD*#]
Q: process,loop
<—

– Message that ‘requested transaction was executed normally’ (message code: 200)
——————————————————————————————————–
Aug  7 07:53:35.652: MGCP Packet sent to 10.10.210.12:2427—>
200 49 OK
I: 19

v=0
c=IN IP4 10.10.210.254
m=audio 18404 RTP/AVP 0 100
a=rtpmap:100 X-NSE/8000
a=fmtp:100 192-194,200-202
a=X-sqn:0
a=X-cap: 1 audio RTP/AVP 100
a=X-cpar: a=rtpmap:100 X-NSE/8000
a=X-cpar: a=fmtp:100 192-194,200-202
a=X-cap: 2 image udptl t38
<—

– Message to Modify Connection (MDCX) – this happens when called party confirms it’s existense and ringback tone is heard on the caller phone
———————————————————————————————————————————————————————–
Aug  7 07:53:35.776: MGCP Packet received from 10.10.210.12:2427—>

HQ#MDCX 50 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
C: D000000002743a14000000F500000006
I: 19
X: 2
L: p:20, a:PCMU, s:off, t:b8
M: sendrecv
R: D/[0-9ABCD*#]
S:
Q: process,loop

v=0
o=- 25 0 IN EPN S0/SU0/DS1-0/2@HQ.ccievoice.com
s=Cisco SDP 0
t=0 0
m=audio 22760 RTP/AVP 0
c=IN IP4 10.234.130.209
<—

– Message that ‘requested transaction was executed normally’ (message code: 200)
——————————————————————————————————
Aug  7 07:53:35.780: MGCP Packet sent to 10.10.210.12:2427—>
200 50 OK
<—

=================================================================================================================
Second, recieved the call, RTP packets started going over on both the way, but nothing was appeared on the debug.
=================================================================================================================

===============================================================================================================
Third, Active Primary call-agent is down when a call is active and secondary call-agent is taking over the call
===============================================================================================================

– Message that the MGCP GW have noticed the primary call-agent service is down so
the gateway blocks idle circuits and waits for the exiting connections to be terminated gracefully (RSIP=RestartInProgress, RM:graceful)
————————————————————————————————————————————————————————
Aug  7 09:11:25.523: MGCP Packet sent to 10.10.210.12:2427—>
RSIP 70602705 *@HQ.ccievoice.com MGCP 0.1
RM: graceful
<—

– But immediately the secondary call-agent takes over the gateway and initiates a restart message to unblock the active channels (RSIP:RestartInProgress, RM:restart)
———————————————————————————————————————————————————————
Aug  7 09:11:25.523: MGCP Packet sent to 10.10.210.11:2427—>
RSIP 70602707 *@HQ.ccievoice.com MGCP 0.1
RM: restart
<—

– Gateway recieves 200 message from the secondary call agent (message code: 200)
——————————————————————————————————————
Aug  7 09:11:25.559: MGCP Packet received from 10.10.210.11:2427—>
200 70602707
<—

– Regular keepalive message from GW to call-agent
————————————————————–
Aug  7 09:11:25.563: MGCP Packet sent to 10.10.210:2427—>
NTFY 70602709 *@HQ.ccievoice.com MGCP 0.1
X: 0
O:
<—

– Active call-agent (backup) sends AUEP (AuditEndPoint) message to MGCP GW to check status of the gateway bearer channels.
The following AUEP message is to check the status of DS1-0/1 circuit.

detail of AUEP message can be found here though it’s applicable for BTS10200 SoftSwitch, but it gives an idea of AUEP:

http://www.cisco.com/en/US/docs/voice_ip_comm/bts/4.5/troubleshooting/guide/apxctg.html
—————————————————————————————————————————————————————–
Aug  7 09:11:25.591: MGCP Packet received from 10.10.210.11:2427—>
AUEP 74 S0/SU0/DS1-0/1@HQ.ccievoice.com MGCP 0.1
F: X, A, I
<—

– MGCP GW sends the status of the requested bearer channel regardless of active/block/idle state with ‘200’ message
————————————————————————————————————————————————
Aug  7 09:11:25.595: MGCP Packet sent to 10.10.210.11:2427—>
200 74
I:
X: 1
L: p:10-20, a:PCMU;PCMA;G.nX64, b:64, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-220, a:G.729;G.729a;G.729b, b:8, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-110, a:G.726-16;G.728, b:16, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-70, a:G.726-24, b:24, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-50, a:G.726-32, b:32, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:30-270, a:G.723.1-H;G.723;G.723.1a-H, b:6, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:30-330, a:G.723.1-L;G.723.1a-L, b:5, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
M: sendonly, recvonly, sendrecv, inactive, loopback, conttest, data, netwloop, netwtest
<—

– CA Agent again sends another AUEP message to check the status of DS1-0/2 circuit
———————————————————————————————————
Aug  7 09:11:25.595: MGCP Packet received from 10.10.210.11:2427—>
AUEP 75 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
F: X, A, I
<—

– Gateway again replies with 200 message for the channel DS1-0/2
OT be noted that: the following channel is active on a call.

Here ‘I’ signifies to ‘Connection identification number’ and it will contain a value only when a connection is established, i.e. for an active call
————————————————————————————————————————————————————————-
Aug  7 09:11:25.599: MGCP Packet sent to 10.10.210:2427—>
200 75
I: 1A
X: 2
L: p:10-20, a:PCMU;PCMA;G.nX64, b:64, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-220, a:G.729;G.729a;G.729b, b:8, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-110, a:G.726-16;G.728, b:16, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-70, a:G.726-24, b:24, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:10-50, a:G.726-32, b:32, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:30-270, a:G.723.1-H;G.723;G.723.1a-H, b:6, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
L: p:30-330, a:G.723.1-L;G.723.1a-L, b:5, e:on, gc:1, s:on, t:10, r:g, nt:IN;ATM;LOCAL, v:T;G;D;L;H;R;ATM;SST;PRE
M: sendonly, recvonly, sendrecv, inactive, loopback, conttest, data, netwloop, netwtest
<—

– CA Agent again sends another AUEP message to check the status of DS1-0/3 circuit
———————————————————————————————————
Aug  7 09:11:25.599: MGCP Packet received from 10.10.210.11:2427—>
AUEP 76 S0/SU0/DS1-0/3@HQ.ccievoice.com MGCP 0.1
F: X, A, I
<—

– MGCP GW returns that the circuit is not established and the endpoint is unknown with the message ‘500’

Message code ‘500’ = ‘The transaction could not be executed, because the endpoint is unknown.’
————————————————————————————————————————————-
Aug  7 09:11:25.599: MGCP Packet sent to 10.10.210.11:2427—>
500 76 Endpt Unknown
<—

– Thus CA requests to check status for the bearer channels DS1-0/1 to DS1-0/23.
—————————————————————————————————
Aug  7 09:11:25.619: MGCP Packet received from 10.10.210.11:2427—>
AUEP 96 S0/SU0/DS1-0/23@HQ.ccievoice.com MGCP 0.1
F: X, A, I
<—

Aug  7 09:11:25.619: MGCP Packet sent to 10.10.210.11:2427—>
500 96 Endpt Unknown
<—

– Call Agent request the gateway for additional information of the active call on the bearer channel DS1-0/2 with message AUCX

“AUCX = AuditConnection”
——————————————————————————————————————————————————————–
Aug  7 09:11:25.619: MGCP Packet received from 10.10.210.11:2427—>
AUCX 97 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
I: 1A
F: C, M
<—

– MGCP GW returns the additional information with ‘200’ message. It sends the Call Identification Number (C) and Connection Mode (M)

To be noted that: ‘C’ is not the caller id, it’s the call identification number
M: sendrecv means, the call is on active state
—————————————————————————————————————————————————————————
Aug  7 09:11:25.619: MGCP Packet sent to 10.10.210.11:2427—>
200 97
C: D000000002743a16000000F500000007
M: sendrecv
<—

– Call Agent request notification with the message RQNT as the connection was reported some ICMP Unreachable (R/iu) for the channel DS1-0/2
R/iu = RTP channel was reported for ICMP Unreachable (iu)

For more info about “R: R/iu” please visit the link:

http://tools.ietf.org/html/draft-foster-mgcp-basic-packages-07
————————————————————————————————————————————————————————-
Aug  7 09:11:25.627: MGCP Packet received from 10.10.210.11:2427—>
RQNT 98 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
X: 2
R: R/iu
Q: process,loop
<—

– MGCP GW receives the message and reports the CA with message type 200
———————————————————————————————-
Aug  7 09:11:25.627: MGCP Packet sent to 10.10.210.11:2427—>
200 98 OK
<—

– As the connection was reported the gateway sends a RestartInProgress and restarts the call gracefully
———————————————————————————————————————————–
Aug  7 09:11:26.023: MGCP Packet sent to 10.10.210.12:2427—>
RSIP 70602705 *@HQ.ccievoice.com MGCP 0.1
RM: graceful
<—

=============================
Forth, Call is Disconnecting
=============================

– CA request the gateway to terminate the call with DLCX(DeleteConnection) message
———————————————————————————————————
HQ#
Aug  7 10:56:55.990: MGCP Packet received from 10.10.210.11:2427—>
DLCX 125 S0/SU0/DS1-0/2@HQ.ccievoice.com MGCP 0.1
C: D00000000274ec6e000000F500000001
I: 1B
X: 2
S:
<—

– Gateway resposes to CA with Confirmation of deletion the message

Message code ‘250’: ‘The Connection was deleted’
—————————————————————————————
Aug  7 10:56:56.010: MGCP Packet sent to 10.10.210.11:2427—>
250 125 OK
P: PS=3687, OS=589920, PR=0, OR=0, PL=0, JI=0, LA=0
<—