Top

Basic Concepts

Logical Statements

Logical statements can be used in the configuration associated with a unit in the Virtuo EMS.

Logical statements can be used by Virtuo to return a custom configuration based on the values of the current unit configuration. When a unit requests a configuration from the Virtuo EMS, the logical statements included in the configuration are evaluated first. The Virtuo EMS then returns the resulting configuration to the unit without the logical statements.

Supported Statements Description
%if [condition to evaluate] A logical statement block always starts with %if
%elseif [condition to evaluate] After the %if, there be can 0 or more %elseif
%else After the %if and the %elseif, there can be 0 or 1 %else
%endif A logical statement block always ends with %endif
Supported Operators Description
== equal
!= not equal
=~ contains
!~ does not contain
> greater than
>= greater than or equal
< smaller than
<= smaller than or equal

If a configuration contains a syntax error, the Virtuo EMS will not return the configuration to the units and a log will be generated. If a unit requests a configuration , and the configuration contains a syntax error, the unit will receive an empty configuration and the '404 Parsing error' HTTP error message.

Supported Conditions Description
unit.firmware.version

Compares the unit firmware version.

Supports these two formats. For more details refer to the DGW Software Numbering Convention document published on the Media5 Documentation Portal.

  • 2.0.MAJOR.BUILD (old format)
  • MAJOR.MINOR.BUILD (new format)

For example:

  • 2.0.42.768 (latest version in the old format)
  • 42.1.857 (first version in the new format)
  • 45.3.1971-526-g2328c6252 (engineering version)
unit.license_key

Compares the unit license key.

Most often used to check first if defined.

unit.mac_address

unit.serial_number

unit.uuid

Compares the unit identifiers.

Note: The unit.uuid is valid only for the Sentinel CS series.

unit.product.family

Compares the unit product family. Possible values are:

  • Mediatrix 3000 Series
  • Mediatrix 4100 Series (4102)
  • Mediatrix 4100 Series (4108/4116/4124)
  • Mediatrix 4400 Series
  • Mediatrix C7 Series
  • Mediatrix G7 Series
  • Mediatrix S7 Series
  • Sentinel 100
  • Sentinel 400
  • Sentinel CS
unit.user_agent

Compares the content of the unit User-Agent header.

Most often used against the "=~" operator (also known as the "contains" operator).


Top

Syntax Errors in Virtuo Configuration

When editing a configuration with logical statements, the syntax of the statements is verified when saving the configuration.

If there is a syntax error in the configuration, it is saved but an error is displayed. Furthermore, the Virtuo EMS will not return the configuration to the units. If a unit requests a configuration, and this configuration contains a syntax error, the unit receives an empty configuration and the '404 Parsing error' HTTP error. A log is also generated when a syntax error is present in the configuration.


Top

Basic Tasks

Editing a Configuration with Logical Statements

Context
Steps
  1. In Virtuo EMS, click Configuration.
  2. From the Configuration page, click the located on the same line as the configuration to edit.
  3. Edit the configuration directly in the script field.
  4. Click Save.
Result

When editing a configuration with logical statements, the syntax of the statements is verified upon saving. If there is a syntax error, the configuration is still saved but an error will be displayed.


Top

Examples

Multiple Firmware Upgrade Before Provisioning

%if unit.firmware.version < 2.0.38
    # Trigger intermediate firmware upgrade using uncompressed .ZIP files.
    ...
%elseif unit.firmware.version != 45.3.1971
    # Ensure all units are on DGW version 45.3.1971.
    Fpu.MfpUrl = "URL to the .bin firmware file"
    Fpu.AutomaticRestartEnable = "Enable"
    # Launch firmware upgrade
    Fpu.Install
%else
    # Provision only when units are on firmware 45.3.1971
    SipEp.DefaultStaticRegistrarServerHost = "my_registar_fqdn"
    SipEp.DefaultStaticProxyHomeDomainHost = "my_proxy_ip_address"
    ...
%endif

The above configuration group in Virtuo would have the following behavior for units contacting Virtuo:

Unit Firmware Version Examples Returned Configuration
Dgw 2.0.32.599

# Trigger intermediate firmware upgrade using uncompressed .ZIP files.

...

Dgw 2.0.40.761

Dgw 42.1.857

Dgw 46.0.1234

# Ensure all units are on DGW version 45.3.1971.

Fpu.MfpUrl = "URL to the .bin firmware file"

Fpu.AutomaticRestartEnable = "Enable"

# Launch firmware upgrade

Fpu.Install

Dgw 45.3.1971

Dgw 45.3.1971-526-g2328c6252

# Provision only when units are on firmware 45.3.1971

SipEp.DefaultStaticRegistrarServerHost = "my_registar_fqdn"

SipEp.DefaultStaticProxyHomeDomainHost = "my_proxy_ip_address"


Top

Different Provisioning Per Unit Model

# Provision external scripts, depending on the User-Agent header.
%if unit.user_agent =~ "Mediatrix C711"
    Conf.ScriptsTransferAndRun GenericFileName="c711.cfg" ...
%elseif unit.user_agent =~ "Mediatrix C731"
    Conf.ScriptsTransferAndRun GenericFileName="c731.cfg" ...
%endif

Note that the above configuration uses the "=~" comparison operator, instead of the usual "==" operator. This is needed since the User-Agent header contains a lot of information, and it is often desirable to check against a subset of the whole header.

Examples of User-Agent header content:

  • Mediatrix 4102S/v48.0.2359-242-g6c0c355f2 4102-MX-D2000-449
  • Mediatrix C731/v48.4.2631 CXXX-MX-D2000-370
  • Mediatrix Sentinel 100 - 2 PRI 4 BRI 8 FXS 4 FXO/v48.4.2631 S100-MX-D2000-338
  • Mediatrix Sentinel/v48.4.2631 STNL-MX-D2000-492

Top
Top

Copyright Notice

Copyright © 2023 Media5 Corporation.

This document contains information that is proprietary to Media5 Corporation.

Media5 Corporation reserves all rights to this document as well as to the Intellectual Property of the document and the technology and know-how that it includes and represents.

This publication cannot be reproduced, neither in whole nor in part, in any form whatsoever, without written prior approval by Media5 Corporation.

Media5 Corporation reserves the right to revise this publication and make changes at any time and without the obligation to notify any person and/or entity of such revisions and/or changes.