Configuring a Twilio SIP trunk for use with Pexip's "Bring your own carrier"
To use Pexip's "Bring your own carrier" (BYOC) you need to choose a telephony carrier and set up a SIP trunk that can receive calls from your Pexip-registered video endpoints and deliver them to PSTN.
This guide helps you set up a SIP trunk on Twilio. It also helps you gather the information you need to give your partner so that they can complete the necessary configuration in Pexip.
For general information about how BYOC works and what it involves, see Pexip's "Bring your own carrier" — using your VTC system to dial out to PSTN.
For help choosing how many phone numbers to buy, see Choosing phone numbers to use with Pexip's BYOC.
Prerequisites
Before creating your SIP trunk in Twilio, first you need:
- A Twilio account.
-
A Twilio phone number in the region/country you would like calls to be dialed out from. If you don't already have a suitable number, you can get one from Twilio by going to the
menu, and then selecting > .We recommend setting up a number that is dedicated to outbound calls only to avoid any potential confusion over missed incoming calls and where they originated.
Overview
As soon as you have bought a phone number, you are ready to start configuring your SIP trunk which includes creating:
- An Elastic SIP trunk.
- An IP Access Control List containing all the IP address ranges that may be used to deliver a call from the Pexip Service to Twilio.
- A Credentials List with a username and password that the Pexip Service can use to authenticate itself to Twilio.
- A Termination URI so that the Pexip Service knows where to send the call (linked to the IP Access Control List and Credentials List).
- An association between the Elastic SIP trunk and the number you purchased.
When these steps are complete, your Twilio SIP trunk is ready and you have the information you need to give to your partner.
Setting up a SIP trunk in Twilio
The following instructions show an example configuration. Using settings other than the ones shown may also work but we recommend testing.
Creating the Elastic SIP trunk
- From the menu select and you see your dashboard.
- From the top of the Trunks section, select the button to create a new trunk. You see a screen where you can configure your trunk.
-
Enter a friendly name for your SIP trunk. In our example, we enter Pexip Example Outbound. The settings below have been tested with the Pexip Service.
- Save your changes and the page refreshes.
Using encryption
You can use encryption by setting Secure trunking to Enabled, however, you also need to ensure your video endpoint is configured with the right encryption settings. With secure trunking enabled, Twilio currently only accepts SIP INVITE messages with m=audio lines containing RTP/SAVP: m=audio nnnnn RTP/SAVP.
For Cisco video conferencing systems, the default setting Encryption:Best effort doesn't work with Twilio. However, if it's acceptable to use encryption for all calls made using your Cisco video endpoint, you can set Encryption to On.
Creating an access control list
You need to create an IP Access Control List that covers all the Pexip Service IP addresses that may be used to handle your outbound calls from the Pexip Service to your Twilio SIP trunk. Calls from IP addresses that are not safelisted are declined.
Pexip's firewall page provides a table of subnets that you need to add into your Access Control List. This is quick and easy to do as you can enter IP address ranges using CIDR notation.
For the list of Pexip Service subnets to add:
- Go to https://pexip.me/test/firewall.
- Scroll down to the section with the header:
Creating the access control list in Twilio
- Select > and then select .
- Click on the button and you see a page where you enter a friendly name for the list itself, and then enter the first IP address entry.
-
Select
to save the list. Then use the button to add the remaining IP addresses.In our example, we create Pexip Example Access Control List and each IP address entry has the friendly name indicating the subnet region e.g. global-subnet1.
Do not use the IP addresses in the screenshot as they may change. Instead use the information on the Pexip firewall page: https://pexip.me/test/firewall.
Creating a set of credentials for the Pexip Service
You need to create a set of credentials that the Pexip Service uses to authenticate itself when dialing out to your unique SIP URI on Twilio (the SIP URI itself is defined in the next step).
- From the menu, select and then .
-
Add a new set of credentials.
- Give the credentials set a friendly name, and enter a new username and password.
- Save your changes and you see your new credentials set listed.
In our example, we create a credentials set called Pexip Example Credentials with username pexipexampleuser.
Creating a Termination URI for your SIP trunk
To complete your SIP trunk configuration, you need to define a unique Termination SIP URI which the Pexip Service uses to call your Twilio SIP trunk. You also need to link the Termination URI with the previously created access control list and credentials list so that Twilio can authenticate calls that come into your Termination SIP URI.
- From Elastic SIP Trunking go into your new SIP trunk and then go to .
-
In the
box, you need to enter a unique SIP URI domain prefix which is a value you choose.Just enter the string that you would like to use, then click elsewhere on the page. An
or
indicator appears.
Then, in the Authentication section, select your IP Access Control List and your Credentials List to tie everything together.
In our example, we enter pexip-example for the SIP URI domain prefix, giving the Termination URI: pexip-example.pstn.twilio.com, and we select Pexip Example Access Control List and Pexip Example Credentials for authentication.
- Save your changes.
Linking your SIP Trunk configuration to your number
The last step is to associate the number you purchased to your SIP Trunk.
- Go into your SIP trunk, and then go to .
-
Click on
, select the checkbox for the number you want to add, and then click on .
You have now completed the necessary configuration on the Twilio side.
Providing the information required to complete the BYOC configuration
The next step is to contact your partner and provide them with your SIP trunk information so that they can complete the BYOC configuration on the Pexip side. They need to configure Twilio as a Proxy and one or more for routing the calls, both of which are done within Pexip.
Your partner can also give more guidance on how many rules to have and what prefixes to define. (If live rules are already in use, we recommend testing using a prefix that is unlike any of your existing rules' prefixes so that you can keep your test and live implementations separate.)
For help understanding more about Rules and what prefixes to have, see: Defining prefixes to use with Pexip's BYOC.
Information required to configure the Proxy (within Pexip)
This table shows the information required for the proxy and what it relates to in Twilio.
Information required for BYOC configuration | Where it comes from in Twilio |
---|---|
Primary proxy address |
Relates to the Termination SIP URI in Twilio. You need to provide the full Termination SIP URI including the Twilio domain. In our example, we entered pexip-example as the domain prefix giving the full Termination SIP URI: pexip-example.pstn.twilio.com. |
Backup proxy address | As a backup address, you can choose from the list of localized domains provided by Twilio. See https://www.twilio.com/docs/global-infrastructure/localized-uris/termination. |
SIP username | Relates to Credential username in Twilio. In the example above, we used pexipexampleuser. |
SIP password | This is the associated password that you set. |
Information required to configure the Rules (within Pexip)
This table shows the information required for the rules and what it relates to in Twilio.
Information required for BYOC configuration | Where it comes from in Twilio |
---|---|
Caller id | This is the Number you associated with your SIP trunk configuration in Twilio. You need to provide the number in E. 164 format. In our example, we used 44239n nnnnnn. |