Using Voxbone with Asterisk 16

We believe setting up business communications should be straightforward and painless. That’s why we build our SIP services to play well with any other communications platforms you might use – whether hardware-based or hosted in the cloud, built internally or bought from a third-party vendor.

What you’ll need to get started:

  1. A registered Voxbone account with assigned numbers. (Create your account here)
  2. You might have an earlier version of Asterisk. This guide is built for the current version (16) and covers changes to the code base with the move to
    pjsip.conf, rather than chan_sip.conf or the original sip.conf
  3. If you are managing an earlier version, we recommend upgrading your Asterisk to an in-life version. You can follow this guide to update your Asterisk platform.

Note: For Voxbone, a free test account is all you need in order to follow the steps in this guide and complete a technical validation of the integration of our voice services with Asterisk.

How it works

Voxbone Asterisk integration

When a call is received on our platform, we deliver it 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 optimising for maximum call quality. To connect your Voxbone numbers to Asterisk, we need to establish a SIP interface between the platforms.

This can be done in 2 steps:

  1. Setting Up Inbound Call Routing
  2. Setting Up Outbound Call Routing

1. Setting Up Inbound Call Routing

To set up inbound calls, we first need to configure some settings in Asterisk. Once the destination address is configured there, we can set up a number and direct traffic to this source within the Voxbone platform.

Setting Up IP Whitelisting

First, we need to whitelist Voxbone’s signaling IPs within Asterisk. You can find a list of signaling IPs for all our Points of Presence (PoPs) here.

This goes into the pjsip of your Asterisk configuration. I’ve named the access list related to Voxbone incoming IPs as [voxbone-uac]

  [voxbone-uac]
  type=identify
  match=81.201.82.45,81.201.83.45,81.201.84.195,81.201.85.45,81.201.86.45,185.47.148.45 
  endpoint=voxbone-uac

This defaults to the IP address of your Asterisk box. If you have a more complicated setup, you will need to bind this to your correct interface.

Setting up a SIP End Point

Next you’ll need to create a URI for Voxbone to use. What this looks like will depend on your business setup, how many Asterisk instances you have and the level of resiliency you require.

  [voxbone-uac]
  type=aor

  [voxbone-uac]
  type=endpoint
  allow= !all,ulaw,alaw
  aors=voxbone-uac
  direct_media=no
  context = outbound-voxbone

Configuring a SIP URI To Point At Asterisk

Next, we will set up the SIP interface from Voxbone to Asterisk in Voxbone’s platform. This is done via Voice URIs.

In order to differentiate from any other Voice URIs that might point to your Asterisk, 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.

  1. Log in to your Voxbone account.
  2. Go to Configure > Configure Voice URIs or, if you’re logged in, click here.
  3. Click “New” to create a Voice URI for your Asterisk
  4. Specify the Voice URI as {E164}@YourAsterisk.com  or {E164}@YourAsteriskExternalIP

Adding a Number to the URI So You Can Call it, and Adding an Audio Codec

Now, we need to link one of our phone numbers to the Asterisk 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 the codecs we set in the dial peer above to prevent any SDP or media-related errors under the “Codecs” menu.   Voxbone Platform - Select Voice URI
  4. Select the voice URI you created from the previous step, from the popup window.
  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 Asterisk

Testing Calls

Any calls placed to the numbers associated with your URI are now delivered by Voxbone to your Asterisk. If you used the {E164} keyword, Asterisk should see them as calls received to URI (called Voxbone DID)@YourAsteriskDomain. You should be able to do a packet capture to capture the traffic and see the incoming call.

2. Setting Up Outbound Call Routing

For security reasons, it’s important to look at number permissions and SIP digest headers when setting up outbound calling. These will allow you to use a number for multiple applications.

But there are a few steps to take before we get there.

Enabling Outbound

Before you start, make sure you have an online account with Voxbone and that Voxbone’s service interoperates with your network by following the inbound guide
above.

Then check the following:

  • That your Account Manager or Customer Success Manager has activated Voxbone’s outbound service for your account, and for your country of choice
  • That you’ve got 2 test numbers for outbound calling, These are test numbers in countries that have our outbound service available. Our team will confirm that access has been granted for these numbers.
  • If the country you are using requires Emergency Services to be enabled, please ensure you speak to our team about getting this set up at the same time, as otherwise it might delay this process.

Go to ‘Configure DIDs’ in the Voxbone platform, and select the numbers you wish to set up for outbound service. Find ‘VoxOut National’ and click it to enable outbound calls. Be, and then be sure to hit ‘Apply’ to update the configuration.

Voxbone Platform - National Outbound Enabled

This allows you to use this number as an outbound presentation number across any number of integrations.

Enabling SIP Digest Security

The next thing that needs to be set up is the security configuration that Voxbone requires for outbound calling. Voxbone uses SIP Digest headers. To set up the credentials, please go to ‘Configure Outbound Voice’.

Here you can add the username and password used on the system.

Voxbone Platform - Outbound Voice Credentials

Note: We strongly recommend you use the generation tool to create a large, complex key for use within the system. This is a central configuration and only needs setting up once.

Setting Up Call Diversion

To allow call forwarding or call diversion to support passing or presenting third-party call IDs, the system needs to have the following setup.

  • The number listed in the ‘FROM’ field can be either a Voxbone or third-party number
  • The number in the ‘TO’ field can be a number listed in our routing prefix table
  • The number in the ‘DIVERSION’ field must be a Voxbone number activated for outbound voice

Asterisk Settings

We now need to point Asterisk to the AnyCast IP address at Voxbone so calls route correctly.

[Voxout]
type = endpoint
allow= !all,ulaw,alaw
aors = VoxboneOutbound
direct_media=no
outbound_auth = VoxboneDigestHeader

We also need to configure the SIP Digest header (VoxboneDigestHeader) shown above.

[VoxboneDigestHeader]
type=auth
auth_type=md5
md5_cred=c936af1afa3bd7fb36a66e2ed2437ba1  //Generated see below
username={Username from above}
realm = voxbone.com

We need to generate a MD5 Hash for the credentials. To do this, write out your credentials as follows:  ({Username}:voxbone.com:{password}. E.g.

NotRealUser:voxbone.com:GJIGWn1n10fj1n

You can then generate an MD5 in a number of ways. There are online MD5 generators, but as these are your secure credentials for the Voxbone platform, we suggest using an offline process. One viable alternative it to use a script such as Crypto.Js, which can support generating an MD5 locally within your browser.

For the above example, we end up with an MD5 value of: c936af1afa3bd7fb36a66e2ed2437ba1

Lastly, you need to extend your Extensions.conf file

This needs to follow [email protected].89.110 format.

[outbound-voxbone]
exten => +3281998877,1,Dial(PJSIP/[email protected])

The sample Asterisk Configs for pjsip and extensions.conf are linked here, please note you need to change these as above to ensure they are aligned to your system. They will not work without modification.

For any questions, please contact us