Skip to content
TriedDocs
Telephony

Twilio

Connect a Twilio number to a Tried agent with your own Twilio Elastic SIP trunk, step by step.

You can bring any Twilio voice number to Tried. The number stays on your Twilio account and Twilio bills you for it. You create an Elastic SIP trunk in your Twilio console that sends the number's calls to Tried (origination) and accepts the agent's outbound calls (termination). Tried then answers and places calls on that trunk.

This path needs no Twilio keys on the Tried side. The dashboard shows the same steps in Connect number via SIP trunking, under Using a Twilio number? Setup steps, with the values for your deployment filled in and copy buttons.

Before you start#

  • A Twilio account with a voice-capable number, or permission to buy one. Australian numbers need an approved regulatory bundle (business address and ID) before Twilio sells them.
  • Your Tried origination URI and IP ranges. The dashboard guide loads them from GET /sip-origination, which returns origination_uri (sip:<LIVEKIT_SIP_URI>;transport=tcp) and ip_ranges.

Set up the Elastic SIP trunk#

Get a number in Twilio#

In the Twilio Console go to Phone Numbers > Buy a number and pick one with Voice. A number you already own works too.

Create a SIP trunk#

Go to Elastic SIP Trunking > Trunks, click Create new SIP Trunk and give it a name. Any region works (for example Australia AU1). Create everything below in that same region.

General tab#

  • Call Recording: leave Disabled. Tried already records calls.
  • Secure Trunking: leave Disabled.
  • Call Transfer (SIP REFER): set to Enabled and tick Enable PSTN Transfer, so your agent can transfer calls to a person.
  • Caller ID for Transfer Target: leave as Transferee so your staff see the caller's number. If transfers fail, switch to Transferor.
  • Symmetric RTP: set to Enabled.
  • Click Save.

Termination (lets your agent make calls)#

  • Open the Termination tab and enter a Termination SIP URI, for example yourbusiness.pstn.twilio.com. Copy the full address.
  • Under IP Access Control Lists, create a new list and add each of the Tried IP ranges from the guide.
  • Under Credential Lists, create a new list with a username and a strong password. You enter them in Tried below.
  • Click Save.

Origination (sends incoming calls to your agent)#

Open the Origination tab, click Add new Origination URI, paste the origination URI from the guide, set Priority and Weight to 10, and save.

Attach the number#

On the trunk's Numbers tab click Add a number and pick yours. This replaces any webhook or Studio flow the number had.

Connect it in Tried#

In Connect number via SIP trunking, enter Phone Number with the country code (for example +61290001234), Termination URI from the Termination step, Transport TCP, the SIP username and SIP password from the credential list, and the Inbound agent (optional). Click Save.

Test it#

Call the number from your mobile. Your agent should answer within a couple of rings.

What Tried does with a Twilio number#

A number whose termination URI is a *.pstn.twilio.com host is stored with provider: "twilio" (pass provider: "twilio" to force it). Then:

  • Inbound is locked to Twilio's signalling gateways. Unless you set allowed_inbound_addresses yourself, the number's inbound trunk only accepts INVITEs from Twilio's Elastic SIP Trunking IP blocks, including the regional *.pstn.<region>.twilio.com domains. The default list is 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. Set TWILIO_INBOUND_ALLOWED_ADDRESSES on the API if Twilio changes them.
  • Outbound goes to your trunk with your credential list username and password. Your trunk only accepts calls from the Tried IP ranges in its IP access control list.
  • Calls per second defaults to 4 (DEFAULT_CPS_TELNYX, used for Twilio numbers too). The dashboard caps the field at 5 for Twilio numbers.

Both directions are locked by IP, and outbound calls also need the credentials.

Transfers#

Agent transfers use SIP REFER (cold transfer) or a new INVITE into the same call (warm transfer and the default cold transfer). Enable Call Transfer (SIP REFER) and Enable PSTN Transfer on the trunk so REFER transfers to phone numbers work. Twilio bills the transferred leg to your account; Tried does not charge for it.

Buying Twilio numbers through Tried#

The API can also buy numbers on the platform's own Twilio account: POST /create-phone-number with number_provider: "twilio". This is different from bringing your own number. Needs keys

  • Needs TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN and TWILIO_SIP_PASSWORD (optional TWILIO_SIP_USERNAME, default tried) on the API.
  • Tried creates one Elastic SIP trunk per workspace on that account, named after the workspace, with an origination URL of sip:<LIVEKIT_SIP_URI>;transport=tcp, a credential list, and the number attached.
  • Deleting the number releases it from the Twilio account.

Without TWILIO_ACCOUNT_SID, a mock provider returns fake numbers and records the trunk requests in the provider operation log.

Troubleshooting#

Symptom Check
Calls to the number do not reach the agent The number is attached to the trunk's Numbers tab; the origination URI matches GET /sip-origination; the number in Tried is E.164 with a +.
Calls are rejected before ringing You set allowed_inbound_addresses that do not include Twilio's gateways, or Twilio is sending from a range not in the default list.
Outbound calls fail with telephony_provider_permission_denied Username or password does not match the credential list, or the Tried IP ranges are missing from the IP access control list.
Transfers fail Turn on Call Transfer (SIP REFER) and Enable PSTN Transfer, or switch Caller ID for Transfer Target to Transferor.

Use Test SIP connection on the number's Routing and SIP card to check that the termination URI answers SIP OPTIONS.