Zentrunk & Asterisk - Regular Trunking
Overview
Zentrunk is a SIP Trunking service from Plivo that allows you to connect with fixed and mobile phones in over 200 countries. Connect your cloud or on-premise communication infrastructure to Plivo’s Zentrunk SIP Trunking service to connect to your customers easily.This documentation provides a basic configuration to get Asterisk up and running with Plivo as the external SIP gateway.To get started with Zentrunk using Asterisk you would need to do the following:- Install Asterisk on your environment.
- Create a Trunk on Zentrunk using Plivo Console.
- Configure an Outbound Trunk.
- Configure the Inbound Trunk.
Installation of Asterisk
For installing Asterisk, follow the instructions below:-
For Debian systems execute the following commands in the terminal.
apt-get update
apt-get upgrade
apt-get install asterisk
- Follow the instructions given here to install Asterisk on CentOS.
- To install Asterisk on Windows, follow the instructions given here
Create a Trunk on Zentrunk
You can create a trunk using Plivo Console. For more information on creating a Trunk on Plivo Console, see below links:Configuring Asterisk for Outbound Trunk
To configure the asterisk to connect to your Plivo Zentrunk, locate the root configuration of Asterisk on your machine. These locations vary from platform to platform.In this case (Debian Jessie GNU/Linux System), the root configuration is present at /etc/asterisk/.With the root configuration directory located, there are two major configurations that need to do -- Create a new SIP Channel
- Create a Dial Plan.
- Reload the configuration
Step 1: SIP Channel
Create a new channel named “plivo-phone” at /etc/asterisk/sip.conf. This channel will be used in X-Lite to connect to asterisk. Also, create another channel called “plivo-trunk” which will connect to your Plivo Trunk.- Type=friend - Creates a user and peer connection
- Context=Zentrunk - Context is the identifier for a dialplan that will be loaded from extensions.conf. The sip.conf identifies and allows connections to the asterisk server. The context in the identifier allows the execution of call flow when a call is received from XLite.
- Host=dynamic - XLite can be connected from anywhere
- Secret=password1234 - Password to be used in X-Lite
- Type=peer - Creates a peer connection
- Context=Plivo - Context is the identifier for a dialplan that will be loaded from extensions.conf. The sip.conf identifies and allows connections to the asterisk server. The context in the identifier allows the execution of call flow when a call is received from XLite.
- Host=Termination SIP Domain of your Plivo Trunk
- Secret=Password for TestAuthGroup
- Username=Username for TestAuthGroup
Step 2: Dialplan
Next, you should set up a Dial Plan. A Dial Plan tells Asterisk what to do when a call has to be placed. The “Content” attribute in the SIP channel connects a channel with a dialplan. Add a dialplan named “Zentrunk” in extensions.conf under /etc/asterisk/directory.Step 3: Reload Configurations
- Load the asterisk client.
- Execute the following command in your terminal:
- Reload the sip channel, and then execute the following command:
- Reload the dialplan, and then execute the following command:
Configuring Asterisk for Inbound Trunk
To configure your asterisk to connect to your Plivo Zentrunk, locate the root configuration of Asterisk on your machine. These locations vary from platform to platform.In this case (Debian Jessie GNU/Linux System), the root configuration is present at /etc/asterisk/.With the root configuration directory located, there are three major configurations that you need to do -- Create a new SIP Channel
- Create a Dial Plan.
- Create a Sip Driver.
- Reload the configuration
Step 1: Create a new SIP Channel
Create a new channel named “6001” at /etc/asterisk/sip.conf. This channel will be used in X-Lite to connect to asterisk.Note: Use 6001 as your user in X-lite.
- Type=friend - Creates a user and peer connection .
- Context=incoming - Context is the identifier for a dialplan that will be loaded from extensions.conf. The sip.conf identifies and allows connections to the asterisk server. The context in the identifier allows the execution of call flow when a call is received from XLite.
- Host=dynamic - XLite can be connected from anywhere
- Secret=1234 - Password to be used in X-Lite
Step 2: Dialplan
Next, you should set up a Dial Plan. A Dial Plan tells Asterisk what to do when a call is received .The “Content” attribute in the SIP channel connects a channel with a dialplan. Add a dialplan named “incoming” in extensions.conf under /etc/asterisk/directory.Step 3: Create a SIP Driver
Create a new SIP driver named “6001” at /etc/asterisk/pjsip.conf with the below information.Note: Make sure that the secret in the sip.conf file and the password of pjsip.conf is the same.
Step 4: Reload Configurations
- Load the asterisk client.
- Execute the following command in your terminal:
- Reload the sip channel, and then execute the following command:
- Reload the dialplan, and then execute the following command: