Twilio SIP Trunk Configuration Guide

How to configure Twilio SIP trunk with Yeastar Cloud PBX

Configure a SIP Trunk

1. Create an Account with Twilio
To start with, you need to have an account from Twilio. Please visit their website to get a SIP account: https://www.twilio.com/. When configuring your SIP Trunk, you can refer to their configuration guide.

2. Configure Termination and Origination in Twilio
2.1. Go to Elastic SIP Trunking > Trunks > Termination > Termination URI, configure your localized Termination SIP URI.

  • If you select North America Virginia, Twilio Termination SIP URI would be example.pstn.us1.twilio.com;
  • If Europe Ireland, would be example.pstn.ie1.twilio.com;
  • Fore more localized Termination URIs, please click here.

2.2. Go to Elastic SIP Trunking > Trunks > Termination > Authentication, authenticate your PBX domain.

2.3. Go to Elastic SIP Trunking > Trunks > Origination, configure your localized Origination SIP URI with the region parameters.

  • If you select North America Virginia, Twilio Origination SIP URI would be sip:your_pbx_domain;region=us1;
  • If Europe Ireland, would be sip:your_pbx_domain;region=ie1;
  • Fore more region parameters, please click here.

3. Add a SIP Trunk in Cloud PBX
After you get the SIP trunk account, you need to add a SIP trunk in Yeastar Cloud PBX. Go to Settings > PBX > Trunks, click Add.

Add SIP Trunk-Yeastar Cloud PBX-Template

4. Configure the Twilio trunk
In the new window, select United States from the “Select Country” drop-down list and select Twilio from the “ITSP”.

twilio-add-trunk-cloud
  • Name: give this SIP trunk a name to help you identify it.
  • Protocol: SIP.
  • Trunk Type: Peer Trunk.
  • Hostname/IP: your Twilio Termination SIP URI
  • Transport: UDP.
  • Caller ID Number: your Twilio Account DID number.

5. Check the Trunk Status
Go to PBX Monitor to check if the SIP trunk is connected successfully as the screenshot below shows.

twilio trunk status

Configure the Outbound Route with Twilio Trunk

To make outbound calls via the newly created SIP trunk, you need to configure an outbound route for the trunk.
1. Create an Outbound Route
Go to Settings > PBX > Call Control > Outbound Routes, click Add.

Cloud-Step4-Create-Outbound-routes-Template-2020Jan

2. Configure the Outbound Route
The system compares the number with the pattern that you have defined in your route 1. If it matches, it will initiate the call using the selected trunks. If it does not, it will compare the number with the pattern you have defined in route 2 and so on. The outbound route which is in a higher position will be matched firstly. You can adjust the outbound route sequence by clicking these buttons

twilio outbound route
  • Route Name: give this outbound route a name to help you identify it.
  • Dial Patterns: set the dial patterns in E.164-formatted.
  • Member Extensions: select the extensions that are allowed to make calls through the outbound route.
  • Member Trunks: select the Twilio trunk.

3. Click Save and Apply
Now you can make outbound calls through the Twilio trunk. As the dial patterns configured above, the number is dialed out in E.164-formatted. For example, to call the number “101234567”, you just need to dial “101234567” on your phone.

Configure the Inbound Route with Twilio Trunk

To specify how calls from the Twilio trunk should be routed, you need to configure an inbound route for the SIP trunk.
1. Create an Inbound Route
Go to Settings > PBX > Call Control > Inbound Routes, click Add.

Cloud-Step6-Create-Intbound-routes-Template-2020Jan

2. Configure the Inbound Route

twilio-add-inbound-route
  • Name: give this inbound route a name to help you identify it.
  • Member Trunks: choose the Twilio trunk.
  • Destination: select the destination where the incoming calls will be routed.

3. Click Save and Apply
When you call in the SIP trunk, the call will be routed to the destination configured on the inbound route.

Helpful Links