Twilio's Elastic SIP Trunking gives your voice agent pay-as-you-go connectivity with numbers in over 100 countries, and it fits the generic SIP connection form directly. This guide maps Twilio's settings onto the four fields you need to fill in.
You keep your Twilio account, your numbers, and Twilio's rates — BSG just uses the trunk to place your agents' calls.
Quick start
Create a trunk in the Twilio Console.
Set the Termination SIP URI — this becomes Server.
Create a Credentials List — this becomes Username and Password.
Attach a number — this becomes Phone.
Fill in the BSG connection and test it.
What maps to what
Fill in these four fields on the SIP connection. Everything else on the form stays as it is.
BSG field |
Twilio value |
Server |
Your Termination SIP URI, e.g. your-trunk.pstn.twilio.com |
Username |
The username from your Credentials List |
Password |
The password for that credential |
Phone |
A Twilio number attached to the trunk, in E.164 format |
Register |
Off. Twilio's own instruction is to configure your infrastructure not to register for an Elastic SIP Trunk — it authenticates each call instead. |
What you manage where
Where |
What you do there |
Create the trunk, set the termination URI, manage credentials, buy and attach numbers, watch call charges |
|
Store the four values as a SIP connection, enable it, and test the line |
Call charges and number rental stay with Twilio at your account's rates.
Step 1. Create a trunk
Sign in to the Twilio Console.
In the left menu, go to Voice → Elastic SIP Trunks. Depending on your console version this may appear as Elastic SIP Trunking → Manage → Trunks.
Click Create new SIP Trunk.
Enter a Friendly Name you'll recognise, such as bsg-voice-agent, and save.
Twilio assigns a Trunk SID automatically; you don't need it for this setup.
Step 2. Set the Termination URI
Open the trunk's Termination tab and enter a SIP URI (SIP Domain). Twilio builds the full address from it:
your-trunk.pstn.twilio.com
This is the address BSG's infrastructure uses to send SIP traffic to Twilio, and it's what goes in Server. Twilio suggests dashes rather than dots for readability.
Choosing a regional URI. Twilio also offers localised termination URIs that connect to a specific edge, such as your-trunk.pstn.dublin.twilio.com or your-trunk.pstn.frankfurt.twilio.com. Picking the edge closest to your callers shortens the media path and helps latency — which matters for a voice agent, where the model is already adding its own response time. The plain pstn.twilio.com hostname works fine if you'd rather not pin a region.
Step 3. Create a Credentials List
Still in Termination, find the Authentication section and choose Credentials List — authentication by username and password. This is the method to use for a BSG connection.
Create a new Credentials List.
Give it a Friendly Name.
Enter a Username and Password, then save.
Make sure the list is selected for this trunk.
Twilio enforces a strong password here — at least 12 characters, with an upper-case letter, a lower-case letter, and a number.
These two values become Username and Password on the BSG connection. Twilio challenges each outbound call with a 407 Proxy Authentication Required and expects them in reply, which is exactly how the connection authenticates.
Twilio also offers IP Access Control Lists as an alternative. Credentials are the right choice here, since they don't depend on knowing which addresses BSG's traffic leaves from.
Step 4. Attach a number
Open the trunk's Numbers tab. You have two ways to add one:
Purchase Numbers — buy a new number through Twilio, then move it into this trunk.
Move Existing Numbers — bring across a number you already own.
Once added, check that the number is associated with the right trunk before you leave the page.
Use that number, in E.164 format with the leading plus (+380441234567), as Phone.
Twilio only accepts a caller ID that is either a Twilio number on your account or a number you've verified in the Console under Verified Caller IDs. Anything else is rejected.
Step 5. Fill in the BSG connection
Open Connections in the Voice Agent cabinet and click Add SIP connection.
Rename it to something recognisable — the Twilio number itself works well.
Fill in Server, Username, Password, and Phone from the steps above.
Leave Register off.
Tick Enabled and click Save.
Reveal the password with the eye icon before saving; a trailing space copied from the Twilio Console is a common cause of a rejected credential.
Then click Test Call and check the Logs tab. A healthy result shows COMPLETED with a playable recording. For the full walkthrough of the form and its logs, see SIP provider and telephony setup.
Receiving inbound calls
The steps above set up outbound calling. If you also want the agent to answer calls to your Twilio number, Twilio needs an Origination SIP URI in the trunk's Origination tab, pointing at the address calls should be delivered to.
Ask BSG support for the hostname to use — it's specific to your account, and Twilio needs a real address it can reach. Once it's set, Twilio delivers calls to any number attached to the trunk, with the dialled number carried in a SIP Diversion header.
You can add up to ten origination URIs with priority and weight values if you want failover.
Twilio requirements worth knowing
Numbers must be E.164 with the plus. Twilio rejects anything else with 400 Bad Request. Write +380441234567, never 380441234567 or 0441234567.
Trial accounts can only call verified numbers. If test calls fail to reach an ordinary phone, check whether the account is still on trial — upgrading removes the restriction.
Firewall rules run both ways. If your setup restricts outbound traffic, Twilio publishes the signalling and media IP ranges its edges use, and expects all of them to be reachable rather than a single address.
Encryption is optional. Twilio's Secure Trunking adds TLS for signalling and SRTP for media. It's a trunk-level setting on Twilio's side; enable it only after confirming with BSG support that the connection is set up to match, since a trunk with Secure Trunking on rejects unencrypted calls.
Related guides
Twilio references
Comments
0 comments
Article is closed for comments.