]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7840 [verto_communicator] Use chatChannel to send and receive messages from confer...
authorJoao Mesquita <jmesquita@indicium.com.ar>
Fri, 28 Aug 2015 21:57:48 +0000 (18:57 -0300)
committerJoao Mesquita <jmesquita@indicium.com.ar>
Fri, 28 Aug 2015 21:57:48 +0000 (18:57 -0300)
html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js
html5/verto/verto_communicator/src/vertoService/services/vertoService.js

index 50acfa6195babc812c6496d53959d8f023f76599..0bb3f6f6a0a20aa45c5086439605fc770a3803ce 100644 (file)
        * Public methods.
        */
       $scope.send = function() {
-        verto.sendMessage($scope.message, function() {
-          $scope.message = CLEAN_MESSAGE;
-        });
+        // Only conferencing chat is supported for now
+        // but still calling method with the conference prefix
+        // so we know that explicitly.
+        verto.sendConferenceChat($scope.message);
+        $scope.message = CLEAN_MESSAGE;
       };
 
       // Participants moderation.
index 7a6e90c701ae31e46acb73c469319ed7c6c5e9ef..71bd3457215a470cf3c808e9a16fd135b4271c67 100644 (file)
@@ -335,6 +335,14 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
             dialog: dialog,
             hasVid: storage.data.useVideo,
             laData: pvtData,
+            chatCallback: function(v, e) {
+              var from = e.data.fromDisplay || e.data.from || "Unknown";
+              var message = e.data.message || "";
+              $rootScope.$emit('chat.newMessage', {
+                from: from,
+                body: message
+              });
+            },
             onBroadcast: function(v, conf, message) {
               console.log('>>> conf.onBroadcast:', arguments);
               if (message.action == 'response') {
@@ -441,6 +449,10 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
                   }
                 }
                 break;
+              /**
+                * This is not being used for conferencing chat
+                * anymore (see conf.chatCallback for that).
+                */
               case $.verto.enum.message.info:
                 var body = params.body;
                 var from = params.from_msg_name || params.from;
@@ -750,7 +762,16 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
           callback(data.instance, true);
         }
       },
-
+      /*
+      * Method is used to send conference chats ONLY.
+      */
+      sendConferenceChat: function(message) {
+        data.conf.sendChat(message, "message");
+      },
+      /*
+      * Method is used to send user2user chats.
+      * VC does not yet support that.
+      */
       sendMessage: function(body, callback) {
         data.call.message({
           to: data.chattingWith,