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.


Before creating your SIP trunk in Twilio, you need:

  1. A Twilio account.
  2. 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 Explore Products menu, and then selecting Super Network > Phone Numbers.

    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.

Configuration overview

As soon as you have bought a phone number, you can 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

  1. From the Explore Products menu select Elastic SIP Trunking > Trunks.
  2. Select the option to Create new SIP Trunk. You see a screen where you can configure your trunk.
  3. 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.

  4. 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 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, see our firewall rules.

Creating the access control list in Twilio

  1. Select Elastic SIP Trunking > Manage and then select IP Access Control Lists.
  2. Click on the Create new Access Control List button and enter a friendly name for the list itself, and then enter the first IP address entry.

  3. Select Create new ACL to save the list. Then use the +Create new IP Address Range 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.

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).

  1. From the Elastic SIP Trunking menu, select Credential Lists.

    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 credential 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.

  1. From Elastic SIP Trunking go into your new SIP trunk and then go to Termination.
  2. In the Termination SIP URI 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.

  3. In the Authentication section, select your IP Access Control List, Credentials List to tie everything together.

    In our example, we enter pexip-example for the SIP URI domain prefix, giving the Termination URI: and select Pexip Example Access Control List and Pexip Example Credentials for authentication.

  4. 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.

  1. Go into your SIP trunk, and then go to Numbers.
  2. Click on Add an existing number, select the checkbox for the number you want to add, and then click on Add selected.

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 Rules 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:

Backup proxy address As a backup address, you can choose from the list of localized domains provided by Twilio. See
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.