Using Voxbone with Twilio

We believe setting up business communications should be a straightforward, painless process. That’s why we build our SIP services to play well with whichever communications platform you might use – whether it’s hardware-based or hosted in the cloud, built internally or bought from a third-party vendor. In effect, this enables you to Bring Your Own Carrier (us!) to your communications provider. Why is this better than paying for a bundled service from one provider? Because it allows you to benefit from Voxbone’s fully compliant, reliable voice infrastructure and the improved connectivity and scalability of our network while continuing to use your existing apps. It’s a win-win for you!

The following guide will show you how to bring your Voxbone numbers to Twilio. It’s easy to connect numbers from your Voxbone account to Twilio’s platform.

What you’ll need to get started:

  1. A registered Voxbone account with assigned numbers. (Create your account here)
  2. A registered account with Twilio (Create it here)

Note: On both platforms, a free-trial account is also enough to get started!

How it works

voxbone + twiio = magic

When a call is received on our platform, we deliver this call to your designated SIP interface through voice URIs. Behind the scenes, we take care of complex things like least-cost routing, finding the best provider and optimizing for maximum call quality. To connect your Voxbone numbers to Twilio’s platform, we need to establish a SIP interface between our platform and theirs. This can be done in four steps:

  1. Create ACLs to allow signaling between Voxbone and Twilio
  2. Create a SIP interface between Twilio and Voxbone
  3. Create a voice URI to test the interface
  4. Assign a voice URI to a DID and place a call

Create ACLs to allow signaling between Voxbone and Twilio

First, we need to whitelist Voxbone’s signaling IPs from the Twilio side for your apps. You can find a list of our signaling IPs for all our points of presence (PoPs) here.

  1. Log in to your Twilio account
  2. In the dashboard, go to Programmable Voice > SIP Domains > IP Address Control Lists or,  if you’re already logged in, click here to go there directly
  3. Create a new ACL by clicking the “+” sign. You can use “Voxbone” as the friendly name for this ACL. As the pop-up only allows you to enter one IP, you can start by using your favorite Voxbone PoP. For example, Belgium:Twilio new access control list
  4. You will be taken to the newly created ACL page. Keep adding other Voxbone PoPs by clicking the “+” sign under “IP Address Ranges”. Note that we’re not actually using ranges but single IPs with “32” as subset.
  5. When you’re done adding all the signaling PoP addresses, your ACL should look something like this:Twilio access list complete
  6. All done! Now we can create a SIP interface and link this ACL to it!

Creating a SIP interface between Twilio and Voxbone

Next, we’ll define the path/domain by which we can access Twilio apps from Voxbone.

  1. In the Twilio dashboard, go to Programmable Voice > SIP Domains > Domains, or click here and then click “+” to create a new SIP Domain.
  2. Specify your new SIP domain. Note what you created, as this will be needed in the next step. This is the domain of your SIP URI. I’m using “voxbone-interface.sip.twilio.com” for this tutorial. That makes my Voice URI for Voxbone: anything@voxbone-interface.sip.twilio.com
  3. Specify a TwiML app connected via this interface. For testing purposes, you can use “https://demo.twilio.com/welcome/voice/”
  4. Finally, add your ACL under the “Voice Authentication” section in the drop-down list. When you’re done, your SIP interface should look something like this: Twilio New SIP Domain

Creating a Voice URI between Voxbone and Twilio

This is where we set up the SIP interface from Voxbone to Twilio. On our platform, this is done via Voice URIs. As noted from the previous step, our SIP domain is “voxbone-interface.sip.twilio.com” and a standard SIP URI is in the format of user@sip-domain.com. For example: me@voxbone-interface.sip.twilio.com.

To be able to differentiate on your Twilio app, we’ll use a reserved keyword on our platform, “{E164}”, so that we can use the same voice URI for many different numbers and detect what number is called/who’s calling from our Twilio app.

  1. Log in to your Voxbone account.
  2. Go to Configure > Configure Voice URIs or, if you’re logged in, click here. Then click “New” to create a Twilio Voice URI.
  3. Specify the Voice URI as {E164}@(whatever you set as the SIP domain on Twilio). For example: {E164}@voxbone-interface.sip.twilio.com. When you’re done, your Voice URI should look something like this: Voxbone Create Voice URI

Assign your Twilio Voice URI to a Voxbone DID

Now, we need to link one of our numbers to the Twilio URI we just created.

  1. Go to Configure > Configure DIDs or, if you’re logged in, click here.
  2. Use filters to pick a number of your choice to assign for testing and hit “Search”.
  3. Once you’ve picked your number, under the Configuration menu, go to the “Voice” tab and click “Voice URI”. Also, make sure to pick at least g.729 and g.711 codecs to prevent any SDP or media-related errors under the “Codecs” menu. Voxbone configure DID
  4. Select the Voice URI you just created from the previous step from the modal window. Voxbone Select a Voice URI
  5. Hit “Apply” and “Continue”, then finally, “Confirm”.
  6. All set! Now place a call to the number you are using for testing! It should reach your designated Twilio App on your Twilio SIP Interface.

Testing calls

Any calls placed to the numbers associated with your Twilio URI are now delivered by Voxbone to Twilio. If you used the {E164} keyword, your Twilio app should see them as calls received to URI (called Voxbone DID)@(Twilio SIP Interface Domain). For example in this tutorial, if the Voxbone number “3228080000” is linked to {E164}@voxbone-interface.sip.twilio.com, when a call is placed, your Twilio app would see an incoming call to 3228080000@voxbone-interface.sip.twilio.com on the app you linked to the interface. Now, based on the SIP headers, you can keep using your existing app/business logic without changing anything, but use Voxbone as the delivery platform.

For any questions, please contact us