ソースを参照

Remove callstats support (#2399)

* ref: Remove PrecallTest.

* ref: Remove callstats support.
release-8443
bgrozev 1年前
コミット
6ca515dbda
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 11
- 125
JitsiConference.js ファイルの表示

@@ -472,13 +472,8 @@ JitsiConference.prototype._init = function(options = {}) {
472 472
             userName: config.statisticsDisplayName ? config.statisticsDisplayName : this.myUserId(),
473 473
             confID: config.confID || `${this.connection.options.hosts.domain}/${this.options.name}`,
474 474
             siteID: config.siteID,
475
-            customScriptUrl: config.callStatsCustomScriptUrl,
476
-            callStatsID: config.callStatsID,
477
-            callStatsSecret: config.callStatsSecret,
478
-            callStatsApplicationLogsDisabled: config.callStatsApplicationLogsDisabled,
479 475
             roomName: this.options.name,
480
-            applicationName: config.applicationName,
481
-            configParams: config.callStatsConfigParams
476
+            applicationName: config.applicationName
482 477
         });
483 478
         Statistics.analytics.addPermanentProperties({
484 479
             'callstats_name': this._statsCurrentId
@@ -1237,13 +1232,6 @@ JitsiConference.prototype.onLocalTrackRemoved = function(track) {
1237 1232
         track.removeEventListener(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED, track.audioLevelHandler);
1238 1233
     }
1239 1234
 
1240
-    // send event for stopping screen sharing
1241
-    // FIXME: we assume we have only one screen sharing track
1242
-    // if we change this we need to fix this check
1243
-    if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
1244
-        this.statistics.sendScreenSharingEvent(false);
1245
-    }
1246
-
1247 1235
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
1248 1236
 };
1249 1237
 
@@ -1381,17 +1369,6 @@ JitsiConference.prototype._removeLocalSourceOnReject = function(jingleSession, e
1381 1369
 JitsiConference.prototype._setupNewTrack = function(newTrack) {
1382 1370
     const mediaType = newTrack.getType();
1383 1371
 
1384
-    if (newTrack.isAudioTrack() || (newTrack.isVideoTrack() && newTrack.videoType !== VideoType.DESKTOP)) {
1385
-        // Report active device to statistics
1386
-        const devices = RTC.getCurrentlyAvailableMediaDevices();
1387
-        const device = devices
1388
-            .find(d => d.kind === `${newTrack.getTrack().kind}input` && d.label === newTrack.getTrack().label);
1389
-
1390
-        if (device) {
1391
-            Statistics.sendActiveDeviceListEvent(RTC.getEventDataForActiveDevice(device));
1392
-        }
1393
-    }
1394
-
1395 1372
     // Create a source name for this track if it doesn't exist.
1396 1373
     if (!newTrack.getSourceName()) {
1397 1374
         const sourceName = getSourceNameForJitsiTrack(
@@ -2256,14 +2233,6 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
2256 2233
         this._desktopSharingFrameRate
2257 2234
             && jingleSession.peerconnection.setDesktopSharingFrameRate(this._desktopSharingFrameRate);
2258 2235
 
2259
-        // Start callstats as soon as peerconnection is initialized,
2260
-        // do not wait for XMPPEvents.PEERCONNECTION_READY, as it may never
2261
-        // happen in case if user doesn't have or denied permission to
2262
-        // both camera and microphone.
2263
-        logger.info('Starting CallStats for JVB connection...');
2264
-        this.statistics.startCallStats(
2265
-            this.jvbJingleSession.peerconnection,
2266
-            'jitsi' /* Remote user ID for JVB is 'jitsi' */);
2267 2236
         this.statistics.startRemoteStats(this.jvbJingleSession.peerconnection);
2268 2237
     } catch (e) {
2269 2238
         GlobalOnErrorHandler.callErrorHandler(e);
@@ -2377,11 +2346,7 @@ JitsiConference.prototype.onCallEnded = function(jingleSession, reasonCondition,
2377 2346
 
2378 2347
         // Stop the stats
2379 2348
         if (this.statistics) {
2380
-            this.statistics.stopRemoteStats(
2381
-                this.jvbJingleSession.peerconnection);
2382
-            logger.info('Stopping JVB CallStats');
2383
-            this.statistics.stopCallStats(
2384
-                this.jvbJingleSession.peerconnection);
2349
+            this.statistics.stopRemoteStats(this.jvbJingleSession.peerconnection);
2385 2350
         }
2386 2351
 
2387 2352
         // Current JVB JingleSession is no longer valid, so set it to null
@@ -2694,7 +2659,7 @@ JitsiConference.prototype.getLocalParticipantProperty = function(name) {
2694 2659
 };
2695 2660
 
2696 2661
 /**
2697
- * Sends the given feedback through CallStats if enabled.
2662
+ * Sends the given feedback if enabled.
2698 2663
  *
2699 2664
  * @param overallFeedback an integer between 1 and 5 indicating the
2700 2665
  * user feedback
@@ -2706,14 +2671,13 @@ JitsiConference.prototype.sendFeedback = function(overallFeedback, detailedFeedb
2706 2671
 };
2707 2672
 
2708 2673
 /**
2709
- * Returns true if the callstats integration is enabled, otherwise returns
2710
- * false.
2711
- *
2712
- * @returns true if the callstats integration is enabled, otherwise returns
2713
- * false.
2674
+ * @returns false, since callstats in not supported anymore.
2675
+ * @deprecated
2714 2676
  */
2715 2677
 JitsiConference.prototype.isCallstatsEnabled = function() {
2716
-    return this.statistics.isCallstatsEnabled();
2678
+    logger.warn('Callstats is no longer supported');
2679
+
2680
+    return false;
2717 2681
 };
2718 2682
 
2719 2683
 /**
@@ -2727,52 +2691,10 @@ JitsiConference.prototype.getSsrcByTrack = function(track) {
2727 2691
 };
2728 2692
 
2729 2693
 /**
2730
- * Handles track attached to container (Calls associateStreamWithVideoTag method
2731
- * from statistics module)
2732
- * @param {JitsiLocalTrack|JitsiRemoteTrack} track the track
2733
- * @param container the container
2694
+ * This is a no-op since callstats is no longer supported.
2734 2695
  */
2735
-JitsiConference.prototype._onTrackAttach = function(track, container) {
2736
-    const isLocal = track.isLocal();
2737
-    let ssrc = null;
2738
-    const isP2P = track.isP2P;
2739
-    const remoteUserId = isP2P ? track.getParticipantId() : 'jitsi';
2740
-    const peerConnection
2741
-        = isP2P
2742
-            ? this.p2pJingleSession && this.p2pJingleSession.peerconnection
2743
-            : this.jvbJingleSession && this.jvbJingleSession.peerconnection;
2744
-
2745
-    if (isLocal) {
2746
-        // Local tracks have SSRC stored on per peer connection basis.
2747
-        if (peerConnection) {
2748
-            ssrc = peerConnection.getLocalSSRC(track);
2749
-        }
2750
-    } else {
2751
-        ssrc = track.getSSRC();
2752
-    }
2753
-    if (!container.id || !ssrc || !peerConnection) {
2754
-        return;
2755
-    }
2756
-
2757
-    this.statistics.associateStreamWithVideoTag(
2758
-        peerConnection,
2759
-        ssrc,
2760
-        isLocal,
2761
-        remoteUserId,
2762
-        track.getUsageLabel(),
2763
-        container.id);
2764
-};
2765
-
2766
-/**
2767
- * Logs an "application log" message.
2768
- * @param message {string} The message to log. Note that while this can be a
2769
- * generic string, the convention used by lib-jitsi-meet and jitsi-meet is to
2770
- * log valid JSON strings, with an "id" field used for distinguishing between
2771
- * message types. E.g.: {id: "recorder_status", status: "off"}
2772
- */
2773
-JitsiConference.prototype.sendApplicationLog = function(message) {
2774
-    Statistics.sendLog(message);
2775
-};
2696
+// eslint-disable-next-line no-empty-function
2697
+JitsiConference.prototype.sendApplicationLog = function() { };
2776 2698
 
2777 2699
 /**
2778 2700
  * Checks if the user identified by given <tt>mucJid</tt> is the conference focus.
@@ -2996,20 +2918,6 @@ JitsiConference.prototype._acceptP2PIncomingCall = function(jingleSession, jingl
2996 2918
             enableInsertableStreams: this.isE2EEEnabled() || FeatureFlags.isRunInLiteModeEnabled()
2997 2919
         });
2998 2920
 
2999
-    logger.info('Starting CallStats for P2P connection...');
3000
-
3001
-    let remoteID = Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);
3002
-
3003
-    const participant = this.participants.get(remoteID);
3004
-
3005
-    if (participant) {
3006
-        remoteID = participant.getStatsID() || remoteID;
3007
-    }
3008
-
3009
-    this.statistics.startCallStats(
3010
-        this.p2pJingleSession.peerconnection,
3011
-        remoteID);
3012
-
3013 2921
     const localTracks = this._getInitialLocalTracks();
3014 2922
 
3015 2923
     this.p2pJingleSession.acceptOffer(
@@ -3295,12 +3203,6 @@ JitsiConference.prototype._setP2PStatus = function(newStatus) {
3295 3203
         logger.info('Peer to peer connection closed!');
3296 3204
     }
3297 3205
 
3298
-    // Put the JVB connection on hold/resume
3299
-    if (this.jvbJingleSession) {
3300
-        this.statistics.sendConnectionResumeOrHoldEvent(
3301
-            this.jvbJingleSession.peerconnection, !newStatus);
3302
-    }
3303
-
3304 3206
     // Clear dtmfManager, so that it can be recreated with new connection
3305 3207
     this.dtmfManager = null;
3306 3208
 
@@ -3353,20 +3255,6 @@ JitsiConference.prototype._startP2PSession = function(remoteJid) {
3353 3255
             enableInsertableStreams: this.isE2EEEnabled() || FeatureFlags.isRunInLiteModeEnabled()
3354 3256
         });
3355 3257
 
3356
-    logger.info('Starting CallStats for P2P connection...');
3357
-
3358
-    let remoteID = Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);
3359
-
3360
-    const participant = this.participants.get(remoteID);
3361
-
3362
-    if (participant) {
3363
-        remoteID = participant.getStatsID() || remoteID;
3364
-    }
3365
-
3366
-    this.statistics.startCallStats(
3367
-        this.p2pJingleSession.peerconnection,
3368
-        remoteID);
3369
-
3370 3258
     const localTracks = this.getLocalTracks();
3371 3259
 
3372 3260
     this.p2pJingleSession.invite(localTracks);
@@ -3520,8 +3408,6 @@ JitsiConference.prototype._stopP2PSession = function(options = {}) {
3520 3408
     // Stop P2P stats
3521 3409
     logger.info('Stopping remote stats for P2P connection');
3522 3410
     this.statistics.stopRemoteStats(this.p2pJingleSession.peerconnection);
3523
-    logger.info('Stopping CallStats for P2P connection');
3524
-    this.statistics.stopCallStats(this.p2pJingleSession.peerconnection);
3525 3411
 
3526 3412
     this.p2pJingleSession.terminate(
3527 3413
         () => {

+ 1
- 87
JitsiConferenceEventManager.js ファイルの表示

@@ -9,7 +9,6 @@ import Statistics from './modules/statistics/statistics';
9 9
 import EventEmitterForwarder from './modules/util/EventEmitterForwarder';
10 10
 import { MediaType } from './service/RTC/MediaType';
11 11
 import RTCEvents from './service/RTC/RTCEvents';
12
-import { VideoType } from './service/RTC/VideoType';
13 12
 import AuthenticationEvents
14 13
     from './service/authentication/AuthenticationEvents';
15 14
 import {
@@ -31,26 +30,6 @@ const logger = getLogger(__filename);
31 30
 export default function JitsiConferenceEventManager(conference) {
32 31
     this.conference = conference;
33 32
     this.xmppListeners = {};
34
-
35
-    // Listeners related to the conference only
36
-    conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
37
-        track => {
38
-            if (!track.isLocal() || !conference.statistics) {
39
-                return;
40
-            }
41
-            const session
42
-                = track.isP2P
43
-                    ? conference.p2pJingleSession : conference.jvbJingleSession;
44
-
45
-            // TPC will be null, before the conference starts, but the event
46
-            // still should be queued
47
-            const tpc = (session && session.peerconnection) || null;
48
-
49
-            conference.statistics.sendMuteEvent(
50
-                tpc,
51
-                track.isMuted(),
52
-                track.getType());
53
-        });
54 33
 }
55 34
 
56 35
 /**
@@ -360,20 +339,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
360 339
 
361 340
     chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
362 341
         conference.onLocalRoleChanged(role);
363
-
364
-        // log all events for the recorder operated by the moderator
365
-        if (conference.statistics && conference.isModerator()) {
366
-            conference.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED,
367
-                recorderSession => {
368
-                    const logObject = {
369
-                        error: recorderSession.getError(),
370
-                        id: 'recorder_status',
371
-                        status: recorderSession.getStatus()
372
-                    };
373
-
374
-                    Statistics.sendLog(JSON.stringify(logObject));
375
-                });
376
-        }
377 342
     });
378 343
 
379 344
     chatRoom.addListener(XMPPEvents.MUC_ROLE_CHANGED,
@@ -475,21 +440,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
475 440
         }
476 441
     });
477 442
 
478
-    if (conference.statistics) {
479
-        // FIXME ICE related events should end up in RTCEvents eventually
480
-        chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
481
-            session => {
482
-                conference.statistics.sendIceConnectionFailedEvent(
483
-                    session.peerconnection);
484
-            });
485
-
486
-        // FIXME XMPPEvents.ADD_ICE_CANDIDATE_FAILED is never emitted
487
-        chatRoom.addListener(XMPPEvents.ADD_ICE_CANDIDATE_FAILED,
488
-            (e, pc) => {
489
-                conference.statistics.sendAddIceCandidateFailed(e, pc);
490
-            });
491
-    }
492
-
493 443
     // Breakout rooms.
494 444
     this.chatRoomForwarder.forward(XMPPEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM,
495 445
         JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM);
@@ -526,7 +476,7 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
526 476
                     JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, dominant, previous, silence);
527 477
                 if (conference.statistics && conference.myUserId() === dominant) {
528 478
                     // We are the new dominant speaker.
529
-                    conference.statistics.sendDominantSpeakerEvent(conference.room.roomjid, silence);
479
+                    conference.xmpp.sendDominantSpeakerEvent(conference.room.roomjid, silence);
530 480
                 }
531 481
                 if (conference.lastDominantSpeaker !== dominant) {
532 482
                     if (previous && previous.length) {
@@ -603,30 +553,8 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
603 553
             }
604 554
         });
605 555
 
606
-    rtc.addListener(RTCEvents.LOCAL_UFRAG_CHANGED,
607
-        (tpc, ufrag) => {
608
-            if (!tpc.isP2P) {
609
-                Statistics.sendLog(
610
-                    JSON.stringify({
611
-                        id: 'local_ufrag',
612
-                        value: ufrag
613
-                    }));
614
-            }
615
-        });
616
-    rtc.addListener(RTCEvents.REMOTE_UFRAG_CHANGED,
617
-        (tpc, ufrag) => {
618
-            if (!tpc.isP2P) {
619
-                Statistics.sendLog(
620
-                    JSON.stringify({
621
-                        id: 'remote_ufrag',
622
-                        value: ufrag
623
-                    }));
624
-            }
625
-        });
626
-
627 556
     rtc.addListener(RTCEvents.CREATE_ANSWER_FAILED,
628 557
         (e, tpc) => {
629
-            conference.statistics.sendCreateAnswerFailed(e, tpc);
630 558
             if (!tpc.isP2P) {
631 559
                 conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
632 560
                     JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
@@ -635,7 +563,6 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
635 563
 
636 564
     rtc.addListener(RTCEvents.CREATE_OFFER_FAILED,
637 565
         (e, tpc) => {
638
-            conference.statistics.sendCreateOfferFailed(e, tpc);
639 566
             if (!tpc.isP2P) {
640 567
                 conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
641 568
                     JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
@@ -644,7 +571,6 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
644 571
 
645 572
     rtc.addListener(RTCEvents.SET_LOCAL_DESCRIPTION_FAILED,
646 573
         (e, tpc) => {
647
-            conference.statistics.sendSetLocalDescFailed(e, tpc);
648 574
             if (!tpc.isP2P) {
649 575
                 conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
650 576
                     JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
@@ -653,23 +579,11 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
653 579
 
654 580
     rtc.addListener(RTCEvents.SET_REMOTE_DESCRIPTION_FAILED,
655 581
         (e, tpc) => {
656
-            conference.statistics.sendSetRemoteDescFailed(e, tpc);
657 582
             if (!tpc.isP2P) {
658 583
                 conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
659 584
                     JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
660 585
             }
661 586
         });
662
-
663
-    rtc.addListener(RTCEvents.LOCAL_TRACK_SSRC_UPDATED,
664
-        (track, ssrc) => {
665
-            // when starting screen sharing, the track is created and when
666
-            // we do set local description and we process the ssrc we
667
-            // will be notified for it and we will report it with the event
668
-            // for screen sharing
669
-            if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
670
-                conference.statistics.sendScreenSharingEvent(true, ssrc);
671
-            }
672
-        });
673 587
 };
674 588
 
675 589
 /**

+ 1
- 2
JitsiConferenceEvents.ts ファイルの表示

@@ -22,8 +22,7 @@ export enum JitsiConferenceEvents {
22 22
 
23 23
     /**
24 24
      * Fired just before the statistics module is disposed and it's the last chance
25
-     * to submit some logs to the statistics service (ex. CallStats if enabled),
26
-     * before it's disconnected.
25
+     * to submit some logs to the statistics service before it's disconnected.
27 26
      */
28 27
     BEFORE_STATISTICS_DISPOSED = 'conference.beforeStatisticsDisposed',
29 28
 

+ 0
- 6
JitsiConnection.js ファイルの表示

@@ -43,12 +43,6 @@ export default function JitsiConnection(appID, token, options) {
43 43
                     ANALYTICS_CONNECTION_DISCONNECTED,
44 44
                     { message: msg });
45 45
             }
46
-            Statistics.sendLog(
47
-                JSON.stringify(
48
-                    {
49
-                        id: ANALYTICS_CONNECTION_DISCONNECTED,
50
-                        msg
51
-                    }));
52 46
         });
53 47
 }
54 48
 

+ 0
- 33
JitsiMediaDevices.js ファイルの表示

@@ -3,7 +3,6 @@ import EventEmitter from 'events';
3 3
 import * as JitsiMediaDevicesEvents from './JitsiMediaDevicesEvents';
4 4
 import RTC from './modules/RTC/RTC';
5 5
 import browser from './modules/browser';
6
-import Statistics from './modules/statistics/statistics';
7 6
 import { MediaType } from './service/RTC/MediaType';
8 7
 import RTCEvents from './service/RTC/RTCEvents';
9 8
 
@@ -29,12 +28,6 @@ class JitsiMediaDevices {
29 28
                 this._eventEmitter.emit(
30 29
                     JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
31 30
                     devices));
32
-        RTC.addListener(
33
-            RTCEvents.DEVICE_LIST_AVAILABLE,
34
-            devices =>
35
-                this._logOutputDevice(
36
-                    this.getAudioOutputDevice(),
37
-                    devices));
38 31
 
39 32
         // We would still want to update the permissions cache in case the permissions API is not supported.
40 33
         RTC.addListener(
@@ -146,22 +139,6 @@ class JitsiMediaDevices {
146 139
         }
147 140
     }
148 141
 
149
-    /**
150
-     * Gathers data and sends it to statistics.
151
-     * @param deviceID the device id to log
152
-     * @param devices list of devices
153
-     */
154
-    _logOutputDevice(deviceID, devices) {
155
-        const device
156
-            = devices.find(
157
-                d => d.kind === 'audiooutput' && d.deviceId === deviceID);
158
-
159
-        if (device) {
160
-            Statistics.sendActiveDeviceListEvent(
161
-                RTC.getEventDataForActiveDevice(device));
162
-        }
163
-    }
164
-
165 142
     /**
166 143
      * Executes callback with list of media devices connected.
167 144
      * @param {function} callback
@@ -286,16 +263,6 @@ class JitsiMediaDevices {
286 263
      *      otherwise
287 264
      */
288 265
     setAudioOutputDevice(deviceId) {
289
-        const availableDevices = RTC.getCurrentlyAvailableMediaDevices();
290
-
291
-        if (availableDevices.length > 0) {
292
-            // if we have devices info report device to stats
293
-            // normally this will not happen on startup as this method is called
294
-            // too early. This will happen only on user selection of new device
295
-            this._logOutputDevice(
296
-                deviceId, RTC.getCurrentlyAvailableMediaDevices());
297
-        }
298
-
299 266
         return RTC.setAudioOutputDevice(deviceId);
300 267
     }
301 268
 

+ 1
- 37
JitsiMeetJS.ts ファイルの表示

@@ -25,7 +25,6 @@ import ProxyConnectionService
25 25
 import recordingConstants from './modules/recording/recordingConstants';
26 26
 import Settings from './modules/settings/Settings';
27 27
 import LocalStatsCollector from './modules/statistics/LocalStatsCollector';
28
-import precallTest from './modules/statistics/PrecallTest';
29 28
 import Statistics from './modules/statistics/statistics';
30 29
 import GlobalOnErrorHandler from './modules/util/GlobalOnErrorHandler';
31 30
 import ScriptUtil from './modules/util/ScriptUtil';
@@ -158,16 +157,6 @@ export default {
158 157
                 this.getGlobalOnErrorHandler.bind(this));
159 158
         }
160 159
 
161
-        if (this.version) {
162
-            const logObject = {
163
-                id: 'component_version',
164
-                component: 'lib-jitsi-meet',
165
-                version: this.version
166
-            };
167
-
168
-            Statistics.sendLog(JSON.stringify(logObject));
169
-        }
170
-
171 160
         return RTC.init(options);
172 161
     },
173 162
 
@@ -379,16 +368,6 @@ export default {
379 368
                 promiseFulfilled = true;
380 369
 
381 370
                 if (error.name === JitsiTrackErrors.SCREENSHARING_USER_CANCELED) {
382
-                    // User cancelled action is not really an error, so only
383
-                    // log it as an event to avoid having conference classified
384
-                    // as partially failed
385
-                    const logObject = {
386
-                        id: 'screensharing_user_canceled',
387
-                        message: error.message
388
-                    };
389
-
390
-                    Statistics.sendLog(JSON.stringify(logObject));
391
-
392 371
                     Statistics.sendAnalytics(
393 372
                         createGetUserMediaEvent(
394 373
                             'warning',
@@ -396,14 +375,6 @@ export default {
396 375
                                 reason: 'extension install user canceled'
397 376
                             }));
398 377
                 } else if (error.name === JitsiTrackErrors.NOT_FOUND) {
399
-                    // logs not found devices with just application log to cs
400
-                    const logObject = {
401
-                        id: 'usermedia_missing_device',
402
-                        status: error.gum.devices
403
-                    };
404
-
405
-                    Statistics.sendLog(JSON.stringify(logObject));
406
-
407 378
                     const attributes
408 379
                         = getAnalyticsAttributesFromOptions(options);
409 380
 
@@ -412,9 +383,6 @@ export default {
412 383
                     Statistics.sendAnalytics(
413 384
                         createGetUserMediaEvent('error', attributes));
414 385
                 } else {
415
-                    // Report gUM failed to the stats
416
-                    Statistics.sendGetUserMediaFailed(error);
417
-
418 386
                     const attributes
419 387
                         = getAnalyticsAttributesFromOptions(options);
420 388
 
@@ -547,8 +515,8 @@ export default {
547 515
             `Line: ${lineno}`,
548 516
             `Column: ${colno}`,
549 517
             'StackTrace: ', error);
550
-        Statistics.reportGlobalError(error);
551 518
     },
519
+    /* eslint-enable max-params */
552 520
 
553 521
     /**
554 522
      * Informs lib-jitsi-meet about the current network status.
@@ -561,10 +529,6 @@ export default {
561 529
         NetworkInfo.updateNetworkInfo({ isOnline });
562 530
     },
563 531
 
564
-    precallTest,
565
-
566
-    /* eslint-enable max-params */
567
-
568 532
     /**
569 533
      * Represents a hub/namespace for utility functionality which may be of
570 534
      * interest to lib-jitsi-meet clients.

+ 1
- 13
modules/RTC/JitsiLocalTrack.js ファイルの表示

@@ -233,7 +233,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
233 233
     }
234 234
 
235 235
     /**
236
-     * Fires NO_DATA_FROM_SOURCE event and logs it to analytics and callstats.
236
+     * Fires NO_DATA_FROM_SOURCE event and logs it to analytics
237 237
      *
238 238
      * @private
239 239
      * @returns {void}
@@ -247,10 +247,6 @@ export default class JitsiLocalTrack extends JitsiTrack {
247 247
 
248 248
         // FIXME: Should we report all of those events
249 249
         Statistics.sendAnalytics(createNoDataFromSourceEvent(this.getType(), value));
250
-        Statistics.sendLog(JSON.stringify({
251
-            name: NO_DATA_FROM_SOURCE,
252
-            log: value
253
-        }));
254 250
     }
255 251
 
256 252
     /**
@@ -817,14 +813,6 @@ export default class JitsiLocalTrack extends JitsiTrack {
817 813
      */
818 814
     setConference(conference) {
819 815
         this.conference = conference;
820
-
821
-        // We want to keep up with postponed events which should have been fired
822
-        // on "attach" call, but for local track we not always have the
823
-        // conference before attaching. However this may result in duplicated
824
-        // events if they have been triggered on "attach" already.
825
-        for (let i = 0; i < this.containers.length; i++) {
826
-            this._maybeFireTrackAttached(this.containers[i]);
827
-        }
828 816
     }
829 817
 
830 818
     /**

+ 0
- 13
modules/RTC/JitsiTrack.js ファイルの表示

@@ -107,18 +107,6 @@ export default class JitsiTrack extends EventEmitter {
107 107
         // Should be defined by the classes that are extending JitsiTrack
108 108
     }
109 109
 
110
-    /**
111
-     * Eventually will trigger RTCEvents.TRACK_ATTACHED event.
112
-     * @param container the video/audio container to which this stream is
113
-     *        attached and for which event will be fired.
114
-     * @private
115
-     */
116
-    _maybeFireTrackAttached(container) {
117
-        if (this.conference && container) {
118
-            this.conference._onTrackAttach(this, container);
119
-        }
120
-    }
121
-
122 110
     /**
123 111
      * Called when the track has been attached to a new container.
124 112
      *
@@ -235,7 +223,6 @@ export default class JitsiTrack extends EventEmitter {
235 223
             result = RTCUtils.attachMediaStream(container, this.stream);
236 224
         }
237 225
         this.containers.push(container);
238
-        this._maybeFireTrackAttached(container);
239 226
         this._attachTTFMTracker(container);
240 227
 
241 228
         return result;

+ 1
- 16
modules/RTCStats/RTCStats.ts ファイルの表示

@@ -15,20 +15,6 @@ import { RTC_STATS_PC_EVENT, RTC_STATS_WC_DISCONNECTED } from './RTCStatsEvents'
15 15
 
16 16
 const logger = getLogger(__filename);
17 17
 
18
-/**
19
- * Filter out RTCPeerConnection that are created by callstats.io.
20
- *
21
- * @param {*} config - Config object sent to the PC c'tor.
22
- * @returns {boolean}
23
- */
24
-function connectionFilter(config) {
25
-    for(const iceUrl of (config?.iceServers ?? [])[0]?.urls ?? []) {
26
-        if (iceUrl.includes('callstats.io')) {
27
-            return true;
28
-        }
29
-    }
30
-}
31
-
32 18
 /**
33 19
  * RTCStats Singleton that is initialized only once for the lifetime of the app, subsequent calls to init will be ignored.
34 20
  * Config and conference changes are handled by the start method.
@@ -63,8 +49,7 @@ class RTCStats {
63 49
 
64 50
         rtcstatsInit(
65 51
             { statsEntry: this.sendStatsEntry.bind(this) },
66
-            { connectionFilter,
67
-              pollInterval,
52
+            { pollInterval,
68 53
               useLegacy,
69 54
               sendSdp,
70 55
               eventCallback: (event) => this.events.emit(RTC_STATS_PC_EVENT, event)}

+ 0
- 8
modules/connectivity/TrackStreamingStatus.ts ファイルの表示

@@ -329,14 +329,6 @@ export class TrackStreamingStatusImpl {
329 329
 
330 330
             logger.debug(`Emit track streaming status(${Date.now()}) ${sourceName}: ${newStatus}`);
331 331
 
332
-            // Log the event on CallStats
333
-            Statistics.sendLog(
334
-                JSON.stringify({
335
-                    id: 'track.streaming.status',
336
-                    track: sourceName,
337
-                    status: newStatus
338
-                }));
339
-
340 332
             // It's common for the event listeners to access the JitsiRemoteTrack. Thus pass it as a parameter here.
341 333
             this.track.emit(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED, this.track, newStatus);
342 334
         }

+ 6
- 6
modules/settings/Settings.js ファイルの表示

@@ -30,14 +30,14 @@ export default {
30 30
     },
31 31
 
32 32
     /**
33
-     * Returns fake username for callstats
33
+     * Returns the ID to use for the purposes of stats, saved in localstorage as "callStatsUserName".
34 34
      * @returns {string} fake username for callstats
35 35
      */
36 36
     get callStatsUserName() {
37 37
         if (!_callStatsUserName) {
38 38
             _callStatsUserName = this._storage.getItem('callStatsUserName');
39 39
             if (!_callStatsUserName) {
40
-                _callStatsUserName = generateCallStatsUserName();
40
+                _callStatsUserName = _generateStatsId();
41 41
                 this._storage.setItem('callStatsUserName', _callStatsUserName);
42 42
             }
43 43
         }
@@ -90,13 +90,13 @@ export default {
90 90
 };
91 91
 
92 92
 /**
93
- * Generate fake username for callstats.
94
- * @returns {string} fake random username
93
+ * Generate a random ID to be used for statistics.
94
+ * @returns {string} the random ID
95 95
  */
96
-function generateCallStatsUserName() {
96
+function _generateStatsId() {
97 97
     const username = UsernameGenerator.generateUsername();
98 98
 
99
-    logger.log('generated callstats uid', username);
99
+    logger.log('generated stats id', username);
100 100
 
101 101
     return username;
102 102
 }

+ 0
- 1
modules/statistics/AnalyticsAdapter.js ファイルの表示

@@ -10,7 +10,6 @@ import browser from '../browser';
10 10
 
11 11
 const MAX_CACHE_SIZE = 100;
12 12
 
13
-// eslist-disable-line no-undef
14 13
 const logger = getLogger(__filename);
15 14
 
16 15
 /**

+ 0
- 787
modules/statistics/CallStats.js ファイルの表示

@@ -1,787 +0,0 @@
1
-/* global callstats */
2
-
3
-import browser from '../browser';
4
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
5
-
6
-const logger = require('@jitsi/logger').getLogger(__filename);
7
-
8
-/**
9
- * We define enumeration of wrtcFuncNames as we need them before
10
- * callstats is initialized to queue events.
11
- * @const
12
- * @see http://www.callstats.io/api/#enumeration-of-wrtcfuncnames
13
- */
14
-const wrtcFuncNames = {
15
-    createOffer: 'createOffer',
16
-    createAnswer: 'createAnswer',
17
-    setLocalDescription: 'setLocalDescription',
18
-    setRemoteDescription: 'setRemoteDescription',
19
-    addIceCandidate: 'addIceCandidate',
20
-    getUserMedia: 'getUserMedia',
21
-    iceConnectionFailure: 'iceConnectionFailure',
22
-    signalingError: 'signalingError',
23
-    applicationLog: 'applicationLog'
24
-};
25
-
26
-/**
27
- * We define enumeration of fabricEvent as we need them before
28
- * callstats is initialized to queue events.
29
- * @const
30
- * @see http://www.callstats.io/api/#enumeration-of-fabricevent
31
- */
32
-const fabricEvent = {
33
-    fabricHold: 'fabricHold',
34
-    fabricResume: 'fabricResume',
35
-    audioMute: 'audioMute',
36
-    audioUnmute: 'audioUnmute',
37
-    videoPause: 'videoPause',
38
-    videoResume: 'videoResume',
39
-    fabricUsageEvent: 'fabricUsageEvent',
40
-    fabricStats: 'fabricStats',
41
-    fabricTerminated: 'fabricTerminated',
42
-    screenShareStart: 'screenShareStart',
43
-    screenShareStop: 'screenShareStop',
44
-    dominantSpeaker: 'dominantSpeaker',
45
-    activeDeviceList: 'activeDeviceList'
46
-};
47
-
48
-/**
49
- * The user id to report to callstats as destination.
50
- * @type {string}
51
- */
52
-const DEFAULT_REMOTE_USER = 'jitsi';
53
-
54
-/**
55
- * Type of pending reports, can be event or an error.
56
- * @type {{ERROR: string, EVENT: string}}
57
- */
58
-const reportType = {
59
-    ERROR: 'error',
60
-    EVENT: 'event',
61
-    MST_WITH_USERID: 'mstWithUserID'
62
-};
63
-
64
-/**
65
- * Set of currently existing {@link CallStats} instances.
66
- * @type {Set<CallStats>}
67
- */
68
-let _fabrics;
69
-
70
-/**
71
- * An instance of this class is a wrapper for the CallStats API fabric. A fabric
72
- * reports one peer connection to the CallStats backend and is allocated with
73
- * {@link callstats.addNewFabric}. It has a bunch of instance methods for
74
- * reporting various events. A fabric is considered disposed when
75
- * {@link CallStats.sendTerminateEvent} is executed.
76
- *
77
- * Currently only one backend instance can be created ever and it's done using
78
- * {@link CallStats.initBackend}. At the time of this writing there is no way to
79
- * explicitly shutdown the backend, but it's supposed to close it's connection
80
- * automatically, after all fabrics have been terminated.
81
- */
82
-export default class CallStats {
83
-    /**
84
-     * A callback passed to {@link callstats.addNewFabric}.
85
-     * @param {string} error 'success' means ok
86
-     * @param {string} msg some more details
87
-     * @private
88
-     */
89
-    static _addNewFabricCallback(error, msg) {
90
-        if (CallStats.backend && error !== 'success') {
91
-            logger.error(`Monitoring status: ${error} msg: ${msg}`);
92
-        }
93
-    }
94
-
95
-    /**
96
-     * Callback passed to {@link callstats.initialize} (backend initialization)
97
-     * @param {string} error 'success' means ok
98
-     * @param {String} msg
99
-     * @private
100
-     */
101
-    static _initCallback(error, msg) {
102
-        logger.log(`CallStats Status: err=${error} msg=${msg}`);
103
-
104
-        // there is no lib, nothing to report to
105
-        if (error !== 'success') {
106
-            return;
107
-        }
108
-
109
-        CallStats.backendInitialized = true;
110
-
111
-        // I hate that
112
-        let atLeastOneFabric = false;
113
-        let defaultInstance = null;
114
-
115
-        for (const callStatsInstance of CallStats.fabrics.values()) {
116
-            if (!callStatsInstance.hasFabric) {
117
-                logger.debug('addNewFabric - initCallback');
118
-                if (callStatsInstance._addNewFabric()) {
119
-                    atLeastOneFabric = true;
120
-                    if (!defaultInstance) {
121
-                        defaultInstance = callStatsInstance;
122
-                    }
123
-                }
124
-            }
125
-        }
126
-
127
-        if (!atLeastOneFabric) {
128
-            return;
129
-        }
130
-
131
-        CallStats._emptyReportQueue(defaultInstance);
132
-    }
133
-
134
-    /**
135
-     * Empties report queue.
136
-     *
137
-     * @param {CallStats} csInstance - The callstats instance.
138
-     * @private
139
-     */
140
-    static _emptyReportQueue(csInstance) {
141
-        // There is no conference ID nor a PeerConnection available when some of
142
-        // the events are scheduled on the reportsQueue, so those will be
143
-        // reported on the first initialized fabric.
144
-        const defaultConfID = csInstance.confID;
145
-        const defaultPC = csInstance.peerconnection;
146
-
147
-        // notify callstats about failures if there were any
148
-        for (const report of CallStats.reportsQueue) {
149
-            if (report.type === reportType.ERROR) {
150
-                const errorData = report.data;
151
-
152
-                CallStats._reportError(
153
-                    csInstance,
154
-                    errorData.type,
155
-                    errorData.error,
156
-                    errorData.pc || defaultPC);
157
-            } else if (report.type === reportType.EVENT) {
158
-                // if we have and event to report and we failed to add
159
-                // fabric this event will not be reported anyway, returning
160
-                // an error
161
-                const eventData = report.data;
162
-
163
-                CallStats.backend.sendFabricEvent(
164
-                    report.pc || defaultPC,
165
-                    eventData.event,
166
-                    defaultConfID,
167
-                    eventData.eventData);
168
-            } else if (report.type === reportType.MST_WITH_USERID) {
169
-                const data = report.data;
170
-
171
-                CallStats.backend.associateMstWithUserID(
172
-                    report.pc || defaultPC,
173
-                    data.callStatsId,
174
-                    defaultConfID,
175
-                    data.ssrc,
176
-                    data.usageLabel,
177
-                    data.containerId
178
-                );
179
-            }
180
-        }
181
-        CallStats.reportsQueue.length = 0;
182
-    }
183
-
184
-    /* eslint-disable max-params */
185
-    /**
186
-     * Reports an error to callstats.
187
-     *
188
-     * @param {CallStats} [cs]
189
-     * @param type the type of the error, which will be one of the wrtcFuncNames
190
-     * @param error the error
191
-     * @param pc the peerconnection
192
-     * @private
193
-     */
194
-    static _reportError(cs, type, error, pc) {
195
-        let _error = error;
196
-
197
-        if (!_error) {
198
-            logger.warn('No error is passed!');
199
-            _error = new Error('Unknown error');
200
-        }
201
-        if (CallStats.backendInitialized && cs) {
202
-            CallStats.backend.reportError(pc, cs.confID, type, _error);
203
-        } else {
204
-            CallStats.reportsQueue.push({
205
-                type: reportType.ERROR,
206
-                data: {
207
-                    error: _error,
208
-                    pc,
209
-                    type
210
-                }
211
-            });
212
-        }
213
-
214
-        // else just ignore it
215
-    }
216
-
217
-    /* eslint-enable max-params */
218
-
219
-    /**
220
-     * Reports an error to callstats.
221
-     *
222
-     * @param {CallStats} cs
223
-     * @param event the type of the event, which will be one of the fabricEvent
224
-     * @param eventData additional data to pass to event
225
-     * @private
226
-     */
227
-    static _reportEvent(cs, event, eventData) {
228
-        const pc = cs && cs.peerconnection;
229
-        const confID = cs && cs.confID;
230
-
231
-        if (CallStats.backendInitialized && cs) {
232
-            CallStats.backend.sendFabricEvent(pc, event, confID, eventData);
233
-        } else {
234
-            CallStats.reportsQueue.push({
235
-                confID,
236
-                pc,
237
-                type: reportType.EVENT,
238
-                data: { event,
239
-                    eventData }
240
-            });
241
-        }
242
-    }
243
-
244
-    /**
245
-     * Wraps some of the CallStats API method and logs their calls with
246
-     * arguments on the debug logging level. Also wraps some of the backend
247
-     * methods execution into try catch blocks to not crash the app in case
248
-     * there is a problem with the backend itself.
249
-     * @param {callstats} theBackend
250
-     * @private
251
-     */
252
-    static _traceAndCatchBackendCalls(theBackend) {
253
-        const tryCatchMethods = [
254
-            'associateMstWithUserID',
255
-            'sendFabricEvent',
256
-            'sendUserFeedback'
257
-
258
-            // 'reportError', - this one needs special handling - see code below
259
-        ];
260
-
261
-        for (const methodName of tryCatchMethods) {
262
-            const originalMethod = theBackend[methodName];
263
-
264
-            theBackend[methodName] = function(...theArguments) {
265
-                try {
266
-                    return originalMethod.apply(theBackend, theArguments);
267
-                } catch (e) {
268
-                    GlobalOnErrorHandler.callErrorHandler(e);
269
-                }
270
-            };
271
-        }
272
-        const debugMethods = [
273
-            'associateMstWithUserID',
274
-            'sendFabricEvent',
275
-            'sendUserFeedback'
276
-
277
-            // 'reportError', - this one needs special handling - see code below
278
-        ];
279
-
280
-        for (const methodName of debugMethods) {
281
-            const originalMethod = theBackend[methodName];
282
-
283
-            theBackend[methodName] = function(...theArguments) {
284
-                logger.debug(methodName, theArguments);
285
-                originalMethod.apply(theBackend, theArguments);
286
-            };
287
-        }
288
-        const originalReportError = theBackend.reportError;
289
-
290
-        /* eslint-disable max-params */
291
-        theBackend.reportError = function(pc, cs, type, ...args) {
292
-            // Logs from the logger are submitted on the applicationLog event
293
-            // "type". Logging the arguments on the logger will create endless
294
-            // loop, because it will put all the logs to the logger queue again.
295
-            if (type === wrtcFuncNames.applicationLog) {
296
-                // NOTE otherArguments are not logged to the console on purpose
297
-                // to not log the whole log batch
298
-                // FIXME check the current logging level (currently not exposed
299
-                // by the logger implementation)
300
-                // NOTE it is not safe to log whole objects on react-native as
301
-                // those contain too many circular references and may crash
302
-                // the app.
303
-                if (!browser.isReactNative()) {
304
-                    console && console.debug('reportError', pc, cs, type);
305
-                }
306
-            } else {
307
-                logger.debug('reportError', pc, cs, type, ...args);
308
-            }
309
-            try {
310
-                originalReportError.call(theBackend, pc, cs, type, ...args);
311
-            } catch (exception) {
312
-                if (type === wrtcFuncNames.applicationLog) {
313
-                    console && console.error('reportError', exception);
314
-                } else {
315
-                    GlobalOnErrorHandler.callErrorHandler(exception);
316
-                }
317
-            }
318
-        };
319
-
320
-        /* eslint-enable max-params */
321
-    }
322
-
323
-    /**
324
-     * Returns the Set with the currently existing {@link CallStats} instances.
325
-     * Lazily initializes the Set to allow any Set polyfills to be applied.
326
-     * @type {Set<CallStats>}
327
-     */
328
-    static get fabrics() {
329
-        if (!_fabrics) {
330
-            _fabrics = new Set();
331
-        }
332
-
333
-        return _fabrics;
334
-    }
335
-
336
-    /**
337
-     * Initializes the CallStats backend. Should be called only if
338
-     * {@link CallStats.isBackendInitialized} returns <tt>false</tt>.
339
-     * @param {object} options
340
-     * @param {String} options.callStatsID CallStats credentials - ID
341
-     * @param {String} options.callStatsSecret CallStats credentials - secret
342
-     * @param {string} options.aliasName the <tt>aliasName</tt> part of
343
-     * the <tt>userID</tt> aka endpoint ID, see CallStats docs for more info.
344
-     * @param {string} options.userName the <tt>userName</tt> part of
345
-     * the <tt>userID</tt> aka display name, see CallStats docs for more info.
346
-     * @param {object} options.configParams the set of parameters
347
-     * to enable/disable certain features in the library. See CallStats docs for more info.
348
-     *
349
-     */
350
-    static initBackend(options) {
351
-        if (CallStats.backend) {
352
-            throw new Error('CallStats backend has been initialized already!');
353
-        }
354
-        try {
355
-            const CallStatsBackend = callstats;
356
-
357
-            CallStats.backend = new CallStatsBackend();
358
-            CallStats._traceAndCatchBackendCalls(CallStats.backend);
359
-            CallStats.userID = {
360
-                aliasName: options.aliasName,
361
-                userName: options.userName
362
-            };
363
-            CallStats.callStatsID = options.callStatsID;
364
-            CallStats.callStatsSecret = options.callStatsSecret;
365
-
366
-            const configParams = { ...options.configParams };
367
-
368
-            if (options.applicationName) {
369
-                configParams.applicationVersion = `${options.applicationName} (${browser.getName()})`;
370
-            }
371
-
372
-            if (options.confID) {
373
-                // we first check is there a tenant in the confID
374
-                const match = options.confID.match(/.*\/(.*)\/.*/);
375
-
376
-                // if there is no tenant, we will just set '/'
377
-                configParams.siteID = options.siteID || (match && match[1]) || '/';
378
-            }
379
-
380
-            // userID is generated or given by the origin server
381
-            CallStats.backend.initialize(
382
-                CallStats.callStatsID,
383
-                CallStats.callStatsSecret,
384
-                CallStats.userID,
385
-                CallStats._initCallback,
386
-                undefined,
387
-                configParams);
388
-
389
-            return true;
390
-        } catch (e) {
391
-            // The callstats.io API failed to initialize (e.g. because its
392
-            // download did not succeed in general or on time). Further attempts
393
-            // to utilize it cannot possibly succeed.
394
-            GlobalOnErrorHandler.callErrorHandler(e);
395
-            CallStats.backend = null;
396
-            logger.error(e);
397
-
398
-            return false;
399
-        }
400
-    }
401
-
402
-    /**
403
-     * Checks if the CallStats backend has been created. It does not mean that
404
-     * it has been initialized, but only that the API instance has been
405
-     * allocated successfully.
406
-     * @return {boolean} <tt>true</tt> if backend exists or <tt>false</tt>
407
-     * otherwise
408
-     */
409
-    static isBackendInitialized() {
410
-        return Boolean(CallStats.backend);
411
-    }
412
-
413
-    /**
414
-     * Notifies CallStats about active device.
415
-     * @param {{deviceList: {String:String}}} devicesData list of devices with
416
-     * their data
417
-     * @param {CallStats} cs callstats instance related to the event
418
-     */
419
-    static sendActiveDeviceListEvent(devicesData, cs) {
420
-        CallStats._reportEvent(cs, fabricEvent.activeDeviceList, devicesData);
421
-    }
422
-
423
-    /**
424
-     * Notifies CallStats that there is a log we want to report.
425
-     *
426
-     * @param {Error} e error to send or {String} message
427
-     * @param {CallStats} cs callstats instance related to the error (optional)
428
-     */
429
-    static sendApplicationLog(e, cs) {
430
-        try {
431
-            CallStats._reportError(
432
-                cs,
433
-                wrtcFuncNames.applicationLog,
434
-                e,
435
-                cs && cs.peerconnection);
436
-        } catch (error) {
437
-            // If sendApplicationLog fails it should not be printed to
438
-            // the logger, because it will try to push the logs again
439
-            // (through sendApplicationLog) and an endless loop is created.
440
-            if (console && (typeof console.error === 'function')) {
441
-                // FIXME send analytics event as well
442
-                console.error('sendApplicationLog failed', error);
443
-            }
444
-        }
445
-    }
446
-
447
-    /**
448
-     * Sends the given feedback through CallStats.
449
-     *
450
-     * @param {string} conferenceID the conference ID for which the feedback
451
-     * will be reported.
452
-     * @param overall an integer between 1 and 5 indicating the
453
-     * user feedback
454
-     * @param comment detailed feedback from the user.
455
-     */
456
-    static sendFeedback(conferenceID, overall, comment) {
457
-        return new Promise((resolve, reject) => {
458
-            if (CallStats.backend) {
459
-                CallStats.backend.sendUserFeedback(
460
-                    conferenceID,
461
-                    {
462
-                        userID: CallStats.userID,
463
-                        overall,
464
-                        comment
465
-                    },
466
-                    (status, message) => {
467
-                        if (status === 'success') {
468
-                            resolve(message);
469
-                        } else {
470
-                            reject(message);
471
-                        }
472
-                    });
473
-            } else {
474
-                const reason = 'Failed to submit feedback to CallStats - no backend';
475
-
476
-                logger.error(reason);
477
-                reject(reason);
478
-            }
479
-        });
480
-    }
481
-
482
-    /**
483
-     * Notifies CallStats that getUserMedia failed.
484
-     *
485
-     * @param {Error} e error to send
486
-     * @param {CallStats} cs callstats instance related to the error (optional)
487
-     */
488
-    static sendGetUserMediaFailed(e, cs) {
489
-        CallStats._reportError(cs, wrtcFuncNames.getUserMedia, e, null);
490
-    }
491
-
492
-    /**
493
-     * Notifies CallStats for mute events
494
-     * @param mute {boolean} true for muted and false for not muted
495
-     * @param type {String} "audio"/"video"
496
-     * @param {CallStats} cs callstats instance related to the event
497
-     */
498
-    static sendMuteEvent(mute, type, cs) {
499
-        let event;
500
-
501
-        if (type === 'video') {
502
-            event = mute ? fabricEvent.videoPause : fabricEvent.videoResume;
503
-        } else {
504
-            event = mute ? fabricEvent.audioMute : fabricEvent.audioUnmute;
505
-        }
506
-
507
-        CallStats._reportEvent(cs, event);
508
-    }
509
-
510
-    /**
511
-     * Creates new CallStats instance that handles all callstats API calls for
512
-     * given {@link TraceablePeerConnection}. Each instance is meant to handle
513
-     * one CallStats fabric added with 'addFabric' API method for the
514
-     * {@link TraceablePeerConnection} instance passed in the constructor.
515
-     * @param {TraceablePeerConnection} tpc
516
-     * @param {Object} options
517
-     * @param {string} options.confID the conference ID that wil be used to
518
-     * report the session.
519
-     * @param {string} [options.remoteUserID='jitsi'] the remote user ID to
520
-     * which given <tt>tpc</tt> is connected.
521
-     */
522
-    constructor(tpc, options) {
523
-        this.confID = options.confID;
524
-        this.tpc = tpc;
525
-        this.peerconnection = tpc.peerconnection;
526
-        this.remoteUserID = options.remoteUserID || DEFAULT_REMOTE_USER;
527
-        this.hasFabric = false;
528
-
529
-        CallStats.fabrics.add(this);
530
-
531
-        if (CallStats.backendInitialized) {
532
-            this._addNewFabric();
533
-
534
-            // if this is the first fabric let's try to empty the
535
-            // report queue. Reports all events that we recorded between
536
-            // backend initialization and receiving the first fabric
537
-            if (CallStats.fabrics.size === 1) {
538
-                CallStats._emptyReportQueue(this);
539
-            }
540
-        }
541
-    }
542
-
543
-    /**
544
-     * Initializes CallStats fabric by calling "addNewFabric" for
545
-     * the peer connection associated with this instance.
546
-     * @return {boolean} true if the call was successful or false otherwise.
547
-     */
548
-    _addNewFabric() {
549
-        logger.info('addNewFabric', this.remoteUserID);
550
-        try {
551
-            const fabricAttributes = {
552
-                remoteEndpointType:
553
-                    this.tpc.isP2P
554
-                        ? CallStats.backend.endpointType.peer
555
-                        : CallStats.backend.endpointType.server
556
-            };
557
-            const ret
558
-                = CallStats.backend.addNewFabric(
559
-                    this.peerconnection,
560
-                    this.remoteUserID,
561
-                    CallStats.backend.fabricUsage.multiplex,
562
-                    this.confID,
563
-                    fabricAttributes,
564
-                    CallStats._addNewFabricCallback);
565
-
566
-            this.hasFabric = true;
567
-
568
-            const success = ret.status === 'success';
569
-
570
-            if (!success) {
571
-                logger.error('callstats fabric not initilized', ret.message);
572
-            }
573
-
574
-            return success;
575
-
576
-        } catch (error) {
577
-            GlobalOnErrorHandler.callErrorHandler(error);
578
-
579
-            return false;
580
-        }
581
-    }
582
-
583
-    /* eslint-disable max-params */
584
-
585
-    /**
586
-     * Lets CallStats module know where is given SSRC rendered by providing
587
-     * renderer tag ID.
588
-     * If the lib is not initialized yet queue the call for later, when it's
589
-     * ready.
590
-     * @param {number} ssrc the SSRC of the stream
591
-     * @param {boolean} isLocal indicates whether this the stream is local
592
-     * @param {string|null} streamEndpointId if the stream is not local the it
593
-     * needs to contain the stream owner's ID
594
-     * @param {string} usageLabel meaningful usage label of this stream like
595
-     *        'microphone', 'camera' or 'screen'.
596
-     * @param {string} containerId  the id of media 'audio' or 'video' tag which
597
-     *        renders the stream.
598
-     */
599
-    associateStreamWithVideoTag(
600
-            ssrc,
601
-            isLocal,
602
-            streamEndpointId,
603
-            usageLabel,
604
-            containerId) {
605
-        if (!CallStats.backend) {
606
-            return;
607
-        }
608
-
609
-        const callStatsId = isLocal ? CallStats.userID : streamEndpointId;
610
-
611
-        if (CallStats.backendInitialized) {
612
-            CallStats.backend.associateMstWithUserID(
613
-                this.peerconnection,
614
-                callStatsId,
615
-                this.confID,
616
-                ssrc,
617
-                usageLabel,
618
-                containerId);
619
-        } else {
620
-            CallStats.reportsQueue.push({
621
-                type: reportType.MST_WITH_USERID,
622
-                pc: this.peerconnection,
623
-                data: {
624
-                    callStatsId,
625
-                    containerId,
626
-                    ssrc,
627
-                    usageLabel
628
-                }
629
-            });
630
-        }
631
-    }
632
-
633
-    /* eslint-enable max-params */
634
-
635
-    /**
636
-     * Notifies CallStats that we are the new dominant speaker in the
637
-     * conference.
638
-     */
639
-    sendDominantSpeakerEvent() {
640
-        CallStats._reportEvent(this, fabricEvent.dominantSpeaker);
641
-    }
642
-
643
-    /**
644
-     * Notifies CallStats that the fabric for the underlying peerconnection was
645
-     * closed and no evens should be reported, after this call.
646
-     */
647
-    sendTerminateEvent() {
648
-        if (CallStats.backendInitialized) {
649
-            CallStats.backend.sendFabricEvent(
650
-                this.peerconnection,
651
-                CallStats.backend.fabricEvent.fabricTerminated,
652
-                this.confID);
653
-        }
654
-        CallStats.fabrics.delete(this);
655
-    }
656
-
657
-    /**
658
-     * Notifies CallStats for ice connection failed
659
-     */
660
-    sendIceConnectionFailedEvent() {
661
-        CallStats._reportError(
662
-            this,
663
-            wrtcFuncNames.iceConnectionFailure,
664
-            null,
665
-            this.peerconnection);
666
-    }
667
-
668
-    /**
669
-     * Notifies CallStats that peer connection failed to create offer.
670
-     *
671
-     * @param {Error} e error to send
672
-     */
673
-    sendCreateOfferFailed(e) {
674
-        CallStats._reportError(
675
-            this, wrtcFuncNames.createOffer, e, this.peerconnection);
676
-    }
677
-
678
-    /**
679
-     * Notifies CallStats that peer connection failed to create answer.
680
-     *
681
-     * @param {Error} e error to send
682
-     */
683
-    sendCreateAnswerFailed(e) {
684
-        CallStats._reportError(
685
-            this, wrtcFuncNames.createAnswer, e, this.peerconnection);
686
-    }
687
-
688
-    /**
689
-     * Sends either resume or hold event for the fabric associated with
690
-     * the underlying peerconnection.
691
-     * @param {boolean} isResume true to resume or false to hold
692
-     */
693
-    sendResumeOrHoldEvent(isResume) {
694
-        CallStats._reportEvent(
695
-            this,
696
-            isResume ? fabricEvent.fabricResume : fabricEvent.fabricHold);
697
-    }
698
-
699
-    /**
700
-     * Notifies CallStats for screen sharing events
701
-     * @param {boolean} start true for starting screen sharing and
702
-     * false for not stopping
703
-     * @param {string|null} ssrc - optional ssrc value, used only when
704
-     * starting screen sharing.
705
-     */
706
-    sendScreenSharingEvent(start, ssrc) {
707
-        let eventData;
708
-
709
-        if (ssrc) {
710
-            eventData = { ssrc };
711
-        }
712
-
713
-        CallStats._reportEvent(
714
-            this,
715
-            start ? fabricEvent.screenShareStart : fabricEvent.screenShareStop,
716
-            eventData);
717
-    }
718
-
719
-    /**
720
-     * Notifies CallStats that peer connection failed to set local description.
721
-     *
722
-     * @param {Error} e error to send
723
-     */
724
-    sendSetLocalDescFailed(e) {
725
-        CallStats._reportError(
726
-            this, wrtcFuncNames.setLocalDescription, e, this.peerconnection);
727
-    }
728
-
729
-    /**
730
-     * Notifies CallStats that peer connection failed to set remote description.
731
-     *
732
-     * @param {Error} e error to send
733
-     */
734
-    sendSetRemoteDescFailed(e) {
735
-        CallStats._reportError(
736
-            this, wrtcFuncNames.setRemoteDescription, e, this.peerconnection);
737
-    }
738
-
739
-    /**
740
-     * Notifies CallStats that peer connection failed to add ICE candidate.
741
-     *
742
-     * @param {Error} e error to send
743
-     */
744
-    sendAddIceCandidateFailed(e) {
745
-        CallStats._reportError(
746
-            this, wrtcFuncNames.addIceCandidate, e, this.peerconnection);
747
-    }
748
-}
749
-
750
-/**
751
- * The CallStats API backend instance
752
- * @type {callstats}
753
- */
754
-CallStats.backend = null;
755
-
756
-// some errors/events may happen before CallStats init
757
-// in this case we accumulate them in this array
758
-// and send them to callstats on init
759
-CallStats.reportsQueue = [];
760
-
761
-/**
762
- * Whether the library was successfully initialized(the backend) using its
763
- * initialize method.
764
- * @type {boolean}
765
- */
766
-CallStats.backendInitialized = false;
767
-
768
-/**
769
- * Part of the CallStats credentials - application ID
770
- * @type {string}
771
- */
772
-CallStats.callStatsID = null;
773
-
774
-/**
775
- * Part of the CallStats credentials - application secret
776
- * @type {string}
777
- */
778
-CallStats.callStatsSecret = null;
779
-
780
-/**
781
- * Local CallStats user ID structure. Can be set only once when
782
- * {@link backend} is initialized, so it's static for the time being.
783
- * See CallStats API for more info:
784
- * https://www.callstats.io/api/#userid
785
- * @type {object}
786
- */
787
-CallStats.userID = null;

+ 0
- 133
modules/statistics/PrecallTest.js ファイルの表示

@@ -1,133 +0,0 @@
1
-import EventEmitter from 'events';
2
-
3
-import browser from '../browser';
4
-import Settings from '../settings/Settings';
5
-import ScriptUtil from '../util/ScriptUtil';
6
-
7
-import { CALLSTATS_SCRIPT_URL } from './constants';
8
-
9
-const PRECALL_TEST_RESULTS = 'preCallTestResults';
10
-const emitter = new EventEmitter();
11
-let _initialized = false;
12
-let api = null;
13
-
14
-/**
15
- * Loads the callstats io script.
16
- *
17
- * @returns {Promise<void>}
18
- */
19
-function _loadScript(options) {
20
-    if (browser.isReactNative()) {
21
-        return;
22
-    }
23
-
24
-    return new Promise(resolve => {
25
-        ScriptUtil.loadScript(
26
-            options.callStatsCustomScriptUrl || CALLSTATS_SCRIPT_URL,
27
-            /* async */ true,
28
-            /* prepend */ true,
29
-            /* relativeURL */ undefined,
30
-            /* loadCallback */ resolve);
31
-    });
32
-}
33
-
34
-/**
35
- * Initializes the callstats lib and registers a callback to be invoked
36
- * when there are 'preCallTestResults'.
37
- *
38
- * @typedef PrecallTestOptions
39
- * @type {Object}
40
- * @property {string} callStatsID - Callstats credentials - the id.
41
- * @property {string} callStatsSecret - Callstats credentials - the secret.
42
- * @property {string} statisticsId - The user name to use when initializing callstats.
43
- * @property {string} statisticsDisplayName - The user display name.
44
- *
45
- * @param { PrecallTestOptions} options - The init options.
46
- * @returns {Promise<void>}
47
- */
48
-function _initialize(options) {
49
-    return new Promise((resolve, reject) => {
50
-        const appId = options.callStatsID;
51
-        const appSecret = options.callStatsSecret;
52
-        const userId = options.statisticsId || options.statisticsDisplayName || Settings.callStatsUserName;
53
-
54
-        api.initialize(appId, appSecret, userId, (status, message) => {
55
-            if (status === 'success') {
56
-                api.on(PRECALL_TEST_RESULTS, (...args) => {
57
-                    emitter.emit(PRECALL_TEST_RESULTS, ...args);
58
-                });
59
-                _initialized = true;
60
-                resolve();
61
-            } else {
62
-                reject({
63
-                    status,
64
-                    message
65
-                });
66
-            }
67
-        }, null, { disablePrecalltest: true });
68
-    });
69
-}
70
-
71
-/**
72
- * Loads the callstats script and initializes the library.
73
- *
74
- * @param {Function} onResult - The callback to be invoked when results are received.
75
- * @returns {Promise<void>}
76
- */
77
-export async function init(options) {
78
-    if (_initialized) {
79
-        throw new Error('Precall Test already initialized');
80
-    }
81
-
82
-    const { callStatsID, callStatsSecret, disableThirdPartyRequests } = options;
83
-
84
-    if (!callStatsID || !callStatsSecret || disableThirdPartyRequests) {
85
-        throw new Error('Callstats is disabled');
86
-    }
87
-
88
-    await _loadScript(options);
89
-    // eslint-disable-next-line new-cap
90
-    api = new window.callstats();
91
-
92
-    return _initialize(options);
93
-}
94
-
95
-/**
96
- * Executes a pre call test.
97
- *
98
- * @typedef PrecallTestResults
99
- * @type {Object}
100
- * @property {boolean} mediaConnectivity - If there is media connectivity or not.
101
- * @property {number} throughput  - The average throughput.
102
- * @property {number} fractionalLoss - The packet loss.
103
- * @property {number} rtt - The round trip time.
104
- * @property {string} provider - It is usually 'callstats'.
105
- *
106
- * @returns {Promise<{PrecallTestResults}>}
107
- */
108
-export function execute() {
109
-    if (!_initialized) {
110
-        return Promise.reject('uninitialized');
111
-    }
112
-
113
-    return new Promise((resolve, reject) => {
114
-        emitter.on(PRECALL_TEST_RESULTS, (status, payload) => {
115
-            if (status === 'success') {
116
-                resolve(payload);
117
-            } else {
118
-                reject({
119
-                    status,
120
-                    payload
121
-                });
122
-            }
123
-
124
-        });
125
-
126
-        api.makePrecallTest();
127
-    });
128
-}
129
-
130
-export default {
131
-    init,
132
-    execute
133
-};

+ 0
- 2
modules/statistics/constants.js ファイルの表示

@@ -1,5 +1,3 @@
1
-export const CALLSTATS_SCRIPT_URL = 'https://api.callstats.io/static/callstats-ws.min.js';
2
-
3 1
 /**
4 2
  * The number of remote speakers for which the audio levels will be calculated using
5 3
  * RTCRtpReceiver#getSynchronizationSources. Limit the number of endpoints to save cpu on the client as this API call

+ 6
- 500
modules/statistics/statistics.js ファイルの表示

@@ -1,21 +1,17 @@
1 1
 import EventEmitter from 'events';
2 2
 
3 3
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
4
-import JitsiTrackError from '../../JitsiTrackError';
5 4
 import { JitsiTrackEvents } from '../../JitsiTrackEvents';
6 5
 import { FEEDBACK } from '../../service/statistics/AnalyticsEvents';
7 6
 import * as StatisticsEvents from '../../service/statistics/Events';
8 7
 import RTCStats from '../RTCStats/RTCStats';
9 8
 import browser from '../browser';
10
-import ScriptUtil from '../util/ScriptUtil';
11 9
 import WatchRTC from '../watchRTC/WatchRTC';
12 10
 
13 11
 import analytics from './AnalyticsAdapter';
14
-import CallStats from './CallStats';
15 12
 import LocalStats from './LocalStatsCollector';
16 13
 import { PerformanceObserverStats } from './PerformanceObserverStats';
17 14
 import RTPStats from './RTPStatsCollector';
18
-import { CALLSTATS_SCRIPT_URL } from './constants';
19 15
 
20 16
 const logger = require('@jitsi/logger').getLogger(__filename);
21 17
 
@@ -25,91 +21,6 @@ const logger = require('@jitsi/logger').getLogger(__filename);
25 21
  */
26 22
 let _instances;
27 23
 
28
-/**
29
- * True if callstats API is loaded
30
- */
31
-let isCallstatsLoaded = false;
32
-
33
-/**
34
- * Since callstats.io is a third party, we cannot guarantee the quality of their
35
- * service. More specifically, their server may take noticeably long time to
36
- * respond. Consequently, it is in our best interest (in the sense that the
37
- * intergration of callstats.io is pretty important to us but not enough to
38
- * allow it to prevent people from joining a conference) to (1) start
39
- * downloading their API as soon as possible and (2) do the downloading
40
- * asynchronously.
41
- *
42
- * @param {StatisticsOptions} options - Options to use for downloading and
43
- * initializing callstats backend.
44
- */
45
-function loadCallStatsAPI(options) {
46
-    if (!isCallstatsLoaded) {
47
-        ScriptUtil.loadScript(
48
-            options.customScriptUrl || CALLSTATS_SCRIPT_URL,
49
-            /* async */ true,
50
-            /* prepend */ true,
51
-            /* relativeURL */ undefined,
52
-            /* loadCallback */ () => _initCallStatsBackend(options)
53
-        );
54
-        isCallstatsLoaded = true;
55
-    }
56
-}
57
-
58
-/**
59
- * Initializes Callstats backend.
60
- *
61
- * @param {StatisticsOptions} options - The options to use for initializing
62
- * callstats backend.
63
- * @private
64
- */
65
-function _initCallStatsBackend(options) {
66
-    if (CallStats.isBackendInitialized()) {
67
-        return;
68
-    }
69
-
70
-    if (!CallStats.initBackend({
71
-        callStatsID: options.callStatsID,
72
-        callStatsSecret: options.callStatsSecret,
73
-        userName: options.userName,
74
-        aliasName: options.aliasName,
75
-        applicationName: options.applicationName,
76
-        confID: options.confID,
77
-        siteID: options.siteID,
78
-        configParams: options.configParams
79
-    })) {
80
-        logger.error('CallStats Backend initialization failed bad');
81
-    }
82
-}
83
-
84
-/**
85
- * callstats strips any additional fields from Error except for "name", "stack",
86
- * "message" and "constraintName". So we need to bundle additional information
87
- * from JitsiTrackError into error passed to callstats to preserve valuable
88
- * information about error.
89
- * @param {JitsiTrackError} error
90
- */
91
-function formatJitsiTrackErrorForCallStats(error) {
92
-    const err = new Error();
93
-
94
-    // Just copy original stack from error
95
-    err.stack = error.stack;
96
-
97
-    // Combine name from error's name plus (possibly) name of original GUM error
98
-    err.name = (error.name || 'Unknown error') + (error.gum && error.gum.error
99
-        && error.gum.error.name ? ` - ${error.gum.error.name}` : '');
100
-
101
-    // Put all constraints into this field. For constraint failed errors we will
102
-    // still know which exactly constraint failed as it will be a part of
103
-    // message.
104
-    err.constraintName = error.gum && error.gum.constraints
105
-        ? JSON.stringify(error.gum.constraints) : '';
106
-
107
-    // Just copy error's message.
108
-    err.message = error.message;
109
-
110
-    return err;
111
-}
112
-
113 24
 /**
114 25
  * Init statistic options
115 26
  * @param options
@@ -141,20 +52,8 @@ Statistics.init = function(options) {
141 52
 /**
142 53
  * The options to configure Statistics.
143 54
  * @typedef {Object} StatisticsOptions
144
- * @property {string} applicationName - The application name to pass to
145
- * callstats.
146
- * @property {string} aliasName - The alias name to use when initializing callstats.
147
- * @property {string} userName - The user name to use when initializing callstats.
148
- * @property {string} confID - The callstats conference ID to use.
149
- * @property {string} callStatsID - Callstats credentials - the id.
150
- * @property {string} callStatsSecret - Callstats credentials - the secret.
151
- * @property {string} customScriptUrl - A custom lib url to use when downloading
152
- * callstats library.
55
+ * @property {string} userName - The user name to use
153 56
  * @property {string} roomName - The room name we are currently in.
154
- * @property {string} configParams - The set of parameters
155
- * to enable/disable certain features in the library. See CallStats docs for more info.
156
- */
157
-/**
158 57
  *
159 58
  * @param {JitsiConference} conference - The conference instance from which the statistics were initialized.
160 59
  * @param {StatisticsOptions} options - The options to use creating the
@@ -172,35 +71,6 @@ export default function Statistics(conference, options) {
172 71
     this.xmpp = conference?.xmpp;
173 72
     this.options = options || {};
174 73
 
175
-    this.callStatsIntegrationEnabled
176
-        = this.options.callStatsID && this.options.callStatsSecret
177
-
178
-            // Even though AppID and AppSecret may be specified, the integration
179
-            // of callstats.io may be disabled because of globally-disallowed
180
-            // requests to any third parties.
181
-            && (Statistics.disableThirdPartyRequests !== true);
182
-    if (this.callStatsIntegrationEnabled) {
183
-        this.callStatsApplicationLogsDisabled
184
-            = this.options.callStatsApplicationLogsDisabled;
185
-        if (browser.isReactNative()) {
186
-            _initCallStatsBackend(this.options);
187
-        } else {
188
-            loadCallStatsAPI(this.options);
189
-        }
190
-
191
-        if (!this.options.confID) {
192
-            logger.warn('"confID" is not defined');
193
-        }
194
-    }
195
-
196
-    /**
197
-     * Stores {@link CallStats} instances for each
198
-     * {@link TraceablePeerConnection} (one {@link CallStats} instance serves
199
-     * one TPC). The instances are mapped by {@link TraceablePeerConnection.id}.
200
-     * @type {Map<number, CallStats>}
201
-     */
202
-    this.callsStatsInstances = new Map();
203
-
204 74
     Statistics.instances.add(this);
205 75
 
206 76
     RTCStats.start(this.conference);
@@ -419,19 +289,8 @@ Statistics.prototype.setSpeakerList = function(speakerList) {
419 289
 
420 290
 Statistics.prototype.dispose = function() {
421 291
     try {
422
-        // NOTE Before reading this please see the comment in stopCallStats...
423
-        //
424
-        // Here we prevent from emitting the event twice in case it will be
425
-        // triggered from stopCallStats.
426
-        // If the event is triggered from here it means that the logs will not
427
-        // be submitted anyway (because there is no CallStats instance), but
428
-        // we're doing that for the sake of some kind of consistency.
429
-        if (!this.callsStatsInstances.size) {
430
-            this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
431
-        }
432
-        for (const callStats of this.callsStatsInstances.values()) {
433
-            this.stopCallStats(callStats.tpc);
434
-        }
292
+        this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
293
+
435 294
         for (const tpcId of this.rtpStatsMap.keys()) {
436 295
             this._stopRemoteStats(tpcId);
437 296
         }
@@ -482,347 +341,12 @@ Statistics.prototype.stopRemoteStats = function(tpc) {
482 341
     this._stopRemoteStats(tpc.id);
483 342
 };
484 343
 
485
-// CALSTATS METHODS
486
-
487 344
 /**
488
- * Initializes the callstats.io API.
489
- * @param {TraceablePeerConnection} tpc the {@link TraceablePeerConnection}
490
- * instance for which CalStats will be started.
491
- * @param {string} remoteUserID
492
- */
493
-Statistics.prototype.startCallStats = function(tpc, remoteUserID) {
494
-    if (!this.callStatsIntegrationEnabled) {
495
-        return;
496
-    } else if (this.callsStatsInstances.has(tpc.id)) {
497
-        logger.error('CallStats instance for ${tpc} exists already');
498
-
499
-        return;
500
-    }
501
-    let confID = this.options.confID;
502
-
503
-    // confID - domain/tenant/roomName
504
-    // roomName - meeting name or breakout room ID
505
-    // For breakout rooms we change the conference ID used for callstats to use
506
-    // the room ID instead of the meeting name
507
-    if (!confID.endsWith(this.options.roomName)) {
508
-        confID = `${this.options.confID.slice(0, this.options.confID.lastIndexOf('/'))}/${this.options.roomName}`;
509
-    }
510
-
511
-    logger.info(`Starting CallStats for ${tpc}...`);
512
-    const newInstance
513
-        = new CallStats(
514
-            tpc,
515
-            {
516
-                confID,
517
-                remoteUserID
518
-            });
519
-
520
-    this.callsStatsInstances.set(tpc.id, newInstance);
521
-};
522
-
523
-/**
524
- * Obtains the list of *all* {@link CallStats} instances collected from every
525
- * valid {@link Statistics} instance.
526
- * @return {Set<CallStats>}
527
- * @private
528
- */
529
-Statistics._getAllCallStatsInstances = function() {
530
-    const csInstances = new Set();
531
-
532
-    for (const statistics of Statistics.instances) {
533
-        for (const cs of statistics.callsStatsInstances.values()) {
534
-            csInstances.add(cs);
535
-        }
536
-    }
537
-
538
-    return csInstances;
539
-};
540
-
541
-/**
542
- * Removes the callstats.io instances.
543
- */
544
-Statistics.prototype.stopCallStats = function(tpc) {
545
-    const callStatsInstance = this.callsStatsInstances.get(tpc.id);
546
-
547
-    if (callStatsInstance) {
548
-        // FIXME the original purpose of adding BEFORE_DISPOSED event was to be
549
-        // able to submit the last log batch from jitsi-meet to CallStats. After
550
-        // recent changes we dispose the CallStats earlier
551
-        // (before Statistics.dispose), so we need to emit this event here to
552
-        // give this last chance for final log batch submission.
553
-        //
554
-        // Eventually there should be a separate module called "log storage"
555
-        // which should emit proper events when it's underlying
556
-        // CallStats instance is going away.
557
-        if (this.callsStatsInstances.size === 1) {
558
-            this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
559
-        }
560
-        this.callsStatsInstances.delete(tpc.id);
561
-
562
-        // The fabric needs to be terminated when being stopped
563
-        callStatsInstance.sendTerminateEvent();
564
-    }
565
-};
566
-
567
-/**
568
- * Returns true if the callstats integration is enabled, otherwise returns
569
- * false.
570
- *
571
- * @returns true if the callstats integration is enabled, otherwise returns
572
- * false.
573
- */
574
-Statistics.prototype.isCallstatsEnabled = function() {
575
-    return this.callStatsIntegrationEnabled;
576
-};
577
-
578
-/**
579
- * Logs either resume or hold event for the given peer connection.
580
- * @param {TraceablePeerConnection} tpc the connection for which event will be
581
- * reported
582
- * @param {boolean} isResume true for resume or false for hold
583
- */
584
-Statistics.prototype.sendConnectionResumeOrHoldEvent = function(tpc, isResume) {
585
-    const instance = this.callsStatsInstances.get(tpc.id);
586
-
587
-    if (instance) {
588
-        instance.sendResumeOrHoldEvent(isResume);
589
-    }
590
-};
591
-
592
-/**
593
- * Notifies CallStats and analytics (if present) for ice connection failed
594
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
595
- */
596
-Statistics.prototype.sendIceConnectionFailedEvent = function(tpc) {
597
-    const instance = this.callsStatsInstances.get(tpc.id);
598
-
599
-    if (instance) {
600
-        instance.sendIceConnectionFailedEvent();
601
-    }
602
-};
603
-
604
-/**
605
- * Notifies CallStats for mute events
606
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
607
- * @param {boolean} muted true for muted and false for not muted
608
- * @param {String} type "audio"/"video"
609
- */
610
-Statistics.prototype.sendMuteEvent = function(tpc, muted, type) {
611
-    const instance = tpc && this.callsStatsInstances.get(tpc.id);
612
-
613
-    CallStats.sendMuteEvent(muted, type, instance);
614
-};
615
-
616
-/**
617
- * Notifies CallStats for screen sharing events
618
- * @param start {boolean} true for starting screen sharing and
619
- * false for not stopping
620
- * @param {string|null} ssrc - optional ssrc value, used only when
621
- * starting screen sharing.
622
- */
623
-Statistics.prototype.sendScreenSharingEvent
624
-    = function(start, ssrc) {
625
-        for (const cs of this.callsStatsInstances.values()) {
626
-            cs.sendScreenSharingEvent(start, ssrc);
627
-        }
628
-    };
629
-
630
-/**
631
- * Notifies the statistics module that we are now the dominant speaker of the
632
- * conference.
633
- * @param {String} roomJid - The room jid where the speaker event occurred.
634
- * @param {boolean} silence - Whether the dominant speaker is silent or not.
635
- */
636
-Statistics.prototype.sendDominantSpeakerEvent = function(roomJid, silence) {
637
-    for (const cs of this.callsStatsInstances.values()) {
638
-        cs.sendDominantSpeakerEvent();
639
-    }
640
-
641
-    // xmpp send dominant speaker event
642
-    this.xmpp.sendDominantSpeakerEvent(roomJid, silence);
643
-};
644
-
645
-/**
646
- * Notifies about active device.
647
- * @param {{deviceList: {String:String}}} devicesData - list of devices with
648
- *      their data
649
- */
650
-Statistics.sendActiveDeviceListEvent = function(devicesData) {
651
-    const globalSet = Statistics._getAllCallStatsInstances();
652
-
653
-    if (globalSet.size) {
654
-        for (const cs of globalSet) {
655
-            CallStats.sendActiveDeviceListEvent(devicesData, cs);
656
-        }
657
-    } else {
658
-        CallStats.sendActiveDeviceListEvent(devicesData, null);
659
-    }
660
-};
661
-
662
-/* eslint-disable max-params */
663
-
664
-/**
665
- * Lets the underlying statistics module know where is given SSRC rendered by
666
- * providing renderer tag ID.
667
- * @param {TraceablePeerConnection} tpc the connection to which the stream
668
- * belongs to
669
- * @param {number} ssrc the SSRC of the stream
670
- * @param {boolean} isLocal
671
- * @param {string} userId
672
- * @param {string} usageLabel  meaningful usage label of this stream like
673
- *        'microphone', 'camera' or 'screen'.
674
- * @param {string} containerId the id of media 'audio' or 'video' tag which
675
- *        renders the stream.
676
- */
677
-Statistics.prototype.associateStreamWithVideoTag = function(
678
-        tpc,
679
-        ssrc,
680
-        isLocal,
681
-        userId,
682
-        usageLabel,
683
-        containerId) {
684
-    const instance = this.callsStatsInstances.get(tpc.id);
685
-
686
-    if (instance) {
687
-        instance.associateStreamWithVideoTag(
688
-            ssrc,
689
-            isLocal,
690
-            userId,
691
-            usageLabel,
692
-            containerId);
693
-    }
694
-};
695
-
696
-/* eslint-enable max-params */
697
-
698
-/**
699
- * Notifies CallStats that getUserMedia failed.
700
- *
701
- * @param {Error} e error to send
702
- */
703
-Statistics.sendGetUserMediaFailed = function(e) {
704
-    const error
705
-        = e instanceof JitsiTrackError
706
-            ? formatJitsiTrackErrorForCallStats(e) : e;
707
-    const globalSet = Statistics._getAllCallStatsInstances();
708
-
709
-    if (globalSet.size) {
710
-        for (const cs of globalSet) {
711
-            CallStats.sendGetUserMediaFailed(error, cs);
712
-        }
713
-    } else {
714
-        CallStats.sendGetUserMediaFailed(error, null);
715
-    }
716
-};
717
-
718
-/**
719
- * Notifies CallStats that peer connection failed to create offer.
720
- *
721
- * @param {Error} e error to send
722
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
723
- */
724
-Statistics.prototype.sendCreateOfferFailed = function(e, tpc) {
725
-    const instance = this.callsStatsInstances.get(tpc.id);
726
-
727
-    if (instance) {
728
-        instance.sendCreateOfferFailed(e);
729
-    }
730
-};
731
-
732
-/**
733
- * Notifies CallStats that peer connection failed to create answer.
734
- *
735
- * @param {Error} e error to send
736
- * @param {TraceablePeerConnection} tpc connection on which failure occured.
737
- */
738
-Statistics.prototype.sendCreateAnswerFailed = function(e, tpc) {
739
-    const instance = this.callsStatsInstances.get(tpc.id);
740
-
741
-    if (instance) {
742
-        instance.sendCreateAnswerFailed(e);
743
-    }
744
-};
745
-
746
-/**
747
- * Notifies CallStats that peer connection failed to set local description.
748
- *
749
- * @param {Error} e error to send
750
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
751
- */
752
-Statistics.prototype.sendSetLocalDescFailed = function(e, tpc) {
753
-    const instance = this.callsStatsInstances.get(tpc.id);
754
-
755
-    if (instance) {
756
-        instance.sendSetLocalDescFailed(e);
757
-    }
758
-};
759
-
760
-/**
761
- * Notifies CallStats that peer connection failed to set remote description.
762
- *
763
- * @param {Error} e error to send
764
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
765
- */
766
-Statistics.prototype.sendSetRemoteDescFailed = function(e, tpc) {
767
-    const instance = this.callsStatsInstances.get(tpc.id);
768
-
769
-    if (instance) {
770
-        instance.sendSetRemoteDescFailed(e);
771
-    }
772
-};
773
-
774
-/**
775
- * Notifies CallStats that peer connection failed to add ICE candidate.
776
- *
777
- * @param {Error} e error to send
778
- * @param {TraceablePeerConnection} tpc connection on which failure occurred.
779
- */
780
-Statistics.prototype.sendAddIceCandidateFailed = function(e, tpc) {
781
-    const instance = this.callsStatsInstances.get(tpc.id);
782
-
783
-    if (instance) {
784
-        instance.sendAddIceCandidateFailed(e);
785
-    }
786
-};
787
-
788
-/**
789
- * Adds to CallStats an application log.
790
- *
791
- * @param {String} m a log message to send or an {Error} object to be reported
792
- */
793
-Statistics.sendLog = function(m) {
794
-    const globalSubSet = new Set();
795
-
796
-    // FIXME we don't want to duplicate logs over P2P instance, but
797
-    // here we should go over instances and call this method for each
798
-    // unique conference ID rather than selecting the first one.
799
-    // We don't have such use case though, so leaving as is for now.
800
-    for (const stats of Statistics.instances) {
801
-        if (stats.callStatsApplicationLogsDisabled) {
802
-            return;
803
-        }
804
-
805
-        if (stats.callsStatsInstances.size) {
806
-            globalSubSet.add(stats.callsStatsInstances.values().next().value);
807
-        }
808
-    }
809
-
810
-    if (globalSubSet.size) {
811
-        for (const csPerStats of globalSubSet) {
812
-            CallStats.sendApplicationLog(m, csPerStats);
813
-        }
814
-    } else {
815
-        CallStats.sendApplicationLog(m, null);
816
-    }
817
-};
818
-
819
-/**
820
- * Sends the given feedback through CallStats.
345
+ * Sends the given feedback
821 346
  *
822 347
  * @param overall an integer between 1 and 5 indicating the user's rating.
823 348
  * @param comment the comment from the user.
824
- * @returns {Promise} Resolves when callstats feedback has been submitted
825
- * successfully.
349
+ * @returns {Promise} Resolves immediately.
826 350
  */
827 351
 Statistics.prototype.sendFeedback = function(overall, comment) {
828 352
     // Statistics.analytics.sendEvent is currently fire and forget, without
@@ -834,31 +358,13 @@ Statistics.prototype.sendFeedback = function(overall, comment) {
834 358
             comment
835 359
         });
836 360
 
837
-    if (this.isCallstatsEnabled()) {
838
-        return CallStats.sendFeedback(this.options.confID, overall, comment);
839
-    }
840
-
841 361
     return Promise.resolve();
842 362
 };
843 363
 
844 364
 Statistics.LOCAL_JID = require('../../service/statistics/constants').LOCAL_JID;
845 365
 
846 366
 /**
847
- * Reports global error to CallStats.
848
- *
849
- * @param {Error} error
850
- */
851
-Statistics.reportGlobalError = function(error) {
852
-    if (error instanceof JitsiTrackError && error.gum) {
853
-        Statistics.sendGetUserMediaFailed(error);
854
-    } else {
855
-        Statistics.sendLog(error);
856
-    }
857
-};
858
-
859
-/**
860
- * Sends event to analytics and logs a message to the logger/console. Console
861
- * messages might also be logged to callstats automatically.
367
+ * Sends event to analytics and logs a message to the logger/console.
862 368
  *
863 369
  * @param {string | Object} event the event name, or an object which
864 370
  * represents the entire event.

+ 0
- 15
modules/version/ComponentsVersions.js ファイルの表示

@@ -1,5 +1,3 @@
1
-import Statistics from '../statistics/statistics';
2
-
3 1
 const logger = require('@jitsi/logger').getLogger(__filename);
4 2
 
5 3
 /**
@@ -29,8 +27,6 @@ ComponentsVersions.prototype.processVersions
29 27
             return;
30 28
         }
31 29
 
32
-        const log = [];
33
-
34 30
         versions.children.forEach(component => {
35 31
 
36 32
             const name = component.attributes.name;
@@ -39,19 +35,8 @@ ComponentsVersions.prototype.processVersions
39 35
             if (this.versions[name] !== version) {
40 36
                 this.versions[name] = version;
41 37
                 logger.info(`Got ${name} version: ${version}`);
42
-
43
-                log.push({
44
-                    id: 'component_version',
45
-                    component: name,
46
-                    version
47
-                });
48 38
             }
49 39
         });
50
-
51
-        // logs versions to stats
52
-        if (log.length > 0) {
53
-            Statistics.sendLog(JSON.stringify(log));
54
-        }
55 40
     };
56 41
 
57 42
 /**

+ 0
- 1
modules/xmpp/xmpp.js ファイルの表示

@@ -1125,7 +1125,6 @@ export default class XMPP extends Listenable {
1125 1125
             logObject.id = 'deployment_info';
1126 1126
             const entry = JSON.stringify(logObject);
1127 1127
 
1128
-            Statistics.sendLog(entry);
1129 1128
             logger.info(entry);
1130 1129
         }
1131 1130
 

+ 1
- 2
service/statistics/Events.ts ファイルの表示

@@ -13,8 +13,7 @@ export enum Events {
13 13
 
14 14
     /**
15 15
      * An event fired just before the statistics module gets disposes and it's
16
-     * the last chance to submit some logs that will end up in stats services like
17
-     * CallStats (if enabled).
16
+     * the last chance to submit logs.
18 17
      */
19 18
     BEFORE_DISPOSED = 'statistics.before_disposed',
20 19
 

読み込み中…
キャンセル
保存