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

18
static/js/mediastream/webrtc.js

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

Loading…
Cancel
Save