cometchat / chat-sdk-javascript

Voice & Video Calling and Text Chat SDK for JavaScript/Web
Other
30 stars 24 forks source link

End call programmatically? #62

Closed bojan-radicevic closed 4 years ago

bojan-radicevic commented 4 years ago

Is there a way to programmatically end call in Cometchat using JavaScript?

I have a situation where when a game with a friend ends in my app user gets redirected to another page, and if a user tries to play another game with the same friend he can not establish a call because of next error:

Screenshot from 2020-02-11 12-22-09

Using "@cometchat-pro/chat": "2.0.5"

mayur-bhandari commented 4 years ago

Hello @bojan-radicevic,

We have added a method in the latest version of the JS SDK (v2.0.6) to end call programmatically by calling the end call method:

CometChat.endCall(sessionId).then(
    call => {
        console.log("Call ended", call);
    },err => {
        console.log("error while ending call", err);
    }
)

Please check the same and do let us know if you face any issues.