forked from Mirrors/freeswitch
Merge pull request #501 in FS/freeswitch from vc-configs to master
* commit '34d72cba985247531c3745d649cc5b1947bc3f48': remove unused code FS-8183 #resolve #comment add google api logins to Verto Communicator FS-8102 #resolve #comment Add auto-provision/config support to VC
This commit is contained in:
commit
04b83a38be
@ -281,6 +281,7 @@ module.exports = function (grunt) {
|
||||
src: [
|
||||
'*.{ico,png,txt}',
|
||||
'*.html',
|
||||
'*.json',
|
||||
'partials/**/*.html',
|
||||
'images/{,*/}*.{webp}',
|
||||
'css/fonts/{,*/}*.*',
|
||||
|
@ -32,6 +32,7 @@
|
||||
"angular-prompt": "~1.1.1",
|
||||
"angular-animate": "~1.3.15",
|
||||
"angular-cookies": "~1.3.15",
|
||||
"angular-directive.g-signin": "~0.1.2",
|
||||
"jquery": "~2.1.4",
|
||||
"angular-fullscreen": "~1.0.1",
|
||||
"ngstorage": "~0.3.9",
|
||||
|
4
html5/verto/verto_communicator/src/config.json
Normal file
4
html5/verto/verto_communicator/src/config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"login": "1008",
|
||||
"password": "1234"
|
||||
}
|
13
html5/verto/verto_communicator/src/config.json.sample
Normal file
13
html5/verto/verto_communicator/src/config.json.sample
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"extension": "3500",
|
||||
"name": "Ken Rice",
|
||||
"email": "krice@freeswitch.org",
|
||||
"cid": "1008",
|
||||
"textTo": "1000",
|
||||
"login": "1008",
|
||||
"password": "1234",
|
||||
"autologin": "true",
|
||||
"autocall": "3500",
|
||||
"googlelogin": "true",
|
||||
"wsURL": "wss://gamma.tollfreegateway.com/wss2"
|
||||
}
|
@ -2,5 +2,6 @@
|
||||
"Jonatas Oliveira <jonatas@evolux.net.br>",
|
||||
"Ítalo Rossi <italo@evolux.net.br>",
|
||||
"Stefan Yohansson <stefan@evolux.net.br>",
|
||||
"João Mesquita <jmesquita@indicium.com.ar>"
|
||||
"João Mesquita <jmesquita@indicium.com.ar>",
|
||||
"Ken Rice <krice@freeswitch.org>"
|
||||
]
|
||||
|
@ -71,6 +71,7 @@
|
||||
<script src="bower_components/angular-prompt/dist/angular-prompt.js"></script>
|
||||
<script src="bower_components/angular-animate/angular-animate.js"></script>
|
||||
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
|
||||
<script src="bower_components/angular-directive.g-signin/google-plus-signin.js"></script>
|
||||
<script src="bower_components/angular-fullscreen/src/angular-fullscreen.js"></script>
|
||||
<script src="bower_components/ngstorage/ngStorage.js"></script>
|
||||
<script src="bower_components/momentjs/moment.js"></script>
|
||||
@ -121,9 +122,9 @@
|
||||
<script type="text/javascript" src="src/storageService/storageService.module.js"></script>
|
||||
<script type="text/javascript" src="src/storageService/services/storage.js"></script>
|
||||
<script type="text/javascript" src="src/storageService/services/call_history.js"></script>
|
||||
|
||||
<!-- endbuild -->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
<div class="panel-body">
|
||||
<h3>Login</h3>
|
||||
|
||||
|
||||
<div ng-show="form.$submitted && form.$invalid" class="alert alert-danger">
|
||||
<p>Verify the fields bellow and try again.</p>
|
||||
</div>
|
||||
@ -45,9 +46,14 @@
|
||||
<input type="text" class="form-control" id="login-password" placeholder="Password" ng-model="verto.data.password">
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a style="margin-top: 13px;" href="" ng-click="advanced = !advanced" class="pull-left">Settings</a>
|
||||
<button type="submit" class="btn btn-success" ng-click="(form.$valid && login())">Login</button>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<div><a style="margin-top: 13px;" href="" ng-click="advanced = !advanced" class="pull-left">Settings</a></div>
|
||||
<div><button type="submit" class="btn btn-success" ng-click="(form.$valid && login())">Login</button></div>
|
||||
<div ng-if="googlelogin" class="centered-block">
|
||||
<google-plus-signin clientid="675954646436-cuejgg314a32s2c76dnc2n7ier3kbudu.apps.googleusercontent.com" class="center">
|
||||
</google-plus-signin>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -13,6 +13,7 @@
|
||||
'cgPrompt',
|
||||
'720kb.tooltips',
|
||||
'ui.gravatar',
|
||||
'directive.g+signin',
|
||||
]);
|
||||
|
||||
vertoApp.config(['$routeProvider', 'gravatarServiceProvider',
|
||||
@ -33,11 +34,6 @@
|
||||
templateUrl: 'partials/incall.html',
|
||||
controller: 'InCallController'
|
||||
}).
|
||||
/*when('/contributors', {
|
||||
title: 'Contributors',
|
||||
templateUrl: 'partials/contributors.html',
|
||||
controller: 'ContributorsController',
|
||||
}).*/
|
||||
when('/browser-upgrade', {
|
||||
title: '',
|
||||
templateUrl: 'partials/browser_upgrade.html',
|
||||
@ -95,4 +91,4 @@
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
||||
})();
|
||||
|
@ -31,7 +31,18 @@
|
||||
* fill dialpad via querystring [?autocall=\d+]
|
||||
*/
|
||||
if ($location.search().autocall) {
|
||||
$rootScope.dialpadNumber = $location.search().autocall;
|
||||
$rootScope.dialpadNumber = $location.search().autocall;
|
||||
delete $location.search().autocall;
|
||||
call($rootScope.dialpadNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* fill in dialpad via config.json
|
||||
*/
|
||||
if ('autocall' in verto.data) {
|
||||
$rootScope.dialpadNumber = verto.data.autocall;
|
||||
delete verto.data.autocall;
|
||||
call($rootScope.dialpadNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,10 +60,7 @@
|
||||
verto.data.call.transfer($rootScope.dialpadNumber);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call to the number in the $rootScope.dialpadNumber.
|
||||
*/
|
||||
$rootScope.call = function(extension) {
|
||||
function call(extension) {
|
||||
storage.data.onHold = false;
|
||||
storage.data.cur_call = 0;
|
||||
$rootScope.dialpadNumber = extension;
|
||||
@ -79,6 +87,13 @@
|
||||
CallHistory.add($rootScope.dialpadNumber, 'outbound');
|
||||
$location.path('/incall');
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to the number in the $rootScope.dialpadNumber.
|
||||
*/
|
||||
$rootScope.call = function(extension) {
|
||||
return call(extension);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
|
@ -1,25 +1,59 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('vertoControllers')
|
||||
.controller('LoginController', ['$scope', '$http', '$location',
|
||||
'verto',
|
||||
function($scope, $http, $location, verto) {
|
||||
$scope.checkBrowser();
|
||||
angular
|
||||
.module('vertoControllers')
|
||||
.controller('LoginController', ['$scope', '$http', '$location', 'verto',
|
||||
function($scope, $http, $location, verto) {
|
||||
$scope.checkBrowser();
|
||||
|
||||
/**
|
||||
* using stored data (localStorage) for logon
|
||||
*/
|
||||
verto.data.name = $scope.storage.data.name;
|
||||
verto.data.email = $scope.storage.data.email;
|
||||
if ($scope.storage.data.login != '' && $scope.storage.data.password != '') {
|
||||
verto.data.login = $scope.storage.data.login;
|
||||
verto.data.password = $scope.storage.data.password;
|
||||
}
|
||||
/*
|
||||
* Load the Configs before logging in
|
||||
* with cache buster
|
||||
*/
|
||||
|
||||
$http.get(window.location.pathname + '/config.json?cachebuster=' + Math.floor((Math.random()*1000000)+1))
|
||||
.success(function(data) {
|
||||
|
||||
/* save these for later as we're about to possibly over write them */
|
||||
var name = verto.data.name;
|
||||
var email = verto.data.email;
|
||||
|
||||
console.debug("googlelogin: " + data.googlelogin);
|
||||
if (data.googlelogin){
|
||||
$scope.googlelogin = data.googlelogin;
|
||||
}
|
||||
|
||||
angular.extend(verto.data, data);
|
||||
|
||||
/**
|
||||
* use stored data (localStorage) for login, allow config.json to take precedence
|
||||
*/
|
||||
|
||||
if (name != '' && data.name == '') {
|
||||
verto.data.name = name;
|
||||
}
|
||||
if (email != '' && data.email == '') {
|
||||
verto.data.email = email;
|
||||
}
|
||||
if (verto.data.login == '' && verto.data.password == '' && $scope.storage.data.login != '' && $scope.storage.data.password != '') {
|
||||
verto.data.login = $scope.storage.data.login;
|
||||
verto.data.password = $scope.storage.data.password;
|
||||
}
|
||||
|
||||
if (verto.data.autologin == "true" && !verto.data.autologin_done) {
|
||||
console.debug("auto login per config.json");
|
||||
verto.data.autologin_done = true;
|
||||
$scope.login();
|
||||
}
|
||||
});
|
||||
|
||||
verto.data.name = $scope.storage.data.name;
|
||||
verto.data.email = $scope.storage.data.email;
|
||||
|
||||
console.debug('Executing LoginController.');
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
||||
|
||||
console.debug('Executing LoginController.');
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
@ -88,6 +88,10 @@
|
||||
var disconnectCallback = function(v, connected) {
|
||||
console.debug('Redirecting to login page.');
|
||||
storage.reset();
|
||||
if (typeof gapi !== 'undefined'){
|
||||
console.debug(gapi);
|
||||
gapi.auth.signOut();
|
||||
}
|
||||
$location.path('/login');
|
||||
};
|
||||
|
||||
@ -275,6 +279,40 @@
|
||||
|
||||
});
|
||||
|
||||
$scope.$on('event:google-plus-signin-success', function (event,authResult) {
|
||||
// Send login to server or save into cookie
|
||||
console.log('Google+ Login Success');
|
||||
console.log(authResult);
|
||||
gapi.client.load('plus', 'v1', gapiClientLoaded);
|
||||
});
|
||||
|
||||
function gapiClientLoaded() {
|
||||
gapi.client.plus.people.get({userId: 'me'}).execute(handleEmailResponse);
|
||||
}
|
||||
|
||||
function handleEmailResponse(resp){
|
||||
var primaryEmail;
|
||||
for (var i=0; i < resp.emails.length; i++) {
|
||||
if (resp.emails[i].type === 'account') primaryEmail = resp.emails[i].value;
|
||||
}
|
||||
console.debug("Primary Email: " + primaryEmail );
|
||||
console.debug("display name: " + resp.displayName);
|
||||
console.debug("imageurl: " + resp.image.url);
|
||||
console.debug(resp);
|
||||
console.debug(verto.data);
|
||||
verto.data.email = primaryEmail;
|
||||
verto.data.name = resp.displayName;
|
||||
storage.data.name = verto.data.name;
|
||||
storage.data.email = verto.data.email;
|
||||
|
||||
$scope.login();
|
||||
}
|
||||
|
||||
$scope.$on('event:google-plus-signin-failure', function (event,authResult) {
|
||||
// Auth failure or signout detected
|
||||
console.log('Google+ Login Failure');
|
||||
});
|
||||
|
||||
$rootScope.callActive = function(data) {
|
||||
verto.data.mutedMic = storage.data.mutedMic;
|
||||
verto.data.mutedVideo = storage.data.mutedVideo;
|
||||
|
Loading…
Reference in New Issue
Block a user