Less buggy rejection of calls when busy
parent
6f256e6380
commit
55fe0d8adc
|
@ -134,6 +134,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
||||||
if ($rootScope.currentCall && $rootScope.currentCall.state != 'ended') {
|
if ($rootScope.currentCall && $rootScope.currentCall.state != 'ended') {
|
||||||
console.trace("rejecting call because we're already in a call");
|
console.trace("rejecting call because we're already in a call");
|
||||||
call.hangup();
|
call.hangup();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
call.onError = $scope.onCallError;
|
call.onError = $scope.onCallError;
|
||||||
call.onHangup = $scope.onCallHangup;
|
call.onHangup = $scope.onCallHangup;
|
||||||
|
@ -152,13 +153,15 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
||||||
$scope.feedback = errStr;
|
$scope.feedback = errStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.onCallHangup = function() {
|
$rootScope.onCallHangup = function(call) {
|
||||||
$timeout(function() {
|
if (call == $rootScope.currentCall) {
|
||||||
var icon = angular.element('#callEndedIcon');
|
$timeout(function() {
|
||||||
$animate.addClass(icon, 'callIconRotate');
|
var icon = angular.element('#callEndedIcon');
|
||||||
$timeout(function(){
|
$animate.addClass(icon, 'callIconRotate');
|
||||||
$rootScope.currentCall = undefined;
|
$timeout(function(){
|
||||||
}, 4070);
|
$rootScope.currentCall = undefined;
|
||||||
}, 100);
|
}, 4070);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -114,7 +114,7 @@ angular.module('MatrixCall', [])
|
||||||
};
|
};
|
||||||
matrixService.sendEvent(this.room_id, 'm.call.hangup', undefined, content).then(this.messageSent, this.messageSendFailed);
|
matrixService.sendEvent(this.room_id, 'm.call.hangup', undefined, content).then(this.messageSent, this.messageSendFailed);
|
||||||
this.state = 'ended';
|
this.state = 'ended';
|
||||||
self.onHangup();
|
if (self.onHangup) self.onHangup(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
MatrixCall.prototype.gotUserMediaForInvite = function(stream) {
|
MatrixCall.prototype.gotUserMediaForInvite = function(stream) {
|
||||||
|
@ -178,6 +178,10 @@ angular.module('MatrixCall', [])
|
||||||
|
|
||||||
MatrixCall.prototype.gotRemoteIceCandidate = function(cand) {
|
MatrixCall.prototype.gotRemoteIceCandidate = function(cand) {
|
||||||
console.trace("Got ICE candidate from remote: "+cand);
|
console.trace("Got ICE candidate from remote: "+cand);
|
||||||
|
if (this.state == 'ended') {
|
||||||
|
console.trace("Ignoring remote ICE candidate because call has ended");
|
||||||
|
return;
|
||||||
|
}
|
||||||
var candidateObject = new RTCIceCandidate({
|
var candidateObject = new RTCIceCandidate({
|
||||||
sdpMLineIndex: cand.label,
|
sdpMLineIndex: cand.label,
|
||||||
candidate: cand.candidate
|
candidate: cand.candidate
|
||||||
|
@ -294,10 +298,10 @@ angular.module('MatrixCall', [])
|
||||||
self = this;
|
self = this;
|
||||||
$rootScope.$apply(function() {
|
$rootScope.$apply(function() {
|
||||||
self.state = 'ended';
|
self.state = 'ended';
|
||||||
this.hangupParty = 'remote';
|
self.hangupParty = 'remote';
|
||||||
self.stopAllMedia();
|
self.stopAllMedia();
|
||||||
this.peerConn.close();
|
if (self.peerConn.signalingState != 'closed') self.peerConn.close();
|
||||||
self.onHangup();
|
if (self.onHangup) self.onHangup(self);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,7 +317,7 @@ angular.module('MatrixCall', [])
|
||||||
this.hangupParty = 'remote';
|
this.hangupParty = 'remote';
|
||||||
this.stopAllMedia();
|
this.stopAllMedia();
|
||||||
this.peerConn.close();
|
this.peerConn.close();
|
||||||
this.onHangup();
|
if (this.onHangup) this.onHangup(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
return MatrixCall;
|
return MatrixCall;
|
||||||
|
|
Loading…
Reference in New Issue