[英]error when I instantiate Twilio.Call function - Undefined 'info'
I am trying to make an outbound call with Twilio Voice SDK in HTML.我正在尝试使用 HTML 中的 Twilio 语音 SDK 进行出站呼叫。
I am getting the following error when I instantiate Twilio.Call function实例化Twilio.Call function 时出现以下错误
const device = new Device(token);
const call = device.connect();
var callTemp = new Twilio.Call(call);
Error错误
Uncaught TypeError: Cannot read properties of undefined (reading 'info')
at Object.Call (twilio.min.js:1:26960)
at HTMLDivElement.eval (eval at <anonymous> (jquery.min.js:4:4994), <anonymous>:501:20)
at HTMLDivElement.dispatch (jquery.min.js:5:14129)
at v.handle (jquery.min.js:5:10866)
What is the correct way to instantiate the Twilio.Call ?实例化Twilio.Call的正确方法是什么?
You should not instantiate a Twilio.Call
object yourself.您不应该实例化
Twilio.Call
。自己调用 object。 The method device.connect
returns a promise that resolves to a Twilio.Call
object.方法
device.connect
返回 promise 解析为Twilio.Call
object。
const device = new Device(token);
device.connect().then(call => {
// Now you have the Twilio.Call object
})
Or with async/await:或者使用异步/等待:
const device = new Device(token);
const call = await device.connect();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.