Browse Source

Explicitly pass "outgoing" flag when creating PeerCall object.

This fixes #377 where no ringing sound was played back because the call
was not seen as "outgoing" (and also fixes the missing timeout if the
called peer does not pick up).
pull/378/head
Joachim Bauch 9 years ago
parent
commit
fc3f66b1b9
  1. 5
      static/js/mediastream/peercall.js
  2. 6
      static/js/mediastream/webrtc.js

5
static/js/mediastream/peercall.js

@ -22,12 +22,13 @@
"use strict"; "use strict";
define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection'], function($, _, utils, PeerConnection) { define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection'], function($, _, utils, PeerConnection) {
var PeerCall = function(webrtc, id, from, to) { var PeerCall = function(webrtc, id, from, to, outgoing) {
this.webrtc = webrtc; this.webrtc = webrtc;
this.id = id; this.id = id;
this.from = from; this.from = from;
this.to = to; this.to = to;
this.outgoing = !!outgoing;
this.e = $({}) // events this.e = $({}) // events
@ -49,7 +50,7 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection
}; };
PeerCall.prototype.isOutgoing = function() { PeerCall.prototype.isOutgoing = function() {
return !!this.from; return this.outgoing;
}; };
PeerCall.prototype.setInitiate = function(initiate) { PeerCall.prototype.setInitiate = function(initiate) {

6
static/js/mediastream/webrtc.js

@ -461,8 +461,8 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
}; };
WebRTC.prototype.createCall = function(id, from, to) { WebRTC.prototype.createCall = function(id, from, to, outgoing) {
var call = new PeerCall(this, id, from, to); var call = new PeerCall(this, id, from, to, outgoing);
call.e.on("connectionStateChange", _.bind(function(event, iceConnectionState, currentcall) { call.e.on("connectionStateChange", _.bind(function(event, iceConnectionState, currentcall) {
this.onConnectionStateChange(iceConnectionState, currentcall); this.onConnectionStateChange(iceConnectionState, currentcall);
}, this)); }, this));
@ -577,7 +577,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
}; };
WebRTC.prototype.doCall = function(id, autocall) { WebRTC.prototype.doCall = function(id, autocall) {
var call = this.createCall(id, null, id); var call = this.createCall(id, null, id, true);
call.setInitiate(true); call.setInitiate(true);
var count = this.conference.getCallsCount(); var count = this.conference.getCallsCount();
if (!this.conference.addOutgoing(id, call)) { if (!this.conference.addOutgoing(id, call)) {

Loading…
Cancel
Save