C
C
Connectivity Platform
Ask or search…
K

Random Caller ID (CLI) on Voice calls

This article provides details and instructions for placing calls with CLIs (calling line identifications, aka Caller ID) selected randomly among a pre-defined set of numbers.
In this case, Voice relies on a “Number Pool”. MessageBird’s Number Pool is a pre-defined set of numbers with a Pool Service (what defines the way a number is selected in a pool) and additional configuration.
Currently, MessageBird supports Random CLI service, which will pick a random number within the pool, with a configuration option to pick only numbers belonging to the same destination country. To place a call with a Random CLI, our Voice product will get the CLI from the Number service.
Let’s see how to set up a number pool and how to use it with both Voice API and SIP trunking calls.

Set up a new Random CLI Number Pool

First, you need to create a new Random CLI Number Pool. You can create it using the dashboard interface or the Numbers API.
For example:
Property
Value
Name
my_pool
Service
randomcli
ByCountry
false
Then, you can add a couple of numbers. Both Verified and Owned (purchased at MessageBird) numbers are allowed.

Voice API calls

You are now ready to place a call with a random CLI using Voice API. In order to do it, you will use the attribute `sourcePool` instead of `source` in the call object.
WARNING: Do not set both `sourcePool` and `source` fields, otherwise the API will return a 400 error that, “Both source and sourcePool cannot be set at the same time”.

SIP Trunking Calls

First, you must enable number pooling by activating the option “Randomise caller ID” in the SIP trunk settings. By default, this is not enabled. You can either create a new trunk or just edit an existing one.
Then, click Save.
WARNING: once Randomise caller ID is enabled, you must specify a number pool to use otherwise the call won’t be placed.
Now, you can place calls using that SIP trunk. You can define which pool to use passing its name with one of the following methods:
  1. 1.
    Using the custom SIP header `X-MB-NPS` in the INVITE
  2. 2.
    Using the Display portion of the From header in the INVITE. For example, `From: “my_pool” <sip:[email protected]>`
  3. 3.
    Setting a default number pool in the SIP trunk page.
MessageBird will try all the above methods from higher to lower priority to find what pool to use and pick a random number from it.

Select random numbers from the same country as the call destination

You can place calls selecting a random number among only the ones from the same country in a pool.
In order to do this, enable the `byCountry` option in the pool’s configuration and place a call using the methods described above. NOTE: be sure to have numbers belonging to the countries you want to dial, otherwise, the call will fail.