Skip to content

Media relay

With media relay the RTP of a call, the voice itself, passes through the switch instead of flowing directly between the caller and the vendor or the callee. It lets devices behind NAT hear and be heard, and it hides the addresses of your vendors and customers from each other. The price is bandwidth and CPU on the switch: every relayed call crosses its network twice. Media relay is decided per call from the settings of the account and the connection; the routing group chooses which relay is used.

Screen Field URL
Account form, Basic tab Media Relay Type /accounts.php
Connection form Use Media Relay, Preferred Media Relay /connections.php?i_vendor=<id>
Routing group form, Advanced Parameters tab Media Relay /routing_groups.php
SIP Features → SIP, Media tab Default Media Relay /system_parameters_sip.php
Screenshot "admin-panel/connection-media-relay" has not been generated yet — see scripts/screenshots/screens.yml.
Field Meaning
Media Relay Type (account), Use Media Relay (connection) When Necessary (default): relay when the caller is behind NAT. Always: relay every call. Never: do not relay on this side. Connections of other protocols than SIP have the field greyed out
Preferred Media Relay (connection) The relay this connection uses: Built-in RTPproxy or an external relay registered on your installation. Greyed out when Use Media Relay is Never
Media Relay (routing group) The relay for the group’s calls, or [ from Connection ] to use the Preferred Media Relay of the connection that takes the call
Default Media Relay (SIP settings) The relay preselected on new connections and new routing groups

The switch combines the setting of the account that placed the call with the setting of the connection that takes it:

Account Connection Result
Always any Relayed
any Always Relayed
Never Never Not relayed
When Necessary When Necessary or Never Relayed when the caller is behind NAT
Never When Necessary Relayed when the caller is behind NAT

In short: Always on either side wins, Never on both sides switches the relay off, and every other combination relays only NATed callers. The switch detects NAT when the address in the caller’s SIP messages differs from the address the packets come from.

For an on-net call to a registered device there is no connection: only Media Relay Type of the calling account counts, with When Necessary relaying NATed callers. When the callee’s incoming routing sends the call to a trunk, the calling account is combined with the connection of the trunk destination as in the table.

  • When the routing group of the caller has a relay in Media Relay, that relay is used.
  • When it has [ from Connection ], the Preferred Media Relay of the connection that takes the call is used.
  • For an on-net call to a registered device with [ from Connection ] there is no connection, and the Built-in RTPproxy is used.

Test Dialplan shows the relay of each routing entry in its Media Relay column. Tick Caller is behind NAT under More to see the result for a NATed caller. See Test Dialplan.

  1. Open SIP Features → SIP, go to Media and select Default Media Relay, so that new connections and routing groups get it.
  2. Keep Use Media Relay at When Necessary on vendor connections that have public addresses.
  3. Set Use Media Relay to Always on connections whose media must never reach the other side directly, for example a vendor that must not see your customers’ addresses.
  4. Set Media Relay Type to Always on accounts with devices that have audio problems behind a firewall or a SIP ALG.
  5. Run a test call in Test Dialplan and check the Media Relay column.