浏览代码

Partially reverts 24bda8e and uses domain/roomname to report to cs.

To be sure we always report room name in small case and as mobile and jigasi report this way it will take time for them to adopt which leads to wrong stats.
master
damencho 6 年前
父节点
当前提交
ad8cc5a694
共有 3 个文件被更改,包括 25 次插入2 次删除
  1. 2
    0
      JitsiConference.js
  2. 1
    0
      doc/API.md
  3. 22
    2
      modules/statistics/statistics.js

+ 2
- 0
JitsiConference.js 查看文件

@@ -352,10 +352,12 @@ JitsiConference.prototype._init = function(options = {}) {
352 352
 
353 353
         this.statistics = new Statistics(this.xmpp, {
354 354
             callStatsAliasName,
355
+            callStatsConfIDNamespace: this.connection.options.hosts.domain,
355 356
             confID: config.confID || `${this.connection.options.hosts.domain}/${this.options.name}`,
356 357
             customScriptUrl: config.callStatsCustomScriptUrl,
357 358
             callStatsID: config.callStatsID,
358 359
             callStatsSecret: config.callStatsSecret,
360
+            roomName: this.options.name,
359 361
             swapUserNameAndAlias: config.enableStatsID,
360 362
             applicationName: config.applicationName,
361 363
             getWiFiStatsMethod: config.getWiFiStatsMethod

+ 1
- 0
doc/API.md 查看文件

@@ -50,6 +50,7 @@ The ```options``` parameter is JS object with the following properties:
50 50
     - `disableThirdPartyRequests` - if true - callstats will be disabled and the callstats API won't be included.
51 51
     - `enableAnalyticsLogging` - boolean property (default false). Enables/disables analytics logging.
52 52
     - `callStatsCustomScriptUrl` - (optional) custom url to access callstats client script
53
+    - `callStatsConfIDNamespace` - (optional) a namespace to prepend the callstats conference ID with. Defaults to the window.location.hostname
53 54
     - `disableRtx` - (optional) boolean property (default to false).  Enables/disable the use of RTX.
54 55
     - `disableH264` - (optional) boolean property (default to false).  If enabled, strips the H.264 codec from the local SDP.
55 56
     - `preferH264` - (optional) boolean property (default to false).  Enables/disable preferring the first instance of an h264 codec in an offer by moving it to the front of the codec list.

+ 22
- 2
modules/statistics/statistics.js 查看文件

@@ -130,11 +130,14 @@ Statistics.init = function(options) {
130 130
  * callstats.
131 131
  * @property {string} callStatsAliasName - The alias name to use when
132 132
  * initializing callstats.
133
+ * @property {string} callStatsConfIDNamespace - A namespace to prepend the
134
+ * callstats conference ID with.
133 135
  * @property {string} confID - The callstats conference ID to use.
134 136
  * @property {string} callStatsID - Callstats credentials - the id.
135 137
  * @property {string} callStatsSecret - Callstats credentials - the secret.
136 138
  * @property {string} customScriptUrl - A custom lib url to use when downloading
137 139
  * callstats library.
140
+ * @property {string} roomName - The room name we are currently in.
138 141
  * @property {boolean} swapUserNameAndAlias - Whether to swap the places of
139 142
  * username and alias when initiating callstats.
140 143
  */
@@ -172,6 +175,10 @@ export default function Statistics(xmpp, options) {
172 175
         if (!this.options.confID) {
173 176
             logger.warn('"confID" is not defined');
174 177
         }
178
+
179
+        if (!this.options.callStatsConfIDNamespace) {
180
+            logger.warn('"callStatsConfIDNamespace" is not defined');
181
+        }
175 182
     }
176 183
 
177 184
     /**
@@ -367,7 +374,7 @@ Statistics.prototype.startCallStats = function(tpc, remoteUserID) {
367 374
         = new CallStats(
368 375
             tpc,
369 376
             {
370
-                confID: this.options.confID,
377
+                confID: this._getCallStatsConfID(),
371 378
                 remoteUserID
372 379
             });
373 380
 
@@ -392,6 +399,19 @@ Statistics._getAllCallStatsInstances = function() {
392 399
     return csInstances;
393 400
 };
394 401
 
402
+/**
403
+ * Constructs the CallStats conference ID based on the options currently
404
+ * configured in this instance.
405
+ * @return {string}
406
+ * @private
407
+ */
408
+Statistics.prototype._getCallStatsConfID = function() {
409
+    // The conference ID is case sensitive!!!
410
+    return this.options.callStatsConfIDNamespace
411
+        ? `${this.options.callStatsConfIDNamespace}/${this.options.roomName}`
412
+        : this.options.roomName;
413
+};
414
+
395 415
 /**
396 416
  * Removes the callstats.io instances.
397 417
  */
@@ -683,7 +703,7 @@ Statistics.prototype.sendFeedback = function(overall, comment) {
683 703
             comment
684 704
         });
685 705
 
686
-    return CallStats.sendFeedback(this.options.confID, overall, comment);
706
+    return CallStats.sendFeedback(this._getCallStatsConfID(), overall, comment);
687 707
 };
688 708
 
689 709
 Statistics.LOCAL_JID = require('../../service/statistics/constants').LOCAL_JID;

正在加载...
取消
保存