dSIPRouter and Twilio Elastic Trunking Integration

We have made it super simple to connect dSIPRouter to Twilio Elastic SIP Trunking (ESIPT). The main component that makes this happen is the new CarrierGroup API. This API allows you to programmatically add carriers to dSIPRouter. This API follows the same format as our other dSIPRouter API. In this article, I will explain how to connect to Twilio ESIPT from the dSIPRouter UI and explain how to use the underlying API.

Installing dSIPRouter

The best way to install dSIPRouter is to use the one line installation commands which can be found here or use Terraform to deploy.

Get Twilio Credentials

You can obtain Twilio credentials from the Twilio Console
  1. Create a Twilio account or login to the Twilio Console if you have an existing account.
  2. Save the Account SID and Auth Token from the Twilio Console somewhere safe. You will need them to later

Create Carrier Group for Twilio

Now that dSIPRouter is installed let’s login and create a Carrier Group. This will allow you to setup a SIP connection between dSIPRouter and Twilio.
  1. Click Carrier Groups
  2. Click Add
  3. You will need to enter a name for the Carrier Group, select Twilio from the Plugin, enter in the Twilio Account SID and Account Token that we saved in the last section.
  4. Click Add
This will trigger an API to Twilio Elastic SIP Trunking that will create an Elastic SIP Trunk which can be seen in the Twilio Console.

Setup Default Outbound Route

Now make your new Twilio Carrier Group the default outbound route
  1. Click “Outbound Routes”
  2. Select the first rule and change the route to the MackTwilioCarrierGroup
  3. Click Update
  4. Click “Reload Kamailio” in the upper right of the UI

Testing: Setup an Endpoint Group

We can now test a call by creating an End Point Group using IP Auth or Username/Password Auth. I will use IP Auth
  1. Click Endpoint Groups
  2. Click Add
  3. Click Endpoints Tab
  4. Add your IP address and click Save
  5. Click Add
  6. Click “Reload Kamailio” in the upper right of the UI

Testing: Place a Call

We are going to use Zoiper to place a test call
  1. Start Zoiper
  2. Add Account
  3. Just add a Domain and Username. Note, the username is the Caller ID that will be sent when you place a test call. Note, Twilio will only send calls to validated numbers on the account when your account is in Trial mode.
  4. Place a call. Make sure the number is e.164 format, which looks like this +19544242424

Build dSIPRouter Using Terraform

Introduction

The purpose of this article is to show you how to automate the deployment of dSIPRouter using HashiCorp Terraform.  We ship a Terraform script with dSIPRouter because we do all of our development and testing against Digital Ocean.  Also, we wanted to provide you with an example of how you could implement this for other cloud providers since Terraform has providers for all of the major public clouds and on-premise environments as well.

Assumptions

  • You have a Digital Ocean API Key
  • You have a SSH Key Pair uploaded to Digital Ocean and you know it’s name

Download Terraform and Setup Environment

For congruency, we will be doing this from Windows, but doing so from Linux should be similar.  Please download the following packages (uniformity between OS’s):
  • GitBash – https://git-scm.com/download/win
  • Terraform – https://www.terraform.io/downloads
You will need to place your terraform.exe or executable in C:\Windows\System32 or /usr/local/bin or /usr/sbin, or adjust your windows host system environment variables to the download location of terraform.exe. To do so do the following: Right click This PC(MyComputer)
—>properties 
—>advanced system settings
—>environment variables
—>system variables
—>path–edit–>new

Get Repository and Setup Terraform Variables

Open a terminal window / command prompt and type the following:
export DIGITALOCEAN_TOKEN=<Digital Ocean token key>
git clone https://github.com/dOpensource/dsiprouter
cd dsiprouter/resources/terraform/do
copy terraform.tfvars.sample terraform.tfvars
terraform init
This will install the Digital Ocean provider since our terraform script is configured to work with Digital Ocean. Edit the terraform.tfvars file, which sets the values of variables needed by the terraform script.
pvt_key_path="C:/Users/alems/Working/andrew" (adjust using path format, andrew is actually the pvt key)
dsiprouter_prefix="dev"
number_of_environments=1
pub_key_name="andrew"
Once modified, you should have all you need to deploy an instance via Terraform.

Build dSIPRouter Using Terraform

Execute the following commands to build dSIPRouter from the master branch using terraform:
terraform apply
If you want to build from another branch you would pass in the branch variable with the value of the branch like this
terraform apply -var branch=v0.643
This is what it will look like as it starts to build: This is what it will look like after it’s completed: You will now be able to login to dSIPRouter using the credentials generated.

Login to dSIPRouter

You can login to dSIPRouter using the dSIPRouter WEB GUI URL and the dSIPRouter GUI Username and dSIPRouter GUI Password generated by the installer.  Enjoy!