Border Gate’s Media Gate (bgmg)

Description

Border media gateway that terminates media streams on external interfaces.
One side is always a port of the mg role controlled by the b2b role, and the other side is a subscriber device port (if the internal subscriber leg) or a provider port (external subscriber leg).
It can be reserved on one server in Active-Active mode with non-overlapping settings of several instances.
It starts and monitors the rtx_mg3 application process in the operating system, which actually performs media traffic processing.

Runs on the same server as the sg and/or esg role and under their control.
A border media gateway may be needed in several cases:
- If the system’s border outbound-proxy server (sg microservice) is located in several subnets, and there is a subnet from which subscribers connect and which is unreachable from other system servers running mg microservices.
- If the server serving connections to telephony providers (esg microservice) is located in several subnets such that a provider’s subnet is not propagated to other system servers.
- If a telephony provider requires subscriber addresses in SIP and SDP describing media sessions to match.
- If a telephony provider does not handle re-INVITEs (prohibits or ignores media session changes).

The border media gateway is used when interacting with a provider if:
- The provider account enables 'media' mode. Otherwise, the mode is not used even if other conditions are met.
- At least one bgmg microservice also runs on the server where the esg microservice serving this provider account runs. Otherwise, calls from/to providers with media enabled end with the server rejecting call processing. +

The border media gateway is used when interacting with internal subscribers if:
- at least one bgmg microservice runs on the server where the SG (outbound proxy) instance serving subscriber connections runs — this is a necessary condition;
- and also:
- either the 'bgmedia' mode in SG settings is set to "force" — a sufficient condition;
- or the 'bgmedia' mode in SG settings is set to "auto", the system is deployed on two or more servers, and proxying is performed between two different subnets (the subscriber device and the SIP server are in different subnets);
- or the 'bgmedia' mode in SG settings is set to "auto", the incoming call arrives at the main interface of the server that is marked in SIP-ALG settings as a gray address and is not proxied to another subnet.

Table 1. System characteristics

Code

bgmg

Operation mode

Service

Redundancy mode

Active-Active

Site types

Any

Layer

Business logic

Placement

Border

State preservation and recovery on restart

No

Application

era_mg

Managed application

rtx_mg3

Limitations

  • Must exist on all servers with several interfaces providing access to different subnets where sg and esg roles are present.

  • RTP port range settings must not overlap with other roles on the server.

  • Active use of the role reduces the potential throughput of SIP signaling traffic through the server.

  • 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.

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: "bgmg".

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).

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.

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.

domgrecordcalls

bool

true

Call recording storage flag.

mgrecordcalls

str

empty

Alias of the server directory for placing call recordings. Default directory: "/var/lib/era/files/records"

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": "bgmg1",
  "roletype": "bgmg",

  "roleid": 11301,
  "separate": true,
  "port": 2984,
  "mgcgroup": 3,
  "aliases": [
    {
      "key": "tgw1",
      "value": "eth0"
    }
  ],
  "termportranges": [
    {
      "key": "tgw1",
      "value": "30000:1000"
    }
  ],

  "codecs": ["PCMA", "PCMU"],
  "logtrace": [
    "error",
    "warning",
    "call",
    "flag3",
    "proto",
    "media-flow",
    "rtp-flow",
    "rtp"
  ]
}

See also