Connect Twilio Elastic SIP Trunking to SessionPBX
Twilio Elastic SIP Trunking supplies phone numbers in many countries and outbound calling. SessionPBX has a Twilio Elastic SIP Trunking template, and can read your Twilio account and fill in most of the trunk for you. It can also finish the setup on the Twilio side.
You bring your own Twilio account, numbers and caller ID. SessionPBX doesn’t supply Twilio service.
Twilio requires full international format, +E.164, in both directions.
About this guide. The Twilio settings on this page were checked against Twilio’s published documentation on 19 October 2026. The SessionPBX field names come from the Add SIP trunk wizard in the product. If Twilio shows a different value in your account, use theirs.
Before you start
Create an Elastic SIP Trunk in the Twilio console if you don’t already have one. Note its Termination SIP URI, which looks like yourtrunk.pstn.twilio.com.
Create an API key under Account > API keys & tokens. Use a standard API key, not your Auth Token: an Auth Token has full access to your account and can’t be revoked separately.
You need three values:
- Account SID, beginning
AC - API Key SID, beginning
SK - API Key secret, shown once when the key is created
Connect your Twilio account
- Open the SessionPBX project and select Call Routing.
- On SIP trunks, select Add trunk.
- Name the trunk, then choose Twilio Elastic SIP Trunking as the Provider.
- Choose your Twilio region, enter the Account SID, API Key SID and API Key secret, then select Connect account.
SessionPBX reads your account and fills in:
- your purchased phone numbers, as inbound numbers
- the termination host from your Elastic SIP Trunk
- Twilio’s signalling IP ranges, transport and port
A standard API key can’t read the account’s friendly name, so the Account SID is shown instead. That’s expected.
If you have more than one Twilio trunk
Accounts often have one trunk per region, for example a US trunk and a European one. SessionPBX lists them, and this trunk uses the one you select.
Regional trunks are separate services, so add a SessionPBX trunk for each and use Outbound number rules to route by prefix: +1 to the US trunk, +44 to the European one. The longest matching prefix wins.
Use Additional gateways only for hosts that are alternative routes to the same destinations. Give a backup gateway priority 10. A lower number wins, so calls use the trunk’s main host (priority 0) first and move to the backup only if the main host stops answering. A backup left at priority 0 shares calls with the main host instead.
If your trunks aren’t listed
Twilio scopes the trunk list to the project that issued the API key. A key created in a parent project can read a subaccount’s numbers but not its trunks.
When that happens SessionPBX shows a Trunk SID box. Open the trunk in the Twilio console, copy the SID beginning TK, paste it in and read the account again. Or create the API key in the project that owns the trunk. You can also type the termination host yourself.
Let SessionPBX finish the setup
Finish the setup in Twilio for me is ticked by default. When the trunk is created, SessionPBX will:
- add an origination URI on your Twilio trunk pointing at your region’s SessionPBX address, so incoming calls reach you
- attach the numbers you selected to the trunk
- add your region’s SessionPBX IP address to a Twilio IP access control list, so Twilio accepts your outbound calls
If a step fails, usually because the key doesn’t have permission for that resource, SessionPBX says which one and carries on with the rest. The trunk is saved either way, and Try again repeats only the steps that didn’t work.
Untick it if you’d rather do the Twilio side yourself, and follow Finish in the Twilio console below.
Complete the trunk
- Connection: host, port
5060and UDP are filled in. Leave Direction on Both directions unless this trunk is one-way. - Authentication: By our IP address is selected, with Twilio’s signalling ranges listed under Carrier IP addresses. Keep all of them. Twilio uses every edge for resiliency, so a shorter list works only until an edge fails over.
- Inbound: your numbers are listed. Remove any that shouldn’t route here.
- Outbound: set Caller ID to a number on this Twilio account.
Select Create trunk.
Finish in the Twilio console
You only need this if you unticked Finish the setup in Twilio for me, or if a step failed. Until it’s done, calls only work outbound.
- Open your Elastic SIP Trunk in Twilio.
- Under Origination, add a SIP URI pointing at your SessionPBX region, for example
sip:uk.sip.sessiontalk.io. For TLS, usesip:uk.sip.sessiontalk.io:5061;transport=tls. - Under Numbers, add the numbers you listed on the trunk.
- Under Termination, add an IP access control list containing your region’s SessionPBX IP address from the table below.
SessionPBX addresses for Twilio
Give Twilio the address for the region your workspace is hosted in. If you’re not sure which region that is, email support@sessiontalk.co.uk.
| Region | Hostname | IP address |
|---|---|---|
| London | uk.sip.sessiontalk.io | 206.189.121.32 |
| New York | us.sip.sessiontalk.io | 134.122.14.236 |
| Singapore | asia.sip.sessiontalk.io | 152.42.251.112 |
SessionPBX accepts calls from carriers on UDP port 5060 or TLS port 5061. TCP isn’t accepted for incoming calls. Calls that SessionPBX sends to Twilio can use UDP, TCP or TLS on whatever port Twilio specifies.
Twilio’s signalling ranges, which SessionPBX fills in for you, are 54.172.60.0/30, 54.244.51.0/30, 54.171.127.192/30, 35.156.191.128/30, 54.65.63.192/30, 54.169.127.128/30, 54.252.254.64/30 and 177.71.206.192/30.
Route your numbers
On Call Routing, use Inbound number routing to choose where each number rings: everyone, a team member, a ring group, a call queue or a call flow. See Phone Numbers & Outbound Calls.
Allow members to call out
Outbound calling is off for new members. Open Team Members, edit the member, turn on Outbound PSTN under Access & features, and select Save member.
Members can dial numbers in international format, such as +447700900123. SessionPBX sends the number to Twilio in international format.
Test the trunk
- Call one of your Twilio numbers from an outside phone and check that the right destination rings.
- With Outbound PSTN on for one member, call a public number. Check that audio works both ways and that the called phone shows the caller ID you expect.
- If you call into an IVR, check that key presses work. SessionPBX sends and receives key presses as RFC 2833 telephone events.
If calls fail, email support@sessiontalk.co.uk with the time of the call, the number you called from and the number you called.
If outbound calls fail, check that the termination host matches your trunk exactly. If incoming calls never arrive, the origination URI in Twilio is the usual cause.