I want to make calls using a pool of phone numbers as caller IDs. I want my script to chose a random number of what I have and show it to my customers. Can I do this with Voximplant?
Asked
Active
Viewed 29 times
1 Answers
0
There's no "random caller ID" in Voximplant, but you can easily do it with common JS, like this:
//pool of disposable callerIDs
let number_pool = ["73832349068",
"79666667368",
"79666667369",
"19073314185"]
//random index generation
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
let index;
//incoming call leg
VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) {
//picking random callerID
index=getRandomInt(number_pool.length);
const confirmedCallerId = number_pool[index];
//outbound call leg to call destination from randomly selected callerID
const out = VoxEngine.callPSTN(e.destination, confirmedCallerId);
VoxEngine.easyProcess(e.call, out);
});

Avicus Delacroix
- 121
- 1
- 6