summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-08-28 19:03:34 +0100
committerDavid Baker <dbkr@matrix.org>2014-08-28 19:03:34 +0100
commitca7426eee0f1d421815ff1921bfd2a5cd03c960f (patch)
tree2d85533f4462c81481369c8ffa90c97e38f00fef /webclient/room/room-controller.js
parentWIP voip support on web client (diff)
downloadsynapse-ca7426eee0f1d421815ff1921bfd2a5cd03c960f.tar.xz
First basic working VoIP call support
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index de3738ca0e..c596af820c 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -85,6 +85,9 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
 
     $rootScope.$on(matrixPhoneService.CALL_EVENT, function(ngEvent, call) {
         console.trace("incoming call");
+        call.onError = $scope.onCallError;
+        call.onHangup = $scope.onCallHangup;
+        $scope.currentCall = call;
     });
     
     $scope.paginateMore = function() {
@@ -93,6 +96,15 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
             paginate(MESSAGES_PER_PAGINATION);
         }
     };
+
+    $scope.answerCall = function() {
+        $scope.currentCall.answer();
+    };
+
+    $scope.hangupCall = function() {
+        $scope.currentCall.hangup();
+        $scope.currentCall = undefined;
+    };
         
     var paginate = function(numItems) {
         // console.log("paginate " + numItems);
@@ -438,10 +450,17 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
     $scope.startVoiceCall = function() {
         var call = new MatrixCall($scope.room_id);
         call.onError = $scope.onCallError;
+        call.onHangup = $scope.onCallHangup;
         call.placeCall();
+        $scope.currentCall = call;
     }
 
     $scope.onCallError = function(errStr) {
         $scope.feedback = errStr;
     }
+
+    $scope.onCallHangup = function() {
+        $scope.feedback = "Call ended";
+        $scope.currentCall = undefined;
+    }
 }]);