Zentrunk & Freeswitch
This documentaion provides a basic configuration to get FreeSwitch up and running with Plivo as the external SIP gateway. This doumentation was written using a Debian Jessie GNU/Linux System running FreeSwitch 1.6.6.
Installation of Freeswitch
On your Debian system, execute the following commands in the terminal.
- Update the Package Manager.
$ apt-get update && apt-get install -y curl
- Add the Public Key of FreeSwitch packange to local Pacakage Manager.
$ curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
- Add the FreeSwitch repository URL to the source list of local Package Manager.
$ echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
- Install the FreeSwitch package.
$ apt-get update && apt-get install -y freeswitch-all freeswitch-all-dbg gdb
- To install Freeswitch on CentOS, follow the instructions given here
- To install Freeswitch on Windows, follow the instructions given here
Configuring your Freeswitch
To configure the Freeswitch to connect to your Plivo Zentrunk, first locate the root configuration of FreeSwitch on your machine.
These locations vary from platform to platform.
In this case (Debian Jessie GNU/Linux System), the root configuration is present at
For Windows, the root configuration is located at
For Linux systems, it could be either of the following depending on your installation -
With the root configuration directory located, there are two major configurations that needs to done -
- Create a new SIP Profile
- Create a Dial Plan.
Step1: Sip Profile
Create a new file named “zentrunk.xml” at
In zentrunk.xml, create a new gateway with your Plivo Zentrunk details (refer the below given images to get your Plivo Trunk details).
Termination SIP Domain of your Plivo Trunk :
TestAuthGroup Credentials :
Next, you should setup a Dial Plan to use the Plivo SIP Profile created in Step1.
Create a new file named “02_zentrunk.xml” at
/etc/freeswitch/dialplan/default/. If you already have a dialplan prefixed by 02, you can choose the another number.
The above dial plan has defined an extension for 11 digit US numbers like +1-(222)-(222)-2222. The
outbound_caller_id_number field is inherited from
vars.xml which would be set as the caller ID while making outbound calls. This extension is set to bridge to your SIP Profile “Plivo-outbound”.
Step3: Reload Configurtions
- Load the fs_cli utility. Execute
fs_cliin your terminal.
- Reload the dialplan. Execute
- Add the new SIP Profile, Execute
sofia profile external rescan
Test your setup
FreeSwitch instances have default users and SIP passwords preconfigured. To prevent being hacked, it is advised to change this default password.
vars.xml located at
/etc/freeswitch/ and edit the following line
<X-PRE-PROCESS cmd="set" data="default_password=set your password here"/>
This change is applicable to all users under
/etc/freeswitch/directory/default/. If you wish to change the password per user, then navigate to
/etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice)
<param name="password" value="set your password here"/>
reloadxml in fs_cli utility after making changes to users xml.
Note: Freeswitch has to be restarted if any changes were made to
Setting up your X-Lite
- Launch X-Lite and navigate to preferences. Click on the Accounts tab and hit the ‘+’ icon to add an account.
- Add the User ID (1000,1001 etc), Domain (IP address of your FreeSwitch machine), Password (password set in vars.xml), Display name (Any name) and Authorization name (same as your User ID).
Note: Field names may vary based on make and model of the SIP phone. All the configuration will remain in each case.
Click on OK when you’re done. Your endpoint entry in the list would be shown as Enabled. This indicates that your SIP phone has successfully registered with FreeSwitch.
Make an outbound call
When the account is successfully enabled on X-Lite, it is ready to make calls. Enter any valid 11 digit US number in your X-Lite and hit on the call button. This call would hit your freeswitch server first, then go through Plivo Zentrunk and finally reach the destination number.