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.
Go to your Programmable Voice Dashboard.
Click BYOC Trunks on the left.
Create a New Trunk.
Click the blue + sign, then enter a trunk name, i.e. thinq-yourcompanyname then click create BYOC 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 18.104.22.168 / 32, with a friendly name of thinq-inbound-1 then click Create ACL.
After you click Create ACL, you’ll be taken to the configuration page for the newly created ACL.
Add the second IP address 22.214.171.124 / 32 to the IP Address Ranges section.
Give it a friendly name of thinq-inbound-2 or similar.
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.
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.
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-mycompany.sip.twilio.com
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.
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.
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.
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.
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.
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.
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.
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.