]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8214 [verto_communicator] Better handling calls in VC, answering them respecting...
authorItalo Rossi <italorossib@gmail.com>
Sat, 26 Sep 2015 21:17:08 +0000 (18:17 -0300)
committerItalo Rossi <italorossib@gmail.com>
Sat, 26 Sep 2015 21:17:08 +0000 (18:17 -0300)
html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js
html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js
html5/verto/verto_communicator/src/vertoDirectives/directives/videoTag.js
html5/verto/verto_communicator/src/vertoService/services/vertoService.js

index 0bb3f6f6a0a20aa45c5086439605fc770a3803ce..2985ff4946ffc842f20cbf461568d9a2c194ae0d 100644 (file)
       });
 
       $rootScope.$on('members.clear', function(event) {
-        $scope.$apply(function() {
+        $scope.$applyAsync(function() {
           clearConferenceChat();
           $scope.closeChat();
         });
index 61f56954e4e157871b877d2fb99d57657a9afea2..ded1689e240cbc22f17e7806c637347b08bd3703 100644 (file)
         console.log('Google+ Login Failure');
       });
 
-      $rootScope.callActive = function(data) {
+      $rootScope.callActive = function(data, params) {
         verto.data.mutedMic = storage.data.mutedMic;
         verto.data.mutedVideo = storage.data.mutedVideo;
 
         storage.data.calling = false;
 
         storage.data.cur_call = 1;
+
+        $location.path('/incall');
+
+        if(params.useVideo) {
+          $rootScope.$emit('call.video', 'video');
+        }
       };
 
-      $rootScope.$on('call.active', function(event, data) {
-        $rootScope.callActive(data);
+      $rootScope.$on('call.active', function(event, data, params) {
+        $rootScope.callActive(data, params);
       });
 
       $rootScope.$on('call.calling', function(event, data) {
         if (!verto.data.call) {
           toastr.warning('There is no call to hangup.');
           $location.path('/dialpad');
+          return;
         }
 
         //var hangupCallback = function(v, hangup) {
         if (verto.data.shareCall) {
           verto.screenshareHangup();
         }
+
         verto.hangup();
+
+        $location.path('/dialpad');
       };
 
       $scope.answerCall = function() {
         verto.data.call.answer({
           useStereo: storage.data.useStereo,
           useCamera: storage.data.selectedVideo,
+          useVideo: storage.data.useVideo,
           useMic: storage.data.useMic,
           callee_id_name: verto.data.name,
           callee_id_number: verto.data.login
index 2e851685691da75f8c6c17286d59a345f2fd5ba3..38b50552f7e1a78684fd139ee41aa9cb528e7600 100644 (file)
@@ -18,7 +18,7 @@
       console.log('Moving the video to element.');
       jQuery('video').removeClass('hide').appendTo(element);
       jQuery('video').css('display', 'block');
-      scope.callActive();
+      scope.callActive("", {useVideo: true});
 
       element.on('$destroy', function() {
         // Move the video back to the body.
index 899fb10f97a83a6d522b8119e2b1349a183e0bd0..74e0bf9887321bcbbddf38b8b0fb009200c73658 100644 (file)
@@ -143,8 +143,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
       $rootScope.$emit('page.incall', 'call');
     }
 
-    function callActive(last_state) {
-      $rootScope.$emit('call.active', last_state);
+    function callActive(last_state, params) {
+      $rootScope.$emit('call.active', last_state, params);
     }
 
     function calling() {
@@ -488,6 +488,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
                 });
                 break;
               default:
+                console.warn('Got a not implemented message:', msg, dialog, params);
                 break;
             }
           },
@@ -495,9 +496,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
           onDialogState: function(d) {
             if (!data.call) {
               data.call = d;
-              if (d.state.name !== 'ringing') {
-                inCall();
-              }
+
             }
 
             console.debug('onDialogState:', d);
@@ -517,7 +516,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
               case "active":
                 console.debug('Talking to:', d.cidString());
                 data.callState = 'active';
-                callActive(d.lastState.name);
+                callActive(d.lastState.name, d.params);
                 break;
               case "hangup":
                 console.debug('Call ended with cause: ' + d.cause);
@@ -532,6 +531,9 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
                   cleanCall();
                 }
                 break;
+              default:
+                console.warn('Got a not implemented state:', d);
+                break;
             }
           },