当我从浏览器拨打电话时,我正试图恢复StatusCallback事件。
当用户点击浏览器中的拨号时,我发送以下响应给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);
我已经在twilio控制台中注册了webhook,并且还通过命令发送,但我没有收到“响铃”,“回答”#39;来自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();
}));
});
我只收到completed
事件,如何获取其他状态,以便在响铃时显示响铃的用户界面,并在接听时显示挂断按钮?
答案 0 :(得分:0)
Twilio开发者传道者在这里。
在您的示例代码中,您没有为StatusCallback
添加选项,因此Twilio没有可以调用的webhook,只有recordingStatusCallback
。此外,Node库实际上是从低驼峰大小写转换键,因此键应该是statusCallback
。尝试将代码更新为类似的内容并让我知道它是如何发生的:
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: statusURLCallback,
recordingStatusCallback: recordURLCallback,
});
dial.number(toNumber);