ended() not called on some disconnections
js-beaulieu opened this issue · comments
#> WebRTC Phone Auto Hangup and Goodbye on Unload
The WebRTC Calling SDK will attempt an automatic goodbye upon graceful disconnection attempts. This allows the 2nd party on the other end of the phone line to receive a call ended signal. This happens automatically.
I am facing an issue where sometimes the ended() callback isn't called for the third party on disconnection. I suspect this has to do with this... let's say ungraceful (?) disconnections... How would one go and detect such situations?
This happens to me sometimes. Thus, I had to put this code inside "session.connected" to make it works.
var pc = session.pc;
pc.oniceconnectionstatechange = function() {
if(pc.iceConnectionState == 'disconnected') {
session.hangup();
}
}
@marvicrm we'd love to accept your changes. would you submit a pull request? we can merge your fix into master.
added in webrtc-v2.js