Browse Source

Avoid spurious bye and close events and fixed hangup in certain conference cases.

pull/13/merge
Simon Eisenmann 12 years ago
parent
commit
dbf9a935d4
  1. 4
      static/js/mediastream/peercall.js
  2. 18
      static/js/mediastream/webrtc.js

4
static/js/mediastream/peercall.js

@ -271,6 +271,10 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection
PeerCall.prototype.close = function() { PeerCall.prototype.close = function() {
if (this.closed) {
return;
}
this.closed = true; this.closed = true;
_.each(this.datachannels, function(datachannel) { _.each(this.datachannels, function(datachannel) {

18
static/js/mediastream/webrtc.js

@ -152,7 +152,7 @@ define([
return; return;
} }
console.log("Bye process (started false)"); console.log("Bye process (started false)");
this.doHangup(); this.doHangup("receivedbye", from);
break; break;
default: default:
this.msgQueue.push([to, data, type, to2, from]); this.msgQueue.push([to, data, type, to2, from]);
@ -177,6 +177,10 @@ define([
targetcall = this.currentcall; targetcall = this.currentcall;
break; break;
} }
if (this.currentcall.id === id) {
targetcall = this.currentcall;
break;
}
if (this.currentconference) { if (this.currentconference) {
targetcall = this.currentconference.getCall(id) targetcall = this.currentconference.getCall(id)
} }
@ -280,16 +284,16 @@ define([
if (newcurrentcall) { if (newcurrentcall) {
this.currentcall = newcurrentcall; this.currentcall = newcurrentcall;
targetcall.close() targetcall.close()
this.api.sendBye(targetcall.id, null); //this.api.sendBye(targetcall.id, null);
this.e.triggerHandler("peercall", [newcurrentcall]); this.e.triggerHandler("peercall", [newcurrentcall]);
this.e.triggerHandler("peerconference", [this.currentconference]); this.e.triggerHandler("peerconference", [this.currentconference]);
} else { } else {
this.doHangup(); this.doHangup("receivedbye", targetcall.id);
this.e.triggerHandler("bye", [data.Reason, from, to, to2]); this.e.triggerHandler("bye", [data.Reason, from, to, to2]);
} }
} else { } else {
targetcall.close(); targetcall.close();
this.api.sendBye(targetcall.id, null); //this.api.sendBye(targetcall.id, null);
} }
break; break;
case "Conference": case "Conference":
@ -570,7 +574,9 @@ define([
} }
if (currentcall !== this.currentcall) { if (currentcall !== this.currentcall) {
currentcall.close(); currentcall.close();
this.api.sendBye(id, reason); if (reason !== "receivedbye") {
this.api.sendBye(id, reason);
}
if (this.currentcall && currentcall) { if (this.currentcall && currentcall) {
this.e.triggerHandler("statechange", ["connected", this.currentcall]); this.e.triggerHandler("statechange", ["connected", this.currentcall]);
} else { } else {
@ -585,7 +591,9 @@ define([
} }
this.stop(); this.stop();
if (id) { if (id) {
if (reason !== "receivedbye") {
this.api.sendBye(id, reason); this.api.sendBye(id, reason);
}
} }
} }

Loading…
Cancel
Save