I am trying to get back StatusCallback events when I dial from my browser to phone call.
When user clicks on dial in browser I am sending the following response to twilio:
const dial = twiml.dial({
callerId: Meteor.settings.private.twilio.TWILIO_CALLER_ID,
answerOnBridge: true,
record: "record-from-answer-dual",
StatusCallbackEvent: ["initiated", "ringing", "answered", "completed"],
StatusCallback,
recordingStatusCallback: recordURLCallback,
});
dial.number(toNumber);
I have registered webhook both in twilio console and also sending via command but i'm not receiving 'ringing', 'answered' events from twilio
WebApp.connectHandlers.use("/twilio-status-callback", function( req, res, next ) {
console.log('***status url callback***');
var body = "";
req.on('data', Meteor.bindEnvironment(function (data) {
body += data;
}));
req.on('end', Meteor.bindEnvironment(function () {
body = qs.parse(body)
console.log(body);
res.end();
}));
});
I am only receiving completed
event, how to get other statuses to so that I can show ringing UI when it is ringing and hangup button when answered?