Media Gate (mg)

Description

A media gateway that closes media streams.
Managed by the mgc role via protocol MEGACO. Each media context is managed by one of the roles: b2b, conf, ivr, esg.

Redundant and scalable in Active-Active mode and additionally by group distribution mgc.

Organizes the startup and monitoring of the rtx_mg3 application process in the operating system that actually handles media traffic.

Table 1. System Characteristics

Code

mg

Mode of operation

Service

Backup mode

Active-Active

Types of sites

Any

Layer

Business logic

Placement

Internal or borderline

Saving and restoring state on reboot

No

appendix

era_mg

Managed application

rtx_mg3

Limitations

  • Must be present on all sites with b2b roles when used in media processing system (option "b2bmedia" in roles sg, esg, ivr, conf).

  • Port settings should not overlap with other roles on the server.

  • For full cross-site operation of the system, it is necessary that all instances of mg roles serve traffic on those network interfaces from which the same addresses of all other mg and bgmg roles are reachable. Otherwise, cross-site calls may not be possible.

  • The bandwidth of network interfaces serving media traffic and network connections must be matched to the possible peak load and the codecs used. For example, 200 telephone conversations in PCMA codec (G.711 a-law) require a bandwidth of at least 20 Mbit/s each way at the narrowest point. When serving more conversations and distributing them to different servers with media gateways, it is necessary to provide adequate bandwidth on the network devices that aggregate the traffic.

  • Traffic always follows the shortest route: device A - media gateway - device B (at the logical layer excluding all intermediate network devices). But in some cases, devices A and B may be other media gateways serving the media contexts of conferences and IVR. In a separate case, when interconnecting different subnets on the sg and esg border roles, media gateways can act as the A and B devices of a role bgmg.

  • It is possible to work on several interfaces, and the parameters `aliases` and `termportranges` are specified. Specifying a pair of parameters (`aliases`, `termportranges`) and a pair (`rtpiface`,`termportrange`) at the same time is prohibited.

Parameters

Table 2. Parameters
Name Type Default Description

name

str

required

Name. May consist of Latin letters and numbers, must begin with a letter.

roletype

str

required

Role Type. Possible values: "mg".

iface

str

required

The alias of the server network interface on which the roles will interact internally with each other.

ext

json

empty

Additional role options. Contains a json object or list.

enabled

bool

empty

Role activity flag. When set to false, the role does not participate in validation and is not started.

roleid

int

required

Role ID.
Unique for the entire system, regardless of the site or server. Cannot be changed.
Integer from 1 to 9999.

separate

bool

required

An indication that the role has been allocated to a separate node.

mgcgroup

int

0

The mgc group to which the current one belongs mg.
Matches the group parameter in roles with type mgc.

port

int

required

Local port TCP MEGACO.
Standard Port: 2944.

codecs

array<str>

empty

List of codecs in use. Restricts the use of externally issued codecs.
Possible values: "GSM", "PCMA", "PCMU", "G722", "G729", "G726-16", "G726-24", "G726-32", "G726-40", "opus", "speex", "G729a", "VP8", "VP9", "H264", "H263", "H263-1998", "H263-2000". Default: not set, all supported codecs are used.

certdir

str

empty

Alias of the directory on the server for storing certificates (server.crt and server.key).
If the path is not specified, the certificates are searched in the directory "/usr/lib/era/era_sip/priv/ssl"

keypass

str

empty

Password for decrypting the certificate’s secret key file.

domgrecordcalls

bool

true

An indication that call recordings have been saved.

mgrecordcalls

str

empty

The alias of the directory on the server to host the conversation recordings. By default, the directory is used: "/var/lib/era/files/records"

termportrange

str

empty

The range of RTP ports that this role instance will use.
Format: "PortFrom:PortCnt", where PortFrom is the initial port value, PortCnt is the number of ports.
If not specified, the range is used "10000:20000".

logrootpath

str

empty

Directory alias of a directory on the server to host log files.
Default: "/var/lib/era/_workdir/<NODE_NAME>/log/mg".

logtrace

array<str>

[
"warning"
]

Logging Level.

The value must be a list of one element.

Possible values of the element:
off, fatal, error, warning, info, debug, trace

In previous versions, the list could contain flags:

Possible values:
timer, call, events, proto, error, warning, trans, async, stream, fax, net, media-flow, rtp-flow, rtp, session, stat

logmaxsize

int

2000

Maximum total size of log files for one day, in MB. When the limit is reached, logging stops pending deletion, including automatic time-based deletion.

logpartsize

int

200

Maximum size of a single log file, in MB.

rtcpmonitor

bool

false

Packet-based statistics logging switch RTCP.

recdumpinterval

int

5000

Interval for dumping data from the cache to the original call recording file, in milliseconds.
Minimum value: 500.

Configuration example

The configuration is managed in an application available to master domain administrators. The application hides the full content of the configuration, but it is nevertheless accessible via the API.

The configuration contains a section to describe all instances of all roles. Parameters are defined for each specific role instance.

Example node
{
  "name": "mg11",
  "roletype": "mg",
  "iface": "eth0",

  "roleid": 11300,
  "separate": true,
  "port": 2945,
  "mgcgroup": 3,

  "codecs": ["PCMA", "PCMU"],
  "logpartsize": 10,
  "logtrace": [
    "warning"
  ],
  "mgrecordcalls": "alias://paths/b",
  "recdumpinterval": 3000,
  "rtcpmonitor": true,
  "termportrange": "10000:2000"
}

See also