VonyxDocs

FreeSWITCH

Add Vonyx as a gateway on the FreeSWITCH external profile.

View this page as Markdown

Add Vonyx as a Sofia gateway on the external profile. You get outbound calls on your Vonyx numbers, and inbound calls into the public dialplan.

Before you start

  • A Vonyx SIP trunk with a number attached
  • FreeSWITCH with the default (vanilla) config, where the external profile listens on port 5080
  • A public IP or hostname for FreeSWITCH, with UDP 5080 and your RTP range open to 43.204.9.41

Outbound calls

Create the gateway

conf/sip_profiles/external/vonyx.xml
<include>
  <gateway name="vonyx">
    <param name="proxy" value="43.204.9.41:5060"/>
    <param name="realm" value="43.204.9.41"/>
    <param name="username" value="your_trunk_username"/>
    <param name="password" value="your_trunk_password"/>
    <param name="register" value="false"/>
    <param name="caller-id-in-from" value="true"/>
  </gateway>
</include>

register is false: Vonyx checks credentials on each call and doesn't need FreeSWITCH to register. caller-id-in-from puts the caller ID in the From header.

Use G.711

Vonyx supports PCMU and PCMA only. The external profile reads its codec lists from these variables. Change the existing lines:

conf/vars.xml
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA"/>

These variables are shared with the internal profile. To change only the Vonyx side, set inbound-codec-prefs and outbound-codec-prefs to PCMU,PCMA in sip_profiles/external.xml instead.

Set NAT if FreeSWITCH is behind a router

The external profile uses ext-rtp-ip and ext-sip-ip, which default to $${external_rtp_ip} and $${external_sip_ip} (found by STUN). Behind NAT, set them to your public IP:

conf/vars.xml
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=203.0.113.10"/>
<X-PRE-PROCESS cmd="set" data="external_sip_ip=203.0.113.10"/>

Replace the existing stun-set lines for these two variables. Forward UDP 5080 and your RTP range to FreeSWITCH, and turn off SIP ALG on the router.

Set the RTP port range

Vonyx sends RTP from UDP 10000–20000. Your own range must be open to 43.204.9.41. It is set in switch.conf.xml:

conf/autoload_configs/switch.conf.xml
<param name="rtp-start-port" value="16384"/>
<param name="rtp-end-port" value="32768"/>

These are the defaults shown in the sample config. Change them to match your firewall.

Add an outbound route

Caller ID must be one of your Vonyx numbers.

conf/dialplan/default/01_vonyx.xml
<include>
  <extension name="vonyx_out">
    <condition field="destination_number" expression="^(91\d{10})$">
      <action application="set" data="effective_caller_id_number=91XXXXXXXXXX"/>
      <action application="bridge" data="sofia/gateway/vonyx/$1"/>
    </condition>
  </extension>
</include>

Inbound calls

Route the number in the public dialplan

The external profile sends calls to the public context and doesn't ask callers to authenticate. Map your Vonyx number to an extension:

conf/dialplan/public/01_vonyx.xml
<include>
  <extension name="vonyx_in">
    <condition field="destination_number" expression="^(91XXXXXXXXXX)$">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="transfer" data="1000 XML default"/>
    </condition>
  </extension>
</include>

Because port 5080 accepts calls without auth, allow only 43.204.9.41 (and your other carriers) to reach it in your firewall.

Point Vonyx at FreeSWITCH

In the Vonyx console, open the trunk, turn on Inbound calls, and set Inbound address to your FreeSWITCH host with the external port, for example fs.example.com:5080. See Inbound calls.

Test the connection

Changes to vars.xml and the profile need the profile restarted. A new gateway file only needs a rescan.

fs_cli -x "reloadxml"
fs_cli -x "sofia profile external restart"
fs_cli -x "sofia status gateway vonyx"
fs_cli -x "originate {origination_caller_id_number=91XXXXXXXXXX}sofia/gateway/vonyx/91XXXXXXXXXX &echo"

origination_caller_id_number must be your Vonyx number. The callee hears their own voice echoed back. Then call your Vonyx number from a mobile and check it reaches extension 1000. Use sofia global siptrace on to see the SIP messages.

Limitations

  • DTMF and call transfer are not available on Vonyx yet. Don't rely on IVR key presses or deflect / REFER on Vonyx calls.
  • New accounts make 1 call at a time (raise limits).
  • No TLS or SRTP: use UDP or TCP on port 5060 towards Vonyx.

Troubleshooting

ProblemFix
401 or 407 that never succeedsCheck username and password in the gateway.
429 after auth succeedsThe caller ID isn't one of your Vonyx numbers.
INCOMPATIBLE_DESTINATION / 488Limit the codec lists to PCMU,PCMA.
Inbound calls hit the wrong extension or failCheck the public dialplan matches the number as Vonyx sends it, and that the inbound address uses port 5080.
One-way or no audioSet external_rtp_ip / external_sip_ip behind NAT, and open your RTP range to 43.204.9.41.

More in SIP troubleshooting.

On this page