识别用户已结束通话

识别用户已结束通话

本文介绍了Twilio - 识别用户已结束通话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名初级开发人员,目前正在使用 Twilio 创建我们自己的电话系统.当我从客户发起呼叫并且客户在他们的最后接电话时,一切正常,直到用户挂断电话.在我从浏览器结束通话之前,通话仍保持连接状态.我如何才能识别出用户已经结束了通话?

I am a junior developer currently working on creating our own phone system with Twilio. At the moment when I initiate a call from the client and the customer picks it up at their end its all working well until the user hangups. The call is still remaining connected until I end the call from the browser.How can I recognise that the user has ended the call from their end?

推荐答案

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.

这篇关于Twilio - 识别用户已结束通话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:20