. 108
( 132 .)


Add Media gateway Adds a termination to a context
Subtract Media gateway Removes a termination from a context
Move Media gateway Moves a termination from one context to another

8.7.3 MEGACO commands and descriptors

MEGACO de¬nes eight different commands, as shown in Table 8.7.
Parameters for MEGACO commands are called descriptors; some are optional while
others are mandatory, depending on the speci¬c command.
Table 8.8 shows some of the more commonly used descriptors. Some of the parame-
ters support wild card options, which allows a command to be performed for multiple
terminations or contexts at the gateway. The wild card symbol * is used to indicate all
contexts or all terminations. It can be used as part of a termination™s name to indicate a
range of values; for example, the terminations aaln/1 aaln/2 aaln/3 could all be acted on
together using the termination id aaln/*.
It is also possible to set a parameter to choose the value. This is indicated by the $
symbol. In this case the gateway is expected to choose a value and return it to the MGW
controller. This is used when creating new terminations or contexts. For commands that
have no context, the context ID is set to null, which is indicated by the “ symbol. Finally,
for a command to relate to all terminations at the gateway, the termination ID can also
be set to a value of ROOT.
To save on overhead, MEGACO commands are grouped together. Each MEGACO
message is called a transaction. A transaction consists of a series of actions and each
action can consist of a series of commands, which all operate on a single context. This
grouping is illustrated in Figure 8.11.
8.7 MEGACO 529

Table 8.8 MEGACO descriptors
Name Purpose Comment
ContextID Identi¬es a context Unsigned 32-bit
TerminationID Identi¬es a termination Arbitrary string, can have structure
e.g. ds3/2/28 could be 28th slot of the
DS3 card plugged into slot 2
LocalDescriptor Local RTP parameters SDP format for RTP parameters
allocated by gateway when creating
local IP terminations
RemoteDescriptor Remote RTP parameters SDP format for RTP parameters
requested by gateway controller when
connecting the gateway to a remote
EventsDescriptor Request for events to be Set by gateway controller
detected at the
ObservedEvents Used by notify to Set by media gateway
Descriptor indicate events
detected at the

Action 1 Context id = $ Action 2 Context id = 5555
Command 1 Command 2 Command 1 Command 2 Command 3

Figure 8.11 MEGACO transaction

8.7.4 Context and termination handling (bearer
For the MSC servers in the R4 network with a mobile originated call, the creation of the
bearer to handle the call will be initiated by an CC SETUP message. Figure 8.12 shows
how the MSC servers establish the bearer in the case of forward establishment (i.e. where
the initiating gateway controls the network bearer creation). In this example the MSC
server and MGW serving the RNC are referred to as local. The gateway MSC server and
MGW connecting the core network to the external PSTN are referred to as remote. The
steps are as follows:

1. The local MSC server receives CC SETUP from the originating UE.
2. The local MSC server determines which remote MSC server to forward call, then
forwards the BICC IAM message.
3. The remote MSC server decides it needs to forward the call in PCM trunk 1. It
instructs the remote MGW to create an association between the IP network (RTP
media and TDM line on PSTN side) and forwards the IAM message onto the PSTN

Iu 2
Bearer Information 3a
1 5
Local MSC Server Remote MSC Server
6 12 3 10
Reply 4000
Transaction 4000 Context C300
Reply 3000
CONTEXT $ Transaction 4001 Transaction 3000
ADD Ephemeral_594 Transaction 3001
Modify ADD $ Context C500
ADD $ Local descriptor Modify
Ephemeral_594 Local descriptor ADD Ephemeral_123
Remote descriptor Address= Ephemeral_123
mode=send/receive Address = $ Local descriptor
Address = port=2030 mode=send/receive
port = $ Address=
port = 3000
ADD Ephemeral_595 port=3000
Modify Modify TDM_1/20
Local descriptor
ADD $ Ephemeral_595 ADD TDM_1/$ mode=send/receive
Local descriptor mode=send/receive CONTEXT = $ ADD TDM_1/20

7 4

Local MGW Remote MGW
ATM/AAL2 IPBCP bearer create PCM Trunk 1

Figure 8.12 Forward bearer establishment
8.7 MEGACO 531

network (3a). Note that the MSC server uses the chosen format of the termination
id (TDM 1/$).
4. The remote MGW creates an association and sends a reply back to the MSC server.
This reply contains the RTP termination local media options (IP address and RTP
port) as well as the chosen termination id for the TDM termination, TDM 1/20.
5. Media options from step 4 are sent from the remote to the local MSC server.
6. The local MSC server instructs the local MGW to create an association between the
ATM/AAL2 and the IP network. To do this it adds two ephemeral terminations, IP
and ATM. The ADD for the IP termination uses the RTP media options returned in
step 4 to set the remote IP address for the IP bearer. The ADD for the ATM
termination sets the connection address as c = ATM NSAP $, instructing the MGW
to create an AAL2 connection.
7. The local MGW creates termination and context. It sends a reply back to the local
MSC server containing termination and context IDs for the association.
8. The local MGW creates an IP bearer connecting to the remote MGW. This is done
using the IP bearer control protocol (IPBCP; see Section 8.8.5).
9. The call is answered; ANM message is received at the remote MSC server.
10. The remote MSC server sets all the terminations for the call set to send/receive
mode, i.e. full duplex, using the modify command.
11. ANM is forwarded to the local MSC server.
12. The local MSC server sets all the terminations for the call set to send/receive mode,
i.e. full duplex, using the modify command.

Figure 8.13 shows the MEGACO commands for steps 3 and 4. The context ID is $,
which means the media gateway is expected to create a new context and add in the
terminations. The termination ID for the second add is $. This means that the termination
is to be created by the gateway. The media requested for the RTP termination is an RTP
payload type 96. Since this a dynamic payload, the media description is followed by the
rtpmap attribute, which maps payload type 96 to 3GPP Iu framing protocol. Notice that
the IP termination is set to send-only and the TDM termination to receive-only. This
enables the media to ¬‚ow across the remote MGW only from right to left (Figure 8.12).
This is because the call has not been answered by the other party as yet, and the media
stream is being used to pass call progression audio or early media (busy, ring tone etc.)
back to the caller™s phone. The gateway responds with the details of the media streams
(payload type, IP address and port number) and the identity of the newly created or chosen
terminations and context. The IP address and port number for the RTP termination are
sent back in the bearer information message (step 5).
Figure 8.14 shows the MEGACO transaction to create the local association (step 6).
The RTP termination is the ¬rst to be added. The MGW is passed the remote media
options (IP address and RTP port) and will use this information to set up the bearer to
the remote MGW using IPBCP (step 8).
The second termination represents the AAL2 connection to the RNC. Since no remote
options are included in this request, the MGW will not set up the AAL2 connection at

Transaction = 3000 {
Context = $ {
Add = TDM_1/$ { Media {
Stream = 1 {
LocalControl {Mode = ReceiveOnly} }},
Add = $ {
Media {
Stream = 1 {
LocalControl {
Mode = SendOnly,
Local descriptor
SDP format
Local {
v=SDP version number used as delimiter
c=connection information IP or ATM address
c=IN IP4 $
m=media descriptor, port number, CODEC
m=audio $ RTP/AVP 96
a=ptime: packtisation interval
a=rtpmap: 96 VND.3GPP.IUFP/16000
a=rtpmap: dynamic payload definition

Reply = 3000 {
Context = C500 {
Add = TDM_1/20,
Add = Ephemeral_123 {
Media {
Stream = 1 {
Local {
c=IN IP4
m=audio $ RTP/AVP 96
a=rtpmap: 96 VND.3GPP.IUFP/16000

Figure 8.13 Remote association creation (transaction and reply) (steps 3 and 4)

this stage. Instead, the MGW prepares itself to receive an incoming AAL2 connection
from the RNC and returns the ATM network service access point (NSAP) address in its
reply back to the MSC server. This NSAP address is then passed to the RNC (in the
RANAP RAB request message), which then uses it to establish the AAL2 connection
with the MGW.
With the ATM termination the SDP local descriptor looks slightly different. The con-
nection information de¬nes an ATM address (c = ATM NSAP $). The media description
de¬nes a payload of AAL2/ITU with a payload type of 96. AAL2/ITU simply means the
raw encapsulation of media within an AAL2 frame. The dynamic payload type for ATM
is de¬ned by the attribute a = atmap: 96 VND.3GPP.IUFP/16000.
8.7 MEGACO 533

Transaction = 4000 {
Context = $ {
Add = $ {
Media {
Stream = 1 {
LocalControl {
Mode = ReceiveOnly,
Local {
c=IN IP4 $ RTP
m=audio $ RTP/AVP 96 termination
a=rtpmap:96 AMR
Remote {
c=IN IP4
m=audio 3000 RTP/AVP 96
a=rtpmap:96 AMR


. 108
( 132 .)