From fc3f66b1b9555441b25c6d6dc151dade52a1bd5e Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 25 Oct 2016 10:40:38 +0200 Subject: [PATCH] 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). --- static/js/mediastream/peercall.js | 5 +++-- static/js/mediastream/webrtc.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/static/js/mediastream/peercall.js b/static/js/mediastream/peercall.js index 69d10e6f..5eaca152 100644 --- a/static/js/mediastream/peercall.js +++ b/static/js/mediastream/peercall.js @@ -22,12 +22,13 @@ "use strict"; 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.id = id; this.from = from; this.to = to; + this.outgoing = !!outgoing; this.e = $({}) // events @@ -49,7 +50,7 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection }; PeerCall.prototype.isOutgoing = function() { - return !!this.from; + return this.outgoing; }; PeerCall.prototype.setInitiate = function(initiate) { diff --git a/static/js/mediastream/webrtc.js b/static/js/mediastream/webrtc.js index 0d976d7f..e4288a4e 100644 --- a/static/js/mediastream/webrtc.js +++ b/static/js/mediastream/webrtc.js @@ -461,8 +461,8 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u }; - WebRTC.prototype.createCall = function(id, from, to) { - var call = new PeerCall(this, id, from, to); + WebRTC.prototype.createCall = function(id, from, to, outgoing) { + var call = new PeerCall(this, id, from, to, outgoing); call.e.on("connectionStateChange", _.bind(function(event, iceConnectionState, currentcall) { this.onConnectionStateChange(iceConnectionState, currentcall); }, this)); @@ -577,7 +577,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u }; WebRTC.prototype.doCall = function(id, autocall) { - var call = this.createCall(id, null, id); + var call = this.createCall(id, null, id, true); call.setInitiate(true); var count = this.conference.getCallsCount(); if (!this.conference.addOutgoing(id, call)) {