Zentrunk & Freeswitch - Regular Trunking
Overview
This documentaion provides a basic configuration to get FreeSwitch up and running with Plivo as the external SIP gateway. This documentation was written using a Debian Jessie GNU/Linux System running FreeSwitch 1.6.6.
To get started with Zentrunk using FreeSwitch you would need to do the following:
- Install FreeSwitch on your environment.
- Create a Trunk on Zentrunk using Plivo Console.
- Configure an Outbound Trunk.
- Configure the Inbound Trunk.
Installation of Freeswitch
On your Debian system, execute the following commands in the terminal:
- Update the Package Manager.
- Add the Public Key of FreeSwitch package to local Package Manager.
- Add the FreeSwitch repository URL to the source list of local Package Manager.
- Install the FreeSwitch package.
To install Freeswitch on CentOS, follow the instructions given here
To install Freeswitch on Windows, follow the instructions given here
Configuring an Outbound Trunk
To configure Freeswitch to connect to your Plivo Zentrunk, locate the root configuration of FreeSwitch on your machine. These locations vary from platform to platform.
- For Debian Jessie GNU/Linux System, the root configuration is present at /etc/freeswitch/.
- For Windows, the root configuration is located at C:\Program Files\FreeSWITCH\conf.
For Linux systems, it could be either of the following depending on your installation:
- /usr/local/freeswitch/conf
- /opt/freeswitch/conf
With the root configuration directory located, you must complete the following configurations:
- Create a new SIP Profile.
- Create a Dial Plan.
Step 1: Sip Profile
- Create a new file named “zentrunk.xml” at /etc/freeswitch/sip_profiles/external/.
- 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:
Step 2: Dialplan
Next, you should setup a Dial Plan to use the Plivo SIP Profile created in Step 1.
- 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”.
Step 3: Reload Configurations
- Load the fs_cli utility. Execute fs_cli in your terminal.
- Reload the dialplan. Execute reloadxml.
- 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, we recommend you change the default password.
Open vars.xml located at /etc/freeswitch/ and edit the following line:
This change is applicable to all users under /etc/freeswitch/directory/default/. If you want to change the password per user, then navigate to /etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice).
Execute reloadxml in fs_cli utility after making changes to users xml.
Note: Freeswitch has to be restarted if any changes were made to vars.xml.
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.
To know more about configuring X-lite for outbound calls, check the X-lite configuration guide
Configuring an Inbound Trunk
To configure the Freeswitch to connect to your Plivo inbound Zentrunk, first locate the root configuration of FreeSwitch on your machine. These locations vary from platform to platform.
- For Debian Jessie GNU/Linux System, the root configuration is present at /etc/freeswitch/.
- For Windows, the root configuration is located at C:\Program Files\FreeSWITCH\conf.
For Linux systems, it could be either of the following depending on your installation -
- /usr/local/freeswitch/conf
- /opt/freeswitch/conf
With the root configuration directory located, there are three major configurations that needs to done:
- Create a Dial Plan.
- Create a User
- Change access control list
Step 1: Dialplan
Create a new file named “03_zentrunk.xml” at /etc/freeswitch/dialplan/default/. If you already have a dialplan prefixed by 03, you can choose the another number. Use the XML Under the context =public
Values to be replaced:
Step 2: Access control list
Open the file acl.conf.xml at autoload_configs/acl.conf.xml. We will have to Whitelist Plivo outbound SIP IP found in zentrunk page.
Step 3: Create a User
Open the file found at freeswitch/directory/default/1000.xml Use the below XML as a reference to edit the user 1000.
Note: User ID & Authorization name will be `1000` and Value of Default password will be `1234`.
FreeSwitch instances have default users and SIP passwords preconfigured. To prevent being hacked, we recommend you change the default password.
Open vars.xml located at /etc/freeswitch/ and edit the following line:
This change is applicable to all users under /etc/freeswitch/directory/default/. If you want to change the password per user, navigate to /etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice).
Execute reloadxml in fs_cli utility after making changes to users xml.
Note: Freeswitch has to be restarted if any changes were made to `vars.xml`.
Step4: Reload Configurations
- Load the fs_cli utility. Execute fs_cli in your terminal.
- Reload the the changes made to the XML’s. Execute reloadxml.
- Reload the ACL file. Execute reloadacl.
- Reload the dialplan Execute Reload mod_dialplan_xml.
- Restart the service . Execute Service freeswitch restart.
Receive an inbound call
When the account is successfully enabled on X-Lite, it is ready to receive calls. Dial the number provided in the “your_destination_number$” field and the calls will first hit the Plivo inbound zentrunk and then go through your FreeSWITCH to reach your endpoint.
To know more about configuring X-lite for Inbound calls, check the X-lite configuration guide
Zentrunk & Freeswitch - Regular Trunking
Overview
This documentaion provides a basic configuration to get FreeSwitch up and running with Plivo as the external SIP gateway. This documentation was written using a Debian Jessie GNU/Linux System running FreeSwitch 1.6.6.
To get started with Zentrunk using FreeSwitch you would need to do the following:
- Install FreeSwitch on your environment.
- Create a Trunk on Zentrunk using Plivo Console.
- Configure an Outbound Trunk.
- Configure the Inbound Trunk.
Installation of Freeswitch
On your Debian system, execute the following commands in the terminal:
- Update the Package Manager.
- Add the Public Key of FreeSwitch package to local Package Manager.
- Add the FreeSwitch repository URL to the source list of local Package Manager.
- Install the FreeSwitch package.
To install Freeswitch on CentOS, follow the instructions given here
To install Freeswitch on Windows, follow the instructions given here
Configuring an Outbound Trunk
To configure Freeswitch to connect to your Plivo Zentrunk, locate the root configuration of FreeSwitch on your machine. These locations vary from platform to platform.
- For Debian Jessie GNU/Linux System, the root configuration is present at /etc/freeswitch/.
- For Windows, the root configuration is located at C:\Program Files\FreeSWITCH\conf.
For Linux systems, it could be either of the following depending on your installation:
- /usr/local/freeswitch/conf
- /opt/freeswitch/conf
With the root configuration directory located, you must complete the following configurations:
- Create a new SIP Profile.
- Create a Dial Plan.
Step 1: Sip Profile
- Create a new file named “zentrunk.xml” at /etc/freeswitch/sip_profiles/external/.
- 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:
Step 2: Dialplan
Next, you should setup a Dial Plan to use the Plivo SIP Profile created in Step 1.
- 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”.
Step 3: Reload Configurations
- Load the fs_cli utility. Execute fs_cli in your terminal.
- Reload the dialplan. Execute reloadxml.
- 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, we recommend you change the default password.
Open vars.xml located at /etc/freeswitch/ and edit the following line:
This change is applicable to all users under /etc/freeswitch/directory/default/. If you want to change the password per user, then navigate to /etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice).
Execute reloadxml in fs_cli utility after making changes to users xml.
Note: Freeswitch has to be restarted if any changes were made to vars.xml.
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.
To know more about configuring X-lite for outbound calls, check the X-lite configuration guide
Configuring an Inbound Trunk
To configure the Freeswitch to connect to your Plivo inbound Zentrunk, first locate the root configuration of FreeSwitch on your machine. These locations vary from platform to platform.
- For Debian Jessie GNU/Linux System, the root configuration is present at /etc/freeswitch/.
- For Windows, the root configuration is located at C:\Program Files\FreeSWITCH\conf.
For Linux systems, it could be either of the following depending on your installation -
- /usr/local/freeswitch/conf
- /opt/freeswitch/conf
With the root configuration directory located, there are three major configurations that needs to done:
- Create a Dial Plan.
- Create a User
- Change access control list
Step 1: Dialplan
Create a new file named “03_zentrunk.xml” at /etc/freeswitch/dialplan/default/. If you already have a dialplan prefixed by 03, you can choose the another number. Use the XML Under the context =public
Values to be replaced:
Step 2: Access control list
Open the file acl.conf.xml at autoload_configs/acl.conf.xml. We will have to Whitelist Plivo outbound SIP IP found in zentrunk page.
Step 3: Create a User
Open the file found at freeswitch/directory/default/1000.xml Use the below XML as a reference to edit the user 1000.
Note: User ID & Authorization name will be `1000` and Value of Default password will be `1234`.
FreeSwitch instances have default users and SIP passwords preconfigured. To prevent being hacked, we recommend you change the default password.
Open vars.xml located at /etc/freeswitch/ and edit the following line:
This change is applicable to all users under /etc/freeswitch/directory/default/. If you want to change the password per user, navigate to /etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice).
Execute reloadxml in fs_cli utility after making changes to users xml.
Note: Freeswitch has to be restarted if any changes were made to `vars.xml`.
Step4: Reload Configurations
- Load the fs_cli utility. Execute fs_cli in your terminal.
- Reload the the changes made to the XML’s. Execute reloadxml.
- Reload the ACL file. Execute reloadacl.
- Reload the dialplan Execute Reload mod_dialplan_xml.
- Restart the service . Execute Service freeswitch restart.
Receive an inbound call
When the account is successfully enabled on X-Lite, it is ready to receive calls. Dial the number provided in the “your_destination_number$” field and the calls will first hit the Plivo inbound zentrunk and then go through your FreeSWITCH to reach your endpoint.
To know more about configuring X-lite for Inbound calls, check the X-lite configuration guide
FreeSwitch using Secure Trunking for Outbound calling
Overview
This documentation provides configuration for secure and reliable data transfer between your SIP device and Zentrunk infrastructure. This documentation was written using a Debian 9 Stretch GNU/Linux system running FreeSwitch latest release version.
To get started with Zentrunk Secure Trunking using FreeSwitch you would need to do the following:
Installation of FreeSwitch
On your Debian 9 Stretch system, execute the following commands in the terminal:
- Update the Package Manager.
- Add the Public Key of FreeSwitch package to local Package Manager.
- Add the FreeSwitch repository URL to the source list of local Package Manager.
- Install the FreeSwitch package.
Configuring a Secure Outbound Trunk (TLS and SRTP)
To configure FreeSwitch to connect to your Plivo Secure Zentrunk, locate the root configuration of FreeSwitch on your machine. For Debian 9 Stretch GNU/Linux System, the root configuration is present at /etc/freeswitch/.
With the root configuration directory located at /etc/freeswitch/, you must complete the following configurations:
- Create a new SIP Profile.
- Create a Dial Plan.
Step 1: Creating a SIP Profile Gateway
- Create a new file named “zentrunk.xml” at /etc/freeswitch/sip_profiles/external/.
- In zentrunk.xml, create a new gateway with your Plivo Secure Zentrunk details (refer the below given images to get your Plivo Trunk details).
Termination SIP domain of your Plivo Outbound Trunk:
Create the AUTH GROUP Credentials:
Step 2: Dialplan
FreeSwitch creates a certain set of default dialplan xml files post installation which are not relevant for setup. Please ensure a SIP profile has been created before proceeding to create a dial plan.
- FreeSwitch creates a set of default xml configuration files during installation that we won’t need. We are removing them with the following commands:
- Replace the public dialplan /etc/freeswitch/dialplan/public.xml with the following xml:
Step 3 : Generate SSL Certificate
You could generate the certificate as described here
1 - Generate the CA (Root) Certificate
To use TLS/SSL you need at least two certificates: the root (CA) certificate and a certificate for every server. There is a script at
that helps generate these files. Assuming that the DNS name of your FreeSWITCH PBX is pbx.mydomain.tld, with
This will create CA certificate and key along with in /etc/freeswitch/tls/CA directory and certificate in the /etc/freeswitch/tls folder.
Note: The name given for -cn and -alt should be the same as the DNS name of your FreeSwitch installation and used as the registrar name on the phone (at least on Polycom devices). ] You can change the “DAYS=2190” line in the gentls_cert file to make the certificate valid for a longer time. However making it too long has some wrap around problem, it appears.
2 - Generate the Server Certificate
This creates the server certificate at /etc/freeswitch/tls/agent.pem. This file contains the certificate and the private key. It should contain the domain name in the common and alternate name. If you need to generate certificates for other servers use the -out flag for gentls_cert to specify the output certificate/key file name and copy this to the remote server.
In order for the new certificate to take effect (the only way for FreeSWITCH to use it), FreeSWITCH must be restarted.
Note: The name given for -cn and -alt should be the same as the DNS name of your FreeSwitch installation and used as the registrar name on the phone (required for Polycom devices and Eyebeam softphone).
Verify your certificate
You can review your certificate details with the following command:
FreeSwitch only requires the agent.pem file to act as a TLS server. It contains the certificate and the key).
Note: It is extremely important that your agent.pem (and optionally cafile.pem) have read permissions for the user FreeSwitch will run as.
For example, if you are starting FreeSwitch with the following option_ -u freeswitch,_ you have to give read permissions to the “freeswitch” user with the following command:
3 - Enable TLS
Step 4: Restart FreeSwitch
You have to restart FreeSwitch for the changes to take effect
To check freeswitch running status:
Test your setup
FreeSwitch instances have default users and SIP passwords preconfigured. To prevent any intrusion, we highly recommend you to change the default password.
Open vars.xml located at /etc/freeswitch/ and edit the following line:
This change is applicable for all users under /etc/freeswitch/directory/default/. If you want to change the password per user, then navigate to /etc/freeswitch/directory/default/ and edit 1000.xml (or any user of your choice).
Execute reloadxml in fs_cli utility after making changes to any user’s xml.
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 click on the call button. This call would go to your freeswitch server first, then through Plivo Secure Zentrunk and finally reach the destination number.
To know more about configuring X-lite for outbound calls, check the X-lite configuration guide