How to Augment Twilio with Commio’s Bring Your Own Voice Carrier (BYOC) Trunks

Evin Hunt

Twilio can be easily enhanced with a minimum of development effort to augment your inbound voice with Commio’s Bring Your Own Carrier BYOC Trunks solution.

After following these directions, inbound voice calls to your thinQ by Commio phone numbers (DIDs) will route to Twilio, and outbound calls initiated from Twilio will route through your thinQ outbound voice profile. Following these steps will also eliminate the need for hardcoding a SIP URI to route outbound calls initiated from your application to thinQ, meaning no changes will be needed inside your application’s code.

First, login to Twilio and your thinQ io accounts, as we’ll move between both portals throughout these instructions.

In Twilio:
Go to your Programmable Voice Dashboard.
Click BYOC Trunks on the left.

Twilio BYOC Trunks

Create a New Trunk.

Click the blue + sign, then enter a trunk name, i.e. thinq-yourcompanyname then click create BYOC Trunk.

Create Twilio Trunk

Configuring Twilio for thinQ Phone Numbers (DIDs)

Next, we’ll create an IP Access Control List for thinQ origination IP addresses.

Click IP Access Control Lists, then click the blue + sign.

In the pop-up, name it “thinq-numbers” and the first IP address / 32, with a friendly name of thinq-inbound-1 then click Create ACL.

IP access control list

After you click Create ACL, you’ll be taken to the configuration page for the newly created ACL.

Add the second IP address / 32 to the IP Address Ranges section.

Give it a friendly name of thinq-inbound-2 or similar.

thinQ numbers Twilio IP address ranges

Create a Termination SIP Domain

Termination SIP domains are for sending inbound calls from the carrier – your thinQ phone Numbers (DIDs) – to Twilio. This allows you to take action via your Twilio application on incoming calls to your thinQ phone numbers.

Twilio Call Termination SIP Domains

You will be taken to a New Termination SIP Domain configuration page. Configure a Friendly Name to easily identify your domain, suggested thinQ and your company name.

Configure a SIP Domain Name to uniquely identify your SIP URI for the domain, this is like an actual domain name, so it must be unique – suggested thinq-yourcompanyname – this URI may be used to direct SIP traffic towards Twilio Programmable Voice.

In the Authentication section of the page, select the IP Access Control list thinq-numbers (that you created previously) from the dropdown.

In the Call Control Configuration section of the page, select your BYOC trunk you created previously from the BYOC TRUNK dropdown.

Scroll to the bottom of the page and click Save.

New Termination SIP Domain Twilio

Create an Inbound Routing Profile at thinQ

In thinQ io from the menu select Inbound, then Routing Profiles, then Inbound Profiles.

Click to Add a new profile, and in the pop-up, configure the Name – suggested: Twilio-YourCompanyName or just Twilio.

NOTE: You may want to create multiple SIP Domains on Twilio for different applications, which you would create more routing profiles for, so just make sure it’s descriptive so you recognize what it’s for on Twilio.

Select DNS A for Type, and enter the TERMINATION SIP URI from your Twilio Termination SIP Domains page under BYOC Trunks in your Twilio Programmable Voice page. See the Create a Termination SIP Domain above.

NOTE: Leave the “sip:” prefix off of the URI, it should just be the hostname, i.e.

thinQ Add Routing Profile Twilio

Configuring Twilio for thinQ Least Cost Routing (LCR)

First, let’s create a Twilio Connect trunk. In thinQ io navigate to Outbound, Trunks, then click Add New.

Add New Trunk for Twilio Inside

On the New Trunk configuration page, give it a friendly name, then choose the Profile you wish to associate your trunk with. Drop down the Select Trunk Type, and select Connect.

thinQ Create Outbound Trunk Twilio

Select Twilio from the options, then click Save.

You will next see an “Edit Trunk” page. Note the Token and Account ID information, you will use this to configure the SIP URI to configure in Twilio’s portal. This is required for routing outbound calls from Twilio through thinQ. Copy and paste these values into a text editor or notepad.

thinQ Trunk Token Account ID Twilio

Creating an Origination Connection Policy on Twilio

An Origination Connection Policy is the configuration that instructs where Twilio should send outbound calls FROM Twilio, i.e. a verb in your application would contain a phone number to set up an outbound call to. This would typically route outbound from Twilio to that phone number using Twilio’s rates. With this configuration, it will now route through your thinQ LCR profile using thinQ rates.

In your Programmable Voice Dashboard on Twilio, go to BYOC Trunks, then select Origination Connection Policy, then click the plus sign to add a new policy. Give it a Friendly Name in the pop-up and click Create.

Origination Connection Policy Twilio

After clicking Create, you will be taken to the Origination Connection Policy list. Click on your newly created policy to open the configuration page.

On the Origination Connection Policy page, click on the Add new Origination Target page, and in the pop up, enter the following SIP URI in the ORIGINATION SIP URI field, then click Create.

Replace YOUR_ACCOUNT_ID and YOUR_ACCOUNT_TOKEN with the values you gathered from the Creating a Twilio Connect Trunk section.


Origination Target Twilio thinQ

Assigning the Origination Connection Policy to your BYOC Trunks

Click on Trunks under BYOC Trunks and select your thinQ trunk.

From the General Settings page of your trunk, go to the Origination Connection Policy (to your Carrier) section and choose the newly created Origination Connection Policy from the dropdown. Click Save.

Twilio Origination Connection Policy

Configuring your Application to use the BYOC Trunks

On the same General Settings page for your BYOC Trunk, you can scroll towards the bottom and configure your Application settings for this trunk. This is your application webhook.

Twilio Application Webhook thinQ

Congratulations! Inbound voice calls to your thinQ by Commio numbers will now route to Twilio, and outbound calls initiated FROM Twilio will route through your thinQ profile.

Date posted: May 1, 2021

Topic: CPaaS   Inbound Voice   Outbound Voice   Voice API  

Tags: Twilio   Twilio bring your own carrier   Twilio Voice  

Evin Hunt

With a passion for emerging technology and innovation, Evin has created a career path that has given him a unique perspective and insight for bridging “over-the-top” innovation to traditional telecom services and helping to evolve the industry. In his personal time, Evin enjoys spending time with his three boys, playing guitar and drums, world travel, and attending live music events. Evin is also passionate about self-defense, holds three black belts, and in 2007 was inducted into the U.S. Martial Arts Hall of Fame as Kyusho Jitsu instructor of the year.

Recent posts from Evin Hunt

Get the latest from Commio

We’ll send you one email a month featuring our latest blog content.