From efeb720a01993a52f2614cbcab14995a88af2721 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 9 Sep 2015 15:17:20 -0400 Subject: [PATCH 001/126] FS-8034: mod_opus: send correct (configured) fmtp ptime,minptime,maxptime when originating call --- src/mod/codecs/mod_opus/mod_opus.c | 37 +++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index c38a92c470..98ae352cea 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -63,8 +63,23 @@ static opus_codec_settings_t default_codec_settings = { /*.cbr*/ 0, /*.sprop_maxcapturerate*/ 0, /*.sprop_stereo*/ 0, - /*.maxptime*/ 0, - /*.minptime*/ 0, + /*.maxptime*/ 40, + /*.minptime*/ 10, + /*.ptime*/ 0, + /*.samplerate*/ 0 +}; + +static opus_codec_settings_t default_codec_settings_8k = { + /*.useinbandfec */ 1, + /*.usedtx */ 1, + /*.maxaveragebitrate */ 14000, + /*.maxplaybackrate */ 8000, + /*.stereo*/ 0, + /*.cbr*/ 0, + /*.sprop_maxcapturerate*/ 8000, + /*.sprop_stereo*/ 0, + /*.maxptime*/ 120, + /*.minptime*/ 10, /*.ptime*/ 0, /*.samplerate*/ 0 }; @@ -907,8 +922,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) for (x = 0; x < 3; x++) { settings.ptime = mss / 1000; - settings.maxptime = settings.ptime; - settings.minptime = settings.ptime; settings.samplerate = rate; settings.stereo = 0; dft_fmtp = gen_fmtp(&settings, pool); @@ -966,11 +979,21 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) mss = 10000; rate = 8000; + settings = default_codec_settings_8k; + + if (opus_prefs.maxaveragebitrate) { + settings.maxaveragebitrate = opus_prefs.maxaveragebitrate; + } + if (opus_prefs.maxplaybackrate) { + settings.maxplaybackrate = opus_prefs.maxplaybackrate; + } + if (opus_prefs.sprop_maxcapturerate) { + settings.sprop_maxcapturerate = opus_prefs.sprop_maxcapturerate; + } + for (x = 0; x < 3; x++) { settings.stereo = 0; settings.ptime = mss / 1000; - settings.maxptime = settings.ptime; - settings.minptime = settings.ptime; settings.samplerate = rate; dft_fmtp = gen_fmtp(&settings, pool); @@ -1015,6 +1038,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) if (x == 1) { /*20 ms * 3 = 60 ms */ int nb_frames; settings.stereo = 0; + settings.ptime = mss * 3 / 1000; dft_fmtp = gen_fmtp(&settings, pool); switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 116, /* the IANA code number */ @@ -1038,6 +1062,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) for (nb_frames = 4; nb_frames <= 6; nb_frames++) { /*20 ms * nb_frames = 80 ms , 100 ms , 120 ms */ settings.stereo = 0; + settings.ptime = mss * nb_frames / 1000; dft_fmtp = gen_fmtp(&settings, pool); switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 116, /* the IANA code number */ From 6385fb863a7e800dbb2668fd0ed4e1203b1ba18e Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 17 Sep 2015 12:52:55 -0400 Subject: [PATCH 002/126] FS-8161: mod_opus: Keep FEC enabled only if loss > 10 ( otherwise PLC is supposed to be better) --- src/mod/codecs/mod_opus/mod_opus.c | 63 +++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 6f56727667..74f797512a 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -309,6 +309,33 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng return SWITCH_FALSE; } +/* this is only useful for fs = 8000 hz, the map is only used + * at the beginning of the call. */ +static int switch_opus_get_fec_bitrate(int fs, int loss) +{ + int threshold_bitrates[25] = { + 15600,15200,15200,15200,14800, + 14800,14800,14800,14400,14400, + 14400,14000,14000,14000,13600, + 13600,13600,13600,13200,13200, + 13200,12800,12800,12800,12400 + }; + + if (loss <= 0){ + return SWITCH_STATUS_FALSE; + } + + if (fs == 8000) { + if (loss >=25) { + return threshold_bitrates[24]; + } else { + return threshold_bitrates[loss-1]; + } + } + + return SWITCH_STATUS_FALSE ; +} + static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint32_t samples_per_second, char *print_text) { int nb_samples; @@ -493,7 +520,20 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag } if (opus_codec_settings.useinbandfec) { + /* FEC on the encoder: start the call with a preconfigured packet loss percentage */ + int fec_bitrate = opus_codec_settings.maxaveragebitrate; + int loss_percent = opus_prefs.plpct ; opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC(opus_codec_settings.useinbandfec)); + opus_encoder_ctl(context->encoder_object, OPUS_SET_PACKET_LOSS_PERC(loss_percent)); + if (opus_prefs.keep_fec){ + fec_bitrate = switch_opus_get_fec_bitrate(enc_samplerate,loss_percent); + /* keep a bitrate for which the encoder will always add FEC */ + if (fec_bitrate != SWITCH_STATUS_FALSE) { + opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(fec_bitrate)); + /* will override the maxaveragebitrate set in opus.conf.xml */ + opus_codec_settings.maxaveragebitrate = fec_bitrate; + } + } } if (opus_codec_settings.usedtx) { @@ -954,18 +994,21 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, plpct = 100; } - calc = plpct % 10; - plpct = plpct - calc + ( calc ? 10 : 0); - - if (opus_prefs.plpct > 0 && plpct < opus_prefs.plpct) { - plpct = opus_prefs.plpct; - } - - if (plpct != context->old_plpct) { + if (opus_prefs.keep_fec) { opus_encoder_ctl(context->encoder_object, OPUS_SET_PACKET_LOSS_PERC(plpct)); - + } else { + calc = plpct % 10; + plpct = plpct - calc + ( calc ? 10 : 0); + } + if (plpct != context->old_plpct) { if (opus_prefs.keep_fec) { - switch_opus_keep_fec_enabled(codec); + if (plpct > 10) { + /* this will increase bitrate a little bit, just to keep FEC enabled */ + switch_opus_keep_fec_enabled(codec); + } + } else { + /* this can have no effect because FEC is F(bitrate,packetloss), let the codec decide if FEC is to be used or not */ + opus_encoder_ctl(context->encoder_object, OPUS_SET_PACKET_LOSS_PERC(plpct)); } if (globals.debug || context->debug) { From 62d4d47b1a09075acc19cd792a90468d50e6cb14 Mon Sep 17 00:00:00 2001 From: Sergey Safarov Date: Wed, 26 Aug 2015 13:43:13 +0300 Subject: [PATCH 003/126] FS-8198: Fixed default CRLF sequence in t38 SDP --- src/switch_core_media.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0ffe6a6878..c31e334776 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -8306,13 +8306,13 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t uint32_t port; const char *family = "IP4"; const char *username; - const char *bit_removal_on = "a=T38FaxFillBitRemoval\n"; + const char *bit_removal_on = "a=T38FaxFillBitRemoval\r\n"; const char *bit_removal_off = ""; - const char *mmr_on = "a=T38FaxTranscodingMMR\n"; + const char *mmr_on = "a=T38FaxTranscodingMMR\r\n"; const char *mmr_off = ""; - const char *jbig_on = "a=T38FaxTranscodingJBIG\n"; + const char *jbig_on = "a=T38FaxTranscodingJBIG\r\n"; const char *jbig_off = ""; const char *var; int broken_boolean; @@ -8375,46 +8375,46 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t switch_snprintf(buf, sizeof(buf), - "v=0\n" - "o=%s %010u %010u IN %s %s\n" - "s=%s\n" "c=IN %s %s\n" "t=0 0\n", username, smh->owner_id, smh->session_id, family, ip, username, family, ip); + "v=0\r\n" + "o=%s %010u %010u IN %s %s\r\n" + "s=%s\r\n" "c=IN %s %s\r\n" "t=0 0\r\n", username, smh->owner_id, smh->session_id, family, ip, username, family, ip); if (t38_options->T38FaxMaxBuffer) { - switch_snprintf(max_buf, sizeof(max_buf), "a=T38FaxMaxBuffer:%d\n", t38_options->T38FaxMaxBuffer); + switch_snprintf(max_buf, sizeof(max_buf), "a=T38FaxMaxBuffer:%d\r\n", t38_options->T38FaxMaxBuffer); }; if (t38_options->T38FaxMaxDatagram) { - switch_snprintf(max_data, sizeof(max_data), "a=T38FaxMaxDatagram:%d\n", t38_options->T38FaxMaxDatagram); + switch_snprintf(max_data, sizeof(max_data), "a=T38FaxMaxDatagram:%d\r\n", t38_options->T38FaxMaxDatagram); }; if (broken_boolean) { - bit_removal_on = "a=T38FaxFillBitRemoval:1\n"; - bit_removal_off = "a=T38FaxFillBitRemoval:0\n"; + bit_removal_on = "a=T38FaxFillBitRemoval:1\r\n"; + bit_removal_off = "a=T38FaxFillBitRemoval:0\r\n"; - mmr_on = "a=T38FaxTranscodingMMR:1\n"; - mmr_off = "a=T38FaxTranscodingMMR:0\n"; + mmr_on = "a=T38FaxTranscodingMMR:1\r\n"; + mmr_off = "a=T38FaxTranscodingMMR:0\r\n"; - jbig_on = "a=T38FaxTranscodingJBIG:1\n"; - jbig_off = "a=T38FaxTranscodingJBIG:0\n"; + jbig_on = "a=T38FaxTranscodingJBIG:1\r\n"; + jbig_off = "a=T38FaxTranscodingJBIG:0\r\n"; } switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "m=image %d udptl t38\n" - "a=T38FaxVersion:%d\n" - "a=T38MaxBitRate:%d\n" + "m=image %d udptl t38\r\n" + "a=T38FaxVersion:%d\r\n" + "a=T38MaxBitRate:%d\r\n" "%s" "%s" "%s" - "a=T38FaxRateManagement:%s\n" + "a=T38FaxRateManagement:%s\r\n" "%s" "%s" - "a=T38FaxUdpEC:%s\n", - //"a=T38VendorInfo:%s\n", + "a=T38FaxUdpEC:%s\r\n", + //"a=T38VendorInfo:%s\r\n", port, t38_options->T38FaxVersion, t38_options->T38MaxBitRate, @@ -8431,7 +8431,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t if (insist) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio 0 RTP/AVP 19\n"); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio 0 RTP/AVP 19\r\n"); } switch_core_media_set_local_sdp(session, buf, SWITCH_TRUE); From 5f4aaa4a11b2368df88c3b07af1785bfb9b5b5e1 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 10:11:48 -0300 Subject: [PATCH 004/126] fix identation --- .../controllers/LoginController.js | 68 +++++-------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js index bae60ac31e..c9f3e5b74e 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js @@ -1,60 +1,24 @@ (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) { + var preRoute = function() { + if(verto.data.connected) { + $location.path('/dialpad'); + } + } + preRoute(); - /* - * 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) { + verto.data.name = $scope.storage.data.name; + verto.data.email = $scope.storage.data.email; - /* 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; - $scope.googleclientid = data.googleclientid; - } - - 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.'); + } + ]); })(); From 77fd36fa24c3093cb3daa38e5276ab7f048fd28d Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 10:27:00 -0300 Subject: [PATCH 005/126] FS-8205 [verto_communicator] Add splash screen feature --- html5/verto/js/src/jquery.verto.js | 17 +- .../verto_communicator/src/css/verto.css | 23 ++ html5/verto/verto_communicator/src/index.html | 3 + .../src/partials/splash_screen.html | 21 ++ .../storageService/services/splash_screen.js | 234 ++++++++++++++++++ .../src/vertoApp/vertoApp.module.js | 19 +- .../controllers/DialPadController.js | 1 - .../controllers/InCallController.js | 1 - .../controllers/LoginController.js | 1 - .../controllers/MainController.js | 56 ++--- .../controllers/SplashScreenController.js | 87 +++++++ .../vertoControllers.module.js | 4 +- .../vertoService/services/configService.js | 78 ++++++ .../src/vertoService/services/vertoService.js | 23 +- 14 files changed, 504 insertions(+), 64 deletions(-) create mode 100644 html5/verto/verto_communicator/src/partials/splash_screen.html create mode 100644 html5/verto/verto_communicator/src/storageService/services/splash_screen.js create mode 100644 html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js create mode 100644 html5/verto/verto_communicator/src/vertoService/services/configService.js diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index ee88a8f507..640cecca06 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -2549,7 +2549,7 @@ console.info("Audio Devices", $.verto.audioInDevices); console.info("Video Devices", $.verto.videoDevices); - runtime(); + runtime(true); }); } else { /* of course it's a totally different API CALL with different element names for the same exact thing */ @@ -2586,12 +2586,12 @@ console.info("Audio IN Devices", $.verto.audioInDevices); console.info("Audio Out Devices", $.verto.audioOutDevices); console.info("Video Devices", $.verto.videoDevices); - runtime(); + runtime(true); }) .catch(function(err) { console.log(" Device Enumeration ERROR: " + err.name + ": " + err.message); - runtime(); + runtime(false); }); } @@ -2601,9 +2601,16 @@ checkDevices(runtime); } - $.verto.init = function(obj, runtime) { - $.FSRTC.checkPerms(function() { + $.verto.init = function(obj, runtime, check) { + if(check == undefined) { + check = true; + } + $.FSRTC.checkPerms(function(status) { + if(check) { checkDevices(runtime); + } else { + runtime(status); + } }, true, true); } diff --git a/html5/verto/verto_communicator/src/css/verto.css b/html5/verto/verto_communicator/src/css/verto.css index df7efea2f7..4f383700d2 100644 --- a/html5/verto/verto_communicator/src/css/verto.css +++ b/html5/verto/verto_communicator/src/css/verto.css @@ -223,6 +223,29 @@ button.btn i { } } +/* --- Splash Screen --- */ +.splash-errors { + background: rgba(249, 21, 21, 0.55); + color: white; + padding: 8px; + margin-top: 11px; +} + +.splash-errors ul { + padding-start: 0em; + -moz-padding-start: 0em; + -webkit-padding-start: 0em; + padding-start: 0em; +} + +.splash-errors li { + background-color: rgba(154, 36, 36, 0.28); + padding: 8px; + font-weight: bold; + list-style: none; +} +/* --- End of Splash Screen --- */ + /* --- Modal settings page --- */ diff --git a/html5/verto/verto_communicator/src/index.html b/html5/verto/verto_communicator/src/index.html index 5945f72fe5..79c6a9cc8b 100644 --- a/html5/verto/verto_communicator/src/index.html +++ b/html5/verto/verto_communicator/src/index.html @@ -98,6 +98,7 @@ + @@ -118,10 +119,12 @@ + + diff --git a/html5/verto/verto_communicator/src/partials/splash_screen.html b/html5/verto/verto_communicator/src/partials/splash_screen.html new file mode 100644 index 0000000000..993999ec3a --- /dev/null +++ b/html5/verto/verto_communicator/src/partials/splash_screen.html @@ -0,0 +1,21 @@ +
+
+
+
+

Loading

+
+
+
+
+ +
+

Errors

+
    +
  • {{ ::error }}
  • +
+
+
+
+
+
+ diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js new file mode 100644 index 0000000000..917becfbcf --- /dev/null +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -0,0 +1,234 @@ +'use strict'; + + angular + .module('storageService') + .service('splashscreen', ['$rootScope', '$q', 'storage', 'config', 'verto', + function($rootScope, $q, storage, config, verto) { + + var checkBrowser = function() { + return $q(function(resolve, reject) { + var activity = 'browser-upgrade'; + var result = { + 'activity': activity, + 'soft': false, + 'status': 'success', + 'message': 'Checking browser compability.' + }; + + navigator.getUserMedia = navigator.getUserMedia || + navigator.webkitGetUserMedia || + navigator.mozGetUserMedia; + + if (!navigator.getUserMedia) { + result['status'] = 'error'; + result['message'] = 'Error: browser doesn\'t support WebRTC.'; + reject(result); + } + + resolve(result); + + }); + }; + + var checkMediaPerm = function() { + return $q(function(resolve, reject) { + var activity = 'media-perm'; + var result = { + 'activity': activity, + 'soft': false, + 'status': 'success', + 'message': 'Checking media permissions' + }; + + verto.mediaPerm(function(status) { + if(!status) { + result['status'] = 'error'; + result['message'] = 'Error: Media Permission Denied'; + verto.data.mediaPerm = false; + reject(result); + } + verto.data.mediaPerm = true; + resolve(result); + }); + }); + }; + + var refreshMediaDevices = function() { + return $q(function(resolve, reject) { + var activity = 'refresh-devices'; + var result = { + 'status': 'success', + 'soft': true, + 'activity': activity, + 'message': 'Refresh Media Devices.' + }; + + verto.refreshDevices(function(status) { + verto.refreshDevicesCallback(function() { + resolve(result); + }); + }); + + }); + }; + + var provisionConfig = function() { + return $q(function(resolve, reject) { + var activity = 'provision-config'; + var result = { + 'status': 'promise', + 'soft': true, + 'activity': activity, + 'message': 'Provisioning configuration.' + }; + + var configResponse = config.configure(); + + var configPromise = configResponse.then( + function(response) { + /** + * from angular docs: + * A response status code between 200 and 299 is considered a success status and will result in the success callback being called + */ + if(response.status >= 200 && response.status <= 299) { + return result; + } else { + result['status'] = 'error'; + result['message'] = 'Error: Provision failed.'; + return result; + } + }); + + result['promise'] = configPromise; + + resolve(result); + }); + }; + + var checkLogin = function() { + return $q(function(resolve, reject) { + var activity = 'check-login'; + var result = { + 'status': 'success', + 'soft': true, + 'activity': activity, + 'message': 'Checking login.' + }; + + if(verto.data.connecting || verto.data.connected) { + resolve(result); + }; + + var checkUserStored = function() { + /** + * if user data saved, use stored data for logon and not connecting + * not connecting prevent two connects + */ + if (storage.data.ui_connected && storage.data.ws_connected && !verto.data.connecting) { + verto.data.name = storage.data.name; + verto.data.email = storage.data.email; + verto.data.login = storage.data.login; + verto.data.password = storage.data.password; + + verto.data.connecting = true; + verto.connect(function(v, connected) { + verto.data.connecting = false; + resolve(result); + }); + }; + }; + + if(storage.data.ui_connected && storage.data.ws_connected) { + checkUserStored(); + } else { + resolve(result); + }; + }); + }; + + var progress = [ + checkBrowser, + checkMediaPerm, + refreshMediaDevices, + provisionConfig, + checkLogin + ]; + + var progress_message = [ + 'Checking browser compability.', + 'Checking media permissions', + 'Refresh Media Devices.', + 'Provisioning configuration.', + 'Checking login.' + ]; + + var getProgressMessage = function(current_progress) { + if(progress_message[current_progress] != undefined) { + return progress_message[current_progress]; + } else { + return 'Please wait...'; + } + }; + + var current_progress = -1; + var progress_percentage = 0; + + var calculateProgress = function(index) { + var _progress; + + _progress = index + 1; + progress_percentage = (_progress / progress.length) * 100; + return progress_percentage; + }; + + var nextProgress = function() { + var fn, fn_return, status, interrupt, activity, soft, message, promise; + interrupt = false; + current_progress++; + + if(current_progress >= progress.length) { + $rootScope.$emit('progress.complete', current_progress); + return; + } + + fn = progress[current_progress]; + fn_return = fn(); + + var emitNextProgress = function(fn_return) { + if(fn_return['promise'] != undefined) { + promise = fn_return['promise']; + } + + status = fn_return['status']; + soft = fn_return['soft']; + activity = fn_return['activity']; + message = fn_return['message']; + + if(status != 'success') { + interrupt = true; + } + + $rootScope.$emit('progress.next', current_progress, status, promise, activity, soft, interrupt, message); + + }; + + fn_return.then( + function(fn_return) { + emitNextProgress(fn_return); + }, + function(fn_return) { + emitNextProgress(fn_return); + } + ); + + }; + + return { + 'next': nextProgress, + 'getProgressMessage': getProgressMessage, + 'progress_percentage': progress_percentage, + 'calculate': calculateProgress + }; + + }]); + diff --git a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js index 2c7cffc381..351dee8733 100644 --- a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js +++ b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js @@ -19,6 +19,11 @@ vertoApp.config(['$routeProvider', 'gravatarServiceProvider', function($routeProvider, gravatarServiceProvider) { $routeProvider. + when('/', { + title: 'Loading', + templateUrl: 'partials/splash_screen.html', + controller: 'SplashScreenController' + }). when('/login', { title: 'Login', templateUrl: 'partials/login.html', @@ -40,7 +45,7 @@ controller: 'BrowserUpgradeController' }). otherwise({ - redirectTo: '/login' + redirectTo: '/' }); gravatarServiceProvider.defaults = { @@ -61,17 +66,7 @@ $rootScope.safeProtocol = true; } - $rootScope.checkBrowser = function() { - navigator.getUserMedia = navigator.getUserMedia || - navigator.webkitGetUserMedia || - navigator.mozGetUserMedia; - - if (!navigator.getUserMedia) { - $location.path('/browser-upgrade'); - } - - }; - + $rootScope.promptInput = function(title, message, label, callback) { var ret = prompt({ title: title, diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js index 8c7589c93d..2cc4c98312 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js @@ -7,7 +7,6 @@ '$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory) { console.debug('Executing DialPadController.'); - $scope.checkBrowser(); $scope.call_history = CallHistory.all(); $scope.history_control = CallHistory.all_control(); $scope.has_history = Object.keys($scope.call_history).length; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js index 47eb987a28..84d8894b28 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js @@ -10,7 +10,6 @@ console.debug('Executing InCallController.'); $scope.layout = null; - $scope.checkBrowser(); $rootScope.dialpadNumber = ''; $scope.callTemplate = 'partials/phone_call.html'; $scope.dialpadTemplate = ''; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js index c9f3e5b74e..3dda64de89 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js @@ -12,7 +12,6 @@ } preRoute(); - verto.data.name = $scope.storage.data.name; verto.data.email = $scope.storage.data.email; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 0363d91f27..ac7fde0f7e 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -24,33 +24,16 @@ * @type {string} */ $rootScope.dialpadNumber = ''; - - - /** - * if user data saved, use stored data for logon - */ - if (storage.data.ui_connected && storage.data.ws_connected) { - $scope.verto.data.name = storage.data.name; - $scope.verto.data.email = storage.data.email; - $scope.verto.data.login = storage.data.login; - $scope.verto.data.password = storage.data.password; - - verto.connect(function(v, connected) { - $scope.$apply(function() { - if (connected) { - toastr.success('Nice to see you again.', 'Welcome back'); - $location.path('/dialpad'); - } - }); - }); - - } - + // If verto is not connected, redirects to login page. if (!verto.data.connected) { console.debug('MainController: WebSocket not connected. Redirecting to login.'); - $location.path('/login'); + $location.path('/'); } + + $rootScope.$on('config.http.success', function(ev) { + $scope.login(); + }); /** * Login the user to verto server and @@ -59,23 +42,20 @@ $scope.login = function() { var connectCallback = function(v, connected) { $scope.$apply(function() { - if (connected) { - storage.data.ui_connected = verto.data.connected; - storage.data.ws_connected = verto.data.connected; - storage.data.name = verto.data.name; - storage.data.email = verto.data.email; - storage.data.login = verto.data.login; - storage.data.password = verto.data.password; - - console.debug('Redirecting to dialpad page.'); - toastr.success('Login successful.', 'Welcome'); - $location.path('/dialpad'); - } else { - toastr.error('There was an error while trying to login. Please try again.', 'Error'); - } + verto.data.connecting = false; + if (connected) { + storage.data.ui_connected = verto.data.connected; + storage.data.ws_connected = verto.data.connected; + storage.data.name = verto.data.name; + storage.data.email = verto.data.email; + storage.data.login = verto.data.login; + storage.data.password = verto.data.password; + $location.path('/dialpad'); + } }); }; - + + verto.data.connecting = true; verto.connect(connectCallback); }; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js new file mode 100644 index 0000000000..a26ead6be2 --- /dev/null +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js @@ -0,0 +1,87 @@ +(function() { + 'use strict'; + + angular + .module('vertoControllers') + .controller('SplashScreenController', ['$scope', '$rootScope', '$location', '$timeout', 'splashscreen', 'prompt', 'verto', + function($scope, $rootScope, $location, $timeout, splashscreen, prompt, verto) { + console.debug('Executing SplashScreenController.'); + + $scope.progress_percentage = splashscreen.progress_percentage; + $scope.message = ''; + $scope.interrupt_next = false; + $scope.errors = []; + + var redirectTo = function(link, activity) { + if(activity) { + if(activity == 'browser-upgrade') { + link = activity; + } + } + + $location.path(link); + } + + var checkProgressState = function(current_progress, status, promise, activity, soft, interrupt, message) { + $scope.progress_percentage = splashscreen.calculate(current_progress); + $scope.message = message; + + if(interrupt && status == 'error') { + $scope.errors.push(message); + if(!soft) { + redirectTo('', activity); + return; + } else { + message = message + '. Continue?'; + }; + + if(!confirm(message)) { + $scope.interrupt_next = true; + }; + }; + + if($scope.interrupt_next) { + return; + }; + + $scope.message = splashscreen.getProgressMessage(current_progress+1); + + return true; + }; + + $rootScope.$on('progress.next', function(ev, current_progress, status, promise, activity, soft, interrupt, message) { + $timeout(function() { + if(promise) { + promise.then(function(response) { + message = response['message']; + status = response['status']; + if(checkProgressState(current_progress, status, promise, activity, soft, interrupt, message)) { + splashscreen.next(); + }; + }); + + return; + } + + if(!checkProgressState(current_progress, status, promise, activity, soft, interrupt, message)) { + return; + } + + splashscreen.next(); + }, 400); + }); + + $rootScope.$on('progress.complete', function(ev, current_progress) { + $scope.message = 'Complete'; + if(verto.data.connected) { + redirectTo('/dialpad'); + } else { + redirectTo('/login'); + } + }); + + splashscreen.next(); + + }]); + +})(); diff --git a/html5/verto/verto_communicator/src/vertoControllers/vertoControllers.module.js b/html5/verto/verto_communicator/src/vertoControllers/vertoControllers.module.js index f27923b322..a20bb2cfee 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/vertoControllers.module.js +++ b/html5/verto/verto_communicator/src/vertoControllers/vertoControllers.module.js @@ -2,10 +2,10 @@ 'use strict'; var vertoControllers = angular.module('vertoControllers', [ - 'ui.bootstrap', + 'ui.bootstrap', 'vertoService', 'storageService', 'ui.gravatar' ]); -})(); \ No newline at end of file +})(); diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js new file mode 100644 index 0000000000..ee573ad23d --- /dev/null +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -0,0 +1,78 @@ +'use strict'; + +var vertoService = angular.module('vertoService'); + +vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', 'verto', + function($rootScope, $http, $location, storage, verto) { + var configure = function() { + /** + * Load stored user info into verto service + */ + if(storage.data.name) { + verto.data.name = storage.data.name; + } + if(storage.data.email) { + verto.data.email = storage.data.email; + } + if(storage.data.login) { + verto.data.login = storage.data.login; + } + if(storage.data.password) { + verto.data.password = storage.data.password; + } + + /* + * Load the Configs before logging in + * with cache buster + */ + var httpRequest = $http.get(window.location.pathname + '/config.json?cachebuster=' + Math.floor((Math.random()*1000000)+1)); + + var httpReturn = httpRequest.then(function(response) { + var data = response.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){ + verto.data.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 == '' && storage.data.login != '' && storage.data.password != '') { + verto.data.login = storage.data.login; + verto.data.password = storage.data.password; + } + + if (verto.data.autologin == "true" && !verto.data.autologin_done) { + console.debug("auto login per config.json"); + verto.data.autologin_done = true; + } + + $rootScope.$emit('config.http.success', data); + return response; + }, function(response) { + $rootScope.$emit('config.http.error', response); + return response; + }); + + return httpReturn; + }; + + return { + 'configure': configure + }; + }]); + diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 940ae1059d..229bc8b7fc 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -198,7 +198,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora videoResolution: videoResolution, bandwidth: bandwidth, - refreshDevicesCallback : function refreshDevicesCallback() { + refreshDevicesCallback : function refreshDevicesCallback(callback) { data.videoDevices = [{ id: 'none', label: 'No Camera' @@ -278,11 +278,19 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora } else { data.canVideo = true; } + + if(callback) { + callback(); + } }, refreshDevices: function(callback) { console.debug('Attempting to refresh the devices.'); - jQuery.verto.refreshDevices(this.refreshDevicesCallback); + if(callback) { + jQuery.verto.refreshDevices(callback); + } else { + jQuery.verto.refreshDevices(this.refreshDevicesCallback); + } }, /** @@ -538,7 +546,6 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora function ourBootstrap() { // Checking if we have a failed connection attempt before // connecting again. - that.refreshDevicesCallback(); if (data.instance && !data.instance.rpcClient.socketReady()) { clearTimeout(data.instance.rpcClient.to); data.instance.logout(); @@ -565,8 +572,16 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora }); } + + if(data.mediaPerm) { + ourBootstrap(); + } else { + $.verto.init({}, ourBootstrap, false); + } + }, - $.verto.init({}, ourBootstrap); + mediaPerm: function(callback) { + $.verto.init({}, callback, false); }, /** From b213ceaf5183470c4bad52a37997ebd599cf2b71 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 14:48:41 -0300 Subject: [PATCH 006/126] FS-8205 [verto_communicator] fix config reload --- .../storageService/services/splash_screen.js | 17 ++++++++++++++++- .../controllers/MainController.js | 4 ---- .../src/vertoService/services/configService.js | 2 -- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index 917becfbcf..3537313bbe 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -100,8 +100,23 @@ }); result['promise'] = configPromise; + + var connectCallback = function(v, connected) { + verto.data.connecting = false; + if (connected) { + storage.data.ui_connected = verto.data.connected; + storage.data.ws_connected = verto.data.connected; + storage.data.name = verto.data.name; + storage.data.email = verto.data.email; + storage.data.login = verto.data.login; + storage.data.password = verto.data.password; + resolve(result); + } + }; + + verto.data.connecting = true; + verto.connect(connectCallback); - resolve(result); }); }; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index ac7fde0f7e..4dd6879731 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -31,10 +31,6 @@ $location.path('/'); } - $rootScope.$on('config.http.success', function(ev) { - $scope.login(); - }); - /** * Login the user to verto server and * redirects him to dialpad page. diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index ee573ad23d..2c302b6ad1 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -61,10 +61,8 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } - $rootScope.$emit('config.http.success', data); return response; }, function(response) { - $rootScope.$emit('config.http.error', response); return response; }); From f13308910cdd09b731ec6a48a381baaa28d0f714 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 14:57:16 -0300 Subject: [PATCH 007/126] FS-8205 [verto_communicator] fix refresh video callback --- .../src/vertoService/services/vertoService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 229bc8b7fc..e65d2f68f4 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -279,7 +279,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora data.canVideo = true; } - if(callback) { + if(angular.isFunction(callback)) { callback(); } }, From e7b50e87260313c51367bf7c3c9f638b105ab645 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 15:49:24 -0300 Subject: [PATCH 008/126] FS-8205 [verto_communicator] fix login config and checkConfig --- .../storageService/services/splash_screen.js | 17 +---------------- .../controllers/MainController.js | 14 +++++++++++--- .../src/vertoService/services/configService.js | 2 ++ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index 3537313bbe..4cb97e7fd1 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -101,22 +101,7 @@ result['promise'] = configPromise; - var connectCallback = function(v, connected) { - verto.data.connecting = false; - if (connected) { - storage.data.ui_connected = verto.data.connected; - storage.data.ws_connected = verto.data.connected; - storage.data.name = verto.data.name; - storage.data.email = verto.data.email; - storage.data.login = verto.data.login; - storage.data.password = verto.data.password; - resolve(result); - } - }; - - verto.data.connecting = true; - verto.connect(connectCallback); - + resolve(result); }); }; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 4dd6879731..fc403843ec 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -30,12 +30,18 @@ console.debug('MainController: WebSocket not connected. Redirecting to login.'); $location.path('/'); } - + + $rootScope.$on('config.http.success', function(ev) { + $scope.login(false); + }); /** * Login the user to verto server and * redirects him to dialpad page. */ - $scope.login = function() { + $scope.login = function(redirect) { + if(redirect == undefined) { + redirect = true; + } var connectCallback = function(v, connected) { $scope.$apply(function() { verto.data.connecting = false; @@ -46,7 +52,9 @@ storage.data.email = verto.data.email; storage.data.login = verto.data.login; storage.data.password = verto.data.password; - $location.path('/dialpad'); + if (redirect) { + $location.path('/dialpad'); + } } }); }; diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 2c302b6ad1..4ac73e0ee9 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -61,8 +61,10 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } + $rootScope.$emit('config.http.success', data); return response; }, function(response) { + $rootScope.$emit('config.http.error', response); return response; }); From 787671625d23cec265fd4092754225a6f28859b7 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 15:51:46 -0300 Subject: [PATCH 009/126] FS-8205 [verto_communicator] fix again --- .../src/storageService/services/splash_screen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index 4cb97e7fd1..da7a156f63 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -116,7 +116,8 @@ }; if(verto.data.connecting || verto.data.connected) { - resolve(result); + resolve(result); + return; }; var checkUserStored = function() { From 3d86aaacc533ac2d4df6cc9d824dc76df6cbf67e Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 17:29:49 -0300 Subject: [PATCH 010/126] FS-8205 [verto_communicator] fix incall redirect and first login (localstorage clear) --- html5/verto/verto_communicator/src/index.html | 1 + .../verto_communicator/src/partials/menu.html | 2 +- .../src/vertoApp/vertoApp.module.js | 15 +++++- .../controllers/DialPadController.js | 7 ++- .../controllers/LoginController.js | 2 +- .../controllers/MainController.js | 37 ++++++++------ .../controllers/SplashScreenController.js | 3 +- .../services/eventQueueService.js | 50 +++++++++++++++++++ 8 files changed, 94 insertions(+), 23 deletions(-) create mode 100644 html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js diff --git a/html5/verto/verto_communicator/src/index.html b/html5/verto/verto_communicator/src/index.html index 79c6a9cc8b..ba8b790c2e 100644 --- a/html5/verto/verto_communicator/src/index.html +++ b/html5/verto/verto_communicator/src/index.html @@ -120,6 +120,7 @@ + diff --git a/html5/verto/verto_communicator/src/partials/menu.html b/html5/verto/verto_communicator/src/partials/menu.html index ea846ddc1e..f0adc3f24d 100644 --- a/html5/verto/verto_communicator/src/partials/menu.html +++ b/html5/verto/verto_communicator/src/partials/menu.html @@ -13,7 +13,7 @@ - + Verto Communicator diff --git a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js index 351dee8733..0952ed1dce 100644 --- a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js +++ b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js @@ -54,8 +54,19 @@ } ]); - vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt', - function($rootScope, $location, toastr, prompt) { + vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt', 'verto', + function($rootScope, $location, toastr, prompt, verto) { + + $rootScope.$on( "$routeChangeStart", function(event, next, current) { + if (!verto.data.connected) { + if ( next.templateUrl === "partials/login.html") { + // pass + } else { + $location.path("/"); + } + } + }); + $rootScope.$on('$routeChangeSuccess', function(event, current, previous) { $rootScope.title = current.$$route.title; }); diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js index 2cc4c98312..2944cae46d 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js @@ -4,9 +4,12 @@ angular .module('vertoControllers') .controller('DialPadController', ['$rootScope', '$scope', - '$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', - function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory) { + '$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', 'eventQueue', + function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory, eventQueue) { console.debug('Executing DialPadController.'); + + eventQueue.process(); + $scope.call_history = CallHistory.all(); $scope.history_control = CallHistory.all_control(); $scope.has_history = Object.keys($scope.call_history).length; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js index 3dda64de89..d6f1d0366f 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js @@ -11,7 +11,7 @@ } } preRoute(); - + verto.data.name = $scope.storage.data.name; verto.data.email = $scope.storage.data.email; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index fc403843ec..db8475f957 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -4,7 +4,7 @@ angular .module('vertoControllers') .controller('MainController', - function($scope, $rootScope, $location, $modal, $timeout, verto, storage, CallHistory, toastr, Fullscreen, prompt) { + function($scope, $rootScope, $location, $modal, $timeout, $q, verto, storage, CallHistory, toastr, Fullscreen, prompt, eventQueue) { console.debug('Executing MainController.'); @@ -245,22 +245,27 @@ }); $rootScope.$on('page.incall', function(event, data) { - if (storage.data.askRecoverCall) { - prompt({ - title: 'Oops, Active Call in Course.', - message: 'It seems you were in a call before leaving the last time. Wanna go back to that?' - }).then(function() { - console.log('redirect to incall page'); - $location.path('/incall'); - }, function() { - storage.data.userStatus = 'connecting'; - verto.hangup(); + var page_incall = function() { + return $q(function(resolve, reject) { + if (storage.data.askRecoverCall) { + prompt({ + title: 'Oops, Active Call in Course.', + message: 'It seems you were in a call before leaving the last time. Wanna go back to that?' + }).then(function() { + console.log('redirect to incall page'); + $location.path('/incall'); + }, function() { + storage.data.userStatus = 'connecting'; + verto.hangup(); + }); + } else { + console.log('redirect to incall page'); + $location.path('/incall'); + } + resolve(); }); - } else { - console.log('redirect to incall page'); - $location.path('/incall'); - } - + }; + eventQueue.events.push(page_incall); }); $scope.$on('event:google-plus-signin-success', function (event,authResult) { diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js index a26ead6be2..fdc96efd59 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js @@ -18,7 +18,7 @@ link = activity; } } - + $location.path(link); } @@ -77,6 +77,7 @@ redirectTo('/dialpad'); } else { redirectTo('/login'); + $location.path('/login'); } }); diff --git a/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js b/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js new file mode 100644 index 0000000000..71c48bcefa --- /dev/null +++ b/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js @@ -0,0 +1,50 @@ +'use strict'; + + angular + .module('vertoService') + .service('eventQueue', ['$rootScope', '$q', 'storage', 'verto', + function($rootScope, $q, storage, verto) { + + var events = []; + + var next = function() { + var fn, fn_return; + + fn = events.shift(); + + if (fn == undefined) { + $rootScope.$emit('eventqueue.complete'); + return; + } + fn_return = fn(); + + var emitNextProgress = function() { + $rootScope.$emit('eventqueue.next'); + }; + + fn_return.then( + function() { + emitNextProgress(); + }, + function() { + emitNextProgress(); + } + ); + }; + + var process = function() { + $rootScope.$on('eventqueue.next', function (ev){ + next(); + }); + + next(); + }; + + return { + 'next': next, + 'process': process, + 'events': events + }; + + }]); + From f1ce52430d701c0a8a8c7475595d520a1ad165d9 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 18:38:02 -0300 Subject: [PATCH 011/126] FS-8205 [verto_communicator] google client id changes --- .../src/vertoService/services/configService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 4ac73e0ee9..0f2f4fcce0 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -37,6 +37,7 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' console.debug("googlelogin: " + data.googlelogin); if (data.googlelogin){ verto.data.googlelogin = data.googlelogin; + verto.data.googleclientid = data.googleclientid; } angular.extend(verto.data, data); From d5241c8c0659d6df35f7524c74b28ba7ca882e28 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 20:04:04 -0300 Subject: [PATCH 012/126] FS-8205 [verto_communicator] fix login with config provision --- .../src/vertoService/services/configService.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 0f2f4fcce0..58fa7ccbbe 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -62,7 +62,9 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } - $rootScope.$emit('config.http.success', data); + if(verto.data.login && verto.data.password && verto.data.name && verto.data.email) { + $rootScope.$emit('config.http.success', data); + } return response; }, function(response) { $rootScope.$emit('config.http.error', response); From 8d15e0a3d754e7303038eb3d3de8704b15f7e874 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 20:07:10 -0300 Subject: [PATCH 013/126] FS-8205 [verto_communicator] fix login --- .../src/vertoService/services/configService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 58fa7ccbbe..733b706039 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -62,7 +62,7 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } - if(verto.data.login && verto.data.password && verto.data.name && verto.data.email) { + if(verto.data.login != '' && verto.data.password != '' && verto.data.name != '' && verto.data.email != '') { $rootScope.$emit('config.http.success', data); } return response; From ba8b7c8aa268ff60958a60b2489a0cb8de14849c Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 20:37:33 -0300 Subject: [PATCH 014/126] FS-8205 [verto_communicator] fix login config provision --- .../src/vertoService/services/configService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 733b706039..2793cdb91d 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -62,9 +62,9 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } - if(verto.data.login != '' && verto.data.password != '' && verto.data.name != '' && verto.data.email != '') { + if(storage.data.name.length && storage.data.email.length && storage.data.login.length && storage.data.password.length) { $rootScope.$emit('config.http.success', data); - } + }; return response; }, function(response) { $rootScope.$emit('config.http.error', response); From 015e81c94f08f6ae0687f20fb83afa70de1d9954 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Fri, 25 Sep 2015 11:51:58 -0300 Subject: [PATCH 015/126] FS-8205 [verto_communicator] fix auto call config provision --- .../src/vertoService/services/configService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 2793cdb91d..924488f733 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -62,7 +62,7 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } - if(storage.data.name.length && storage.data.email.length && storage.data.login.length && storage.data.password.length) { + if(verto.data.autologin && storage.data.name.length && storage.data.email.length && storage.data.login.length && storage.data.password.length) { $rootScope.$emit('config.http.success', data); }; return response; From 73acb558cc4c8a400b5964050671df022e51e076 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 25 Sep 2015 17:56:39 -0500 Subject: [PATCH 016/126] FS-8224 Allow CallerID to be set from login settings in VC If CallerID is not set as is the default case with using VC on cantina default to using the users email address. --- html5/verto/verto_communicator/src/partials/login.html | 5 +++++ .../verto_communicator/src/partials/modal_logininfo.html | 4 ++++ .../src/vertoService/services/vertoService.js | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/html5/verto/verto_communicator/src/partials/login.html b/html5/verto/verto_communicator/src/partials/login.html index 5a0c03c7dd..1d20188885 100644 --- a/html5/verto/verto_communicator/src/partials/login.html +++ b/html5/verto/verto_communicator/src/partials/login.html @@ -28,6 +28,11 @@ +
+ + +
+
diff --git a/html5/verto/verto_communicator/src/partials/modal_logininfo.html b/html5/verto/verto_communicator/src/partials/modal_logininfo.html index e41eef4de1..4a6d7075c5 100644 --- a/html5/verto/verto_communicator/src/partials/modal_logininfo.html +++ b/html5/verto/verto_communicator/src/partials/modal_logininfo.html @@ -23,6 +23,10 @@
+
+ + +