FS-8214 [verto_communicator] Better handling calls in VC, answering them respecting useVideo param

This commit is contained in:
Italo Rossi 2015-09-26 18:17:08 -03:00
parent c266c5e6b3
commit 0b757c7b60
4 changed files with 24 additions and 11 deletions

View File

@ -122,7 +122,7 @@
}); });
$rootScope.$on('members.clear', function(event) { $rootScope.$on('members.clear', function(event) {
$scope.$apply(function() { $scope.$applyAsync(function() {
clearConferenceChat(); clearConferenceChat();
$scope.closeChat(); $scope.closeChat();
}); });

View File

@ -302,7 +302,7 @@
console.log('Google+ Login Failure'); console.log('Google+ Login Failure');
}); });
$rootScope.callActive = function(data) { $rootScope.callActive = function(data, params) {
verto.data.mutedMic = storage.data.mutedMic; verto.data.mutedMic = storage.data.mutedMic;
verto.data.mutedVideo = storage.data.mutedVideo; verto.data.mutedVideo = storage.data.mutedVideo;
@ -320,10 +320,16 @@
storage.data.calling = false; storage.data.calling = false;
storage.data.cur_call = 1; storage.data.cur_call = 1;
$location.path('/incall');
if(params.useVideo) {
$rootScope.$emit('call.video', 'video');
}
}; };
$rootScope.$on('call.active', function(event, data) { $rootScope.$on('call.active', function(event, data, params) {
$rootScope.callActive(data); $rootScope.callActive(data, params);
}); });
$rootScope.$on('call.calling', function(event, data) { $rootScope.$on('call.calling', function(event, data) {
@ -369,6 +375,7 @@
if (!verto.data.call) { if (!verto.data.call) {
toastr.warning('There is no call to hangup.'); toastr.warning('There is no call to hangup.');
$location.path('/dialpad'); $location.path('/dialpad');
return;
} }
//var hangupCallback = function(v, hangup) { //var hangupCallback = function(v, hangup) {
@ -383,7 +390,10 @@
if (verto.data.shareCall) { if (verto.data.shareCall) {
verto.screenshareHangup(); verto.screenshareHangup();
} }
verto.hangup(); verto.hangup();
$location.path('/dialpad');
}; };
$scope.answerCall = function() { $scope.answerCall = function() {
@ -392,6 +402,7 @@
verto.data.call.answer({ verto.data.call.answer({
useStereo: storage.data.useStereo, useStereo: storage.data.useStereo,
useCamera: storage.data.selectedVideo, useCamera: storage.data.selectedVideo,
useVideo: storage.data.useVideo,
useMic: storage.data.useMic, useMic: storage.data.useMic,
callee_id_name: verto.data.name, callee_id_name: verto.data.name,
callee_id_number: verto.data.login callee_id_number: verto.data.login

View File

@ -18,7 +18,7 @@
console.log('Moving the video to element.'); console.log('Moving the video to element.');
jQuery('video').removeClass('hide').appendTo(element); jQuery('video').removeClass('hide').appendTo(element);
jQuery('video').css('display', 'block'); jQuery('video').css('display', 'block');
scope.callActive(); scope.callActive("", {useVideo: true});
element.on('$destroy', function() { element.on('$destroy', function() {
// Move the video back to the body. // Move the video back to the body.

View File

@ -143,8 +143,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
$rootScope.$emit('page.incall', 'call'); $rootScope.$emit('page.incall', 'call');
} }
function callActive(last_state) { function callActive(last_state, params) {
$rootScope.$emit('call.active', last_state); $rootScope.$emit('call.active', last_state, params);
} }
function calling() { function calling() {
@ -488,6 +488,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
}); });
break; break;
default: default:
console.warn('Got a not implemented message:', msg, dialog, params);
break; break;
} }
}, },
@ -495,9 +496,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
onDialogState: function(d) { onDialogState: function(d) {
if (!data.call) { if (!data.call) {
data.call = d; data.call = d;
if (d.state.name !== 'ringing') {
inCall();
}
} }
console.debug('onDialogState:', d); console.debug('onDialogState:', d);
@ -517,7 +516,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
case "active": case "active":
console.debug('Talking to:', d.cidString()); console.debug('Talking to:', d.cidString());
data.callState = 'active'; data.callState = 'active';
callActive(d.lastState.name); callActive(d.lastState.name, d.params);
break; break;
case "hangup": case "hangup":
console.debug('Call ended with cause: ' + d.cause); console.debug('Call ended with cause: ' + d.cause);
@ -532,6 +531,9 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
cleanCall(); cleanCall();
} }
break; break;
default:
console.warn('Got a not implemented state:', d);
break;
} }
}, },