Twilio - Recognising a user has ended a call

坚强是说给别人听的谎言 提交于 2019-12-14 02:16:02

问题


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?


回答1:


Looks like there is a callback in the Twilio API called "completed"

The call was answered and has ended normally.

Source




回答2:


Danielle, hello! I'm Megan from Twilio.

It sounds like your scenario is related to making outgoing calls from the browser.

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

Use .disconnect():

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

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});

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

Please let me know if this helps.




回答3:


For this I finally resolved it by setting the hub connection back to null on the disconnect.

this.connection.disconnect(() => {
                    this.connection = null;
                });


来源:https://stackoverflow.com/questions/35581184/twilio-recognising-a-user-has-ended-a-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!