Bring Your Own Numbers with Twilio SIP Interfaces
Time to read: 2 minutes
Using Twilio’s SIP Interfaces, you can take advantage of Twilio’s Voice API with numbers on another carrier. Let’s say you have a great relationship and a ton of numbers with your local provider, or you need new numbers in a country we don’t cover (yet). If you need a conferencing service, IVR or the ability to route calls to WebRTC you can add those capabilities to your existing numbers with SIP Interfaces.
In this post we’ll walk through how to get set up with a number from an external number provider. For this walkthrough we’ll use Toll Free Forwarding but there are many similar providers. Any provider who can deliver calls over SIP will work, and the process to connect them will be similar to the one described here.
To get this setup we need to configure the Twilio side and then the carrier side.
In order to send traffic to a Twilio SIP domain that traffic must be authenticated with an IP allow list or a username and password. For this use case we’ll use an IP list. You can get a full list of Toll Free Forwarding signaling IPs from here, but they’re also copied below.
To create an IP list go to here. Give it a friendly name that will help you remember the IP group and then add in the following IPs.
216.52.221.140
216.52.221.180
216.52.221.181
216.52.221.182
216.52.221.186
The next step is to create a Twilio SIP domain. To do that go here, pick a domain name, and then add the IP ACL you created to the domain and hit save.
This completes the Twilio portion of the setup and you’re ready to receive calls from Toll Free Forwarding.
The next step is to create an account with Toll Free Forwarding to send calls to Twilio. Once you’ve created an account you can go to this page to see the phone numbers that are available.
In this case we’re going choose a Malaysia, Kuala Lumpur local number, but any number you need will work.
Now that you’ve bought your number you can go to here to see the numbers on your account. Next hit the “New” button under call actions.
Once that page loads, paste in your SIP domain. When you paste in that box is what will come through in Twilio as the “To” of your incoming call. I put andrew@ but you could also enter your Toll Free Forwarding number like 60389885294@tollfreeforwarding.sip.twilio.com so you know which of your numbers was called.
Once you save that configuration make sure your number is set up with the call action you created. From there you are ready to go. Place a call to your Toll Free Forwarding number and you should hear your Twilio welcome message. Looking at your Twilio log you would expect to see an entry in this log.
I hoped this helped you get started bringing your own numbers to Twilio. This is one of the many uses for Twilio SIP interfaces. If you have something that speaks SIP like a carrier, softphone, or PBX, Twilio SIP Interfaces allow you to send calls in and out of these elements. We see our customers use this to add conferencing services to their existing PBXes, add on WebRTC clients as new endpoints or add Twilio to their existing phone numbers. We can’t wait to see what you build.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.