Set up Voice Termination with Twilio Bring Your Own Carrier (BYOC) Trunking Service
Overview
Using Zentrunk, Plivo’s SIP trunking platform, you can terminate calls from Twilio using Plivo as the carrier. This guide will help you to set up Plivo as a BYOC trunk on the Twilio platform, and whenever you terminate calls from Twilio using the BYOC trunk, Plivo will act as the carrier for those calls.
To implement this functionality, you must:
- Create a Plivo outbound trunk on the Plivo platform
- Create a Twilio BYOC trunk on the Twilio platform
Create a Plivo Outbound Trunk
You need to set up the trunk authentication on the Plivo Console to use Zentrunk to terminate calls. Authentication of your trunk ensures that Zentrunk only accepts traffic that your infrastructure sends securely. You can configure your trunk to be authenticated by an IP Access Control List, a Credentials List, or both. For more information, please check the step-by-step GIF & instructions below.
To create an Outbound Trunk:
- On the Outbound Trunks page in your Plivo Console, click “Create New Outbound Trunk”.
-
In the New Trunk window, enter a name for your trunk (for example, Twilio Termination).
Note: By default, the trunk is enabled.
- Under Trunk Authentication, to Create an IP Access Control List:
- Click ”+ Add New IP ACL”.
- In the ‘Create New IP Access Control List’ window, enter the name for your IP Access Control List (for example, Twilio IPs) and then provide the following IP addresses to be whitelisted in the IP Address List field.
- 54.244.51.0
- 54.244.51.1
- 54.244.51.2
- 54.244.51.3
Note: In the "IP Access Control List" you can specify the list of IP addresses from which the SIP Invite will be accepted for this trunk.
- Click “Create ACL” to save and add your IP Access Control List.
- Select the IP Group, and click “Create Trunk”. Your Outbound trunk will be created.
- Once the trunk is created, copy and store the Termination SIP Domain URI that ends with .zt.plivo.com. This will be useful while creating the BYOC trunk on the Twilio Platform in the next section.
Create a Twilio BYOC Trunk
You can follow the below GIF and instructions set to create a BYOC trunk on the Twilio platform and set up the Plivo Zentrunk which you created in the previous step as the BYOC trunk.
- On the BYOC Trunk page, click on the ”+” button to create a new trunk.
- Give a name for the trunk and click the “Create BYOC Trunk” button.
- In the “Origination Connection Policy (to your Carrier)” section, click on the ”+” button to create a new Origination Connection Policy
- Provide a name for the origination connection policy and click on the “create” button.
- Click on the ”+” button to create a new origination target and provide the previously copied Plivo’s Termination SIP Domain URI with “sip:’’ as a prefix.
- Click on the “Create” button to create a new Origination Target.
- Click on “Save” in the BYOC Trunks page to save the new create BYOC Trunk.
- Copy the BYOC Trunk SID.
Make an Outbound call using the BYOC Trunk
You can terminate calls via your BYOC trunk by using the below cURL code snippet.
curl 'https://api.twilio.com/2010-04-01/Accounts/{Your Account SID}/Calls.json' -X POST --data-urlencode 'To=your_destination_number'
--data-urlencode 'From=your_source_number' --data-urlencode 'Url={Your Twilio App URL}' --data-urlencode 'Byoc={your_BYOC_Trunk_SID}' -u
{Your Account SID}:{Your Auth Token}
Also, if you are interested in integrating your PBX/SBC with Plivo outbound trunks, you can click here to sign up for free and create your first SIP trunk today!