Media Gate (mg)

Description

Media gateway that terminates media streams.
Controlled by the mgc role over the MEGACO protocol. Each media context is controlled by one of the roles: b2b, conf, ivr, esg.

Made redundant and scaled in Active-Active mode and additionally by distribution across mgc groups.

Starts and monitors the rtx_mg3 application process in the operating system, which actually performs media traffic processing.

Table 1. System characteristics

Code

mg

Operation mode

Service

Redundancy mode

Active-Active

Site types

Any

Layer

Business logic

Placement

Internal or border

State preservation and recovery on restart

No

Application

era_mg

Managed application

rtx_mg3

Limitations

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

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

  • For full cross-site system operation, all mg role instances must serve traffic on the network interfaces from which the corresponding addresses of all other mg and bgmg roles are reachable. Otherwise, cross-site calls may be impossible.

  • The throughput of network interfaces serving media traffic and connections to networks must match the possible peak load and codecs used. For example, 200 telephone conversations in PCMA (G.711 a-law) require at least 20 Mbit/s in each direction at the narrowest point. When serving more conversations and distributing them across different servers with media gateways, appropriate throughput must be ensured on the network devices aggregating the traffic.

  • Traffic always takes the shortest route: device A - media gateway - device B (at the logical level, excluding all intermediate network devices). But in some cases, devices A and B can be other media gateways serving conference and IVR media contexts. In a special case, when different subnets are interconnected at the border sg and esg roles, devices A and B can be media gateways of the bgmg role.

  • Operation on several interfaces is possible.

Parameters

Table 2. Parameters
Name Type Default Description

name

str

required

Name. May consist of Latin letters and digits and must start with a letter.

roletype

str

required

Role type. Possible values: "mg".

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.

limit_of_cores

int

empty

Limit on the number of CPU logical cores used. Default: 0 - unlimited.

logging_default_level

int

empty

Default logging level set specifically for the role instance (microservice type). More

allow_divergence

bool

false

Flag allowing parameter differences in roles of the same group. Default: false - not allowed.

roleid

int

required

Role identifier.
Unique across the entire system, regardless of site or server. Cannot be changed.
An integer from 1 to 9999.

separate

bool

required

Flag indicating whether the role is allocated to a separate node.

mgcgroup

int

0

MGC group to which the current mg belongs.
Matches the group parameter in roles of type mgc.

codecs

array<str>

empty

List of codecs used. Limits the codecs offered externally.
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.
See Codecs and media negotiation for SDP codec negotiation.

certdir

str

empty

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

keypass

str

empty

Password for decrypting the certificate private key file. Secret: ciphertext when read; the plaintext value is not returned via API and is decrypted by the service when used; a plaintext value can be supplied on input (Encryption and keys).

domgrecordcalls

bool

true

Flag for saving call recordings.

mgrecordcalls

str

empty

Alias of the server directory for placing call recordings. By default, the directory "/var/lib/era/files/records" is used

termportrange

str

"10000:20000"

Range of RTP ports that this role instance will use.
Format: "PortFrom:PortCnt", where PortFrom is the starting port and PortCnt is the number of ports.
If not set, the range "10000:20000" is used.

logrootpath

str

empty

Alias of the server directory for placing log files.
Default: "/var/lib/era/_workdir/<NODE_NAME>/log/mg".

logrtp

bool

false

Debug switch for logging RTP traffic receive and send operations.

logproto

bool

true

Switch for logging the MEGACO facade protocol.

logtrace

array<str>

[
"warning"
]

Logging level.

The value must be a list with one element.

Possible element values:
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 per day in MB. When the limit is reached, logging stops until files are deleted, including automatic deletion by time.

logpartsize

int

200

Maximum size of one log file in MB.

rtcpmonitor

bool

false

Switch for logging statistics based on RTCP packets.

recdumpinterval

int

5000

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

playcache

bool

true

Playback cache switch. The application-layer cache optimizes playback of reusable IVR files in parallel scripts. Savings come from disk access and transcoding.

playcachelimitsec

int

600

Limit on the idle time of a file in the cache. This is the time interval in seconds during which the file was not used in any process. Default: 600 seconds.

playcachelimitcount

int

500

Limit on the total number of files in the cache. When exceeded, the newest files, that is, recently opened ones, are deleted. Default: 500.

srtpsetuptimeoutms

int

3000

Timeout for establishing an SRTP media session. If the session is not established within the timeout, the dialog is terminated. This behavior excludes servicing a dialog in which subscribers cannot hear each other due to any failure in establishing the media session.

Configuration example

Configuration management is performed in an application available to master domain administrators. The application hides the full configuration content, but it is still available through the API.

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

Node example
{
  "name": "mg11",
  "roletype": "mg",

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

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

See also