且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Twilio - 识别用户已结束通话

更新时间:2023-12-01 18:51:58

Danielle,你好!我是来自 Twilio 的梅根.

Danielle, hello! I'm Megan from Twilio.

听起来您的情况与从浏览器拨出电话有关.

您是否按照步骤在浏览器中挂断电话?具体:

Have you followed the steps to hang up calls in the browser? Specifically:

使用.disconnect():

/* Log a message when a call disconnects. */
Twilio.Device.disconnect(function (conn) {
    $("#log").text("Call ended");
});

后跟一个使用 .disconnectAll()hangup() 函数:

followed by a hangup() function using .disconnectAll():

/* A function to end a connection to Twilio. */
function hangup() {
    Twilio.Device.disconnectAll();
}

考虑从客户端连接跟踪状态.当它关闭时,您可以调用上述函数.

Consider tracking status from the client connection. When it is closed you can invoke the above functions.

此外,如果您通过以下方式在客户端中打开调试可能会有所帮助:

Also, it might help if you turn on debugging in Client via:

Twilio.Device.setup(token, {debug: true});

Javascript 控制台将显示收到的所有低级事件.

The Javascript console will show all the low level events received.

如果这有帮助,请告诉我.

Please let me know if this helps.