diff --git a/static/js/mediastream/peerconference.js b/static/js/mediastream/peerconference.js index 536f57fc..73ec7164 100644 --- a/static/js/mediastream/peerconference.js +++ b/static/js/mediastream/peerconference.js @@ -59,7 +59,7 @@ define(['jquery', 'underscore', 'mediastream/peercall'], function($, _, PeerCall }; PeerConference.prototype.checkEmpty = function() { - if (!_.isEmpty(this.calls)) { + if (!_.isEmpty(this.calls) || (this.currentcall && this.currentcall.id)) { return false; } @@ -261,7 +261,11 @@ define(['jquery', 'underscore', 'mediastream/peercall'], function($, _, PeerCall PeerConference.prototype.peerIds = function() { - return _.keys(this.calls); + var result = _.keys(this.calls); + if (this.currentcall && this.currentcall.id && result.indexOf(this.currentcall.id) === -1) { + result.push(this.currentcall.id); + } + return result; }; diff --git a/static/js/mediastream/webrtc.js b/static/js/mediastream/webrtc.js index 7678f7f3..e5c6dd61 100644 --- a/static/js/mediastream/webrtc.js +++ b/static/js/mediastream/webrtc.js @@ -373,6 +373,8 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u if (newcurrentcall && newcurrentcall != this.currentcall) { this.currentcall = newcurrentcall; this.e.triggerHandler("peercall", [newcurrentcall]); + } else if (!newcurrentcall) { + this.doHangup("receivedbye", targetcall.id); } if (this.currentconference && !this.currentconference.checkEmpty()) { this.e.triggerHandler("peerconference", [this.currentconference]);