I want to create a conference to multiple numbers using Twilio and Nodejs.
In my application I want to create a conference from the number I bought from Twilio to multiple numbers.
I am following this link.
My code is as follows
const Twilio = require('twilio');
const client = new Twilio(account_sid, authToken);
mobileArr.forEach(function(number,ind) {
console.log("mobile array iteration",ind, number);
client
.conferences(conferences.title)
.participants.create({
to: number, //number which i want to add to conference
from: myTwilioNumber, //number I bought from Twilio
statusCallback: twilioCallBackUrl,
statusCallbackMethod: 'POST',
statusCallbackEvent: ['initiated', 'ringing', 'answered', 'completed'],
Timeout: '15',
method: 'GET',
}, function(err, participant) {
if (err) {
console.error('conf failed because: '+ err);
} else {
console.log(participants)
}
})
})
The issue I am facing is I am not receiving all the webhook callback for all participants I have added to the conference properly.
I want to know that, am I doing it the right way or is there another better way of doing it.
Suppose I add 3 participants to a conference I Should receive a total 12 callBacks from Twilio for 'initiated', 'ringing', 'answered', 'completed' for each individual person I have added to the conference. But on some occasion's this does not happen.
Is there a way through which I can recieve callBacks for conference status as a whole.
Is there a way to pass an array of numbers to create conference instead of adding each number in the forEach loop.
I am new to Twilio please help.