Browse Source

Merge branch 'cs-and-updates'

dev1
Lyubomir Marinov 9 years ago
parent
commit
55582a24b0
3 changed files with 36 additions and 44 deletions
  1. 29
    37
      modules/statistics/CallStats.js
  2. 6
    6
      modules/xmpp/strophe.jingle.js
  3. 1
    1
      package.json

+ 29
- 37
modules/statistics/CallStats.js View File

68
 
68
 
69
     if(!fabricInitialized) {
69
     if(!fabricInitialized) {
70
         CallStats.initializeFailed = true;
70
         CallStats.initializeFailed = true;
71
-        console.log("callstats fabric not initilized", ret.message);
71
+        logger.log("callstats fabric not initilized", ret.message);
72
         return;
72
         return;
73
     }
73
     }
74
 
74
 
144
         this.session = jingleSession;
144
         this.session = jingleSession;
145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
146
 
146
 
147
-        this.userID = Settings.getCallStatsUserName();
147
+        this.userID = {
148
+            aliasName: Strophe.getResourceFromJid(jingleSession.room.myroomjid),
149
+            userName: Settings.getCallStatsUserName()
150
+        };
148
 
151
 
149
-        var location = window.location;
152
+        const location = window.location;
150
         // The confID is case sensitive!!!
153
         // The confID is case sensitive!!!
151
         this.confID = location.hostname + "/" + options.roomName;
154
         this.confID = location.hostname + "/" + options.roomName;
152
 
155
 
161
             initCallback.bind(this));
164
             initCallback.bind(this));
162
 
165
 
163
     } catch (e) {
166
     } catch (e) {
164
-        // The callstats.io API failed to initialize (e.g. because its
165
-        // download failed to succeed in general or on time). Further
166
-        // attempts to utilize it cannot possibly succeed.
167
+        // The callstats.io API failed to initialize (e.g. because its download
168
+        // did not succeed in general or on time). Further attempts to utilize
169
+        // it cannot possibly succeed.
167
         GlobalOnErrorHandler.callErrorHandler(e);
170
         GlobalOnErrorHandler.callErrorHandler(e);
168
         callStats = null;
171
         callStats = null;
169
         logger.error(e);
172
         logger.error(e);
230
 };
233
 };
231
 
234
 
232
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
235
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
233
-    if (!callStats) {
234
-        return;
235
-    }
236
-    logger.log("Monitoring status: "+ err + " msg: " + msg);
236
+    if (callStats && err !== 'success')
237
+        logger.error("Monitoring status: "+ err + " msg: " + msg);
237
 });
238
 });
238
 
239
 
239
 /**
240
 /**
253
     if(!callStats) {
254
     if(!callStats) {
254
         return;
255
         return;
255
     }
256
     }
257
+
256
     // 'focus' is default remote user ID for now
258
     // 'focus' is default remote user ID for now
257
-    var callStatsId = 'focus';
258
-    if (isLocal) {
259
-        callStatsId = this.userID;
260
-    }
259
+    const callStatsId = isLocal ? this.userID : 'focus';
261
 
260
 
262
     _try_catch(function() {
261
     _try_catch(function() {
263
         logger.debug(
262
         logger.debug(
267
             this.confID,
266
             this.confID,
268
             ssrc,
267
             ssrc,
269
             usageLabel,
268
             usageLabel,
270
-            containerId
271
-        );
269
+            containerId);
272
         if(CallStats.initialized) {
270
         if(CallStats.initialized) {
273
             callStats.associateMstWithUserID(
271
             callStats.associateMstWithUserID(
274
                 this.peerconnection,
272
                 this.peerconnection,
276
                 this.confID,
274
                 this.confID,
277
                 ssrc,
275
                 ssrc,
278
                 usageLabel,
276
                 usageLabel,
279
-                containerId
280
-            );
277
+                containerId);
281
         }
278
         }
282
         else {
279
         else {
283
             CallStats.reportsQueue.push({
280
             CallStats.reportsQueue.push({
284
                 type: reportType.MST_WITH_USERID,
281
                 type: reportType.MST_WITH_USERID,
285
                 data: {
282
                 data: {
286
-                    callStatsId: callStatsId,
287
-                    ssrc: ssrc,
288
-                    usageLabel: usageLabel,
289
-                    containerId: containerId
283
+                    callStatsId,
284
+                    containerId,
285
+                    ssrc,
286
+                    usageLabel
290
                 }
287
                 }
291
             });
288
             });
292
             CallStats._checkInitialize();
289
             CallStats._checkInitialize();
301
  * @param {CallStats} cs callstats instance related to the event
298
  * @param {CallStats} cs callstats instance related to the event
302
  */
299
  */
303
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
300
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
301
+    let event;
304
 
302
 
305
-    var event = null;
306
     if (type === "video") {
303
     if (type === "video") {
307
-        event = (mute? fabricEvent.videoPause : fabricEvent.videoResume);
308
-    }
309
-    else {
310
-        event = (mute? fabricEvent.audioMute : fabricEvent.audioUnmute);
304
+        event = mute ? fabricEvent.videoPause : fabricEvent.videoResume;
305
+    } else {
306
+        event = mute ? fabricEvent.audioMute : fabricEvent.audioUnmute;
311
     }
307
     }
312
 
308
 
313
     CallStats._reportEvent.call(cs, event);
309
     CallStats._reportEvent.call(cs, event);
320
  * @param {CallStats} cs callstats instance related to the event
316
  * @param {CallStats} cs callstats instance related to the event
321
  */
317
  */
322
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
318
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
323
-
324
-    CallStats._reportEvent.call(cs,
325
-        start? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
319
+    CallStats._reportEvent.call(
320
+        cs,
321
+        start ? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
326
 });
322
 });
327
 
323
 
328
 /**
324
 /**
330
  * @param {CallStats} cs callstats instance related to the event
326
  * @param {CallStats} cs callstats instance related to the event
331
  */
327
  */
332
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
328
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
333
-
334
-    CallStats._reportEvent.call(cs,
335
-        fabricEvent.dominantSpeaker);
329
+    CallStats._reportEvent.call(cs, fabricEvent.dominantSpeaker);
336
 });
330
 });
337
 
331
 
338
 /**
332
 /**
341
  * @param {CallStats} cs callstats instance related to the event
335
  * @param {CallStats} cs callstats instance related to the event
342
  */
336
  */
343
 CallStats.sendActiveDeviceListEvent = _try_catch(function (devicesData, cs) {
337
 CallStats.sendActiveDeviceListEvent = _try_catch(function (devicesData, cs) {
344
-
345
     CallStats._reportEvent.call(cs, fabricEvent.activeDeviceList, devicesData);
338
     CallStats._reportEvent.call(cs, fabricEvent.activeDeviceList, devicesData);
346
 });
339
 });
347
 
340
 
412
     if(!CallStats.feedbackEnabled) {
405
     if(!CallStats.feedbackEnabled) {
413
         return;
406
         return;
414
     }
407
     }
408
+
415
     var feedbackString =    '{"userID":"' + this.userID + '"' +
409
     var feedbackString =    '{"userID":"' + this.userID + '"' +
416
                             ', "overall":' + overallFeedback +
410
                             ', "overall":' + overallFeedback +
417
                             ', "comment": "' + detailedFeedback + '"}';
411
                             ', "comment": "' + detailedFeedback + '"}';
418
-
419
     var feedbackJSON = JSON.parse(feedbackString);
412
     var feedbackJSON = JSON.parse(feedbackString);
420
 
413
 
421
     callStats.sendUserFeedback(this.confID, feedbackJSON);
414
     callStats.sendUserFeedback(this.confID, feedbackJSON);
518
  * @param {CallStats} cs callstats instance related to the error (optional)
511
  * @param {CallStats} cs callstats instance related to the error (optional)
519
  */
512
  */
520
 CallStats.sendApplicationLog = _try_catch(function (e, cs) {
513
 CallStats.sendApplicationLog = _try_catch(function (e, cs) {
521
-    CallStats._reportError
522
-        .call(cs, wrtcFuncNames.applicationLog, e, null);
514
+    CallStats._reportError.call(cs, wrtcFuncNames.applicationLog, e, null);
523
 });
515
 });
524
 
516
 
525
 /**
517
 /**

+ 6
- 6
modules/xmpp/strophe.jingle.js View File

139
                     Statistics.analytics.sendEvent(
139
                     Statistics.analytics.sendEvent(
140
                         'xmpp.transport-replace.success',
140
                         'xmpp.transport-replace.success',
141
                         {value: successTime});
141
                         {value: successTime});
142
-                }, (error) => {
142
+                }, error => {
143
                     GlobalOnErrorHandler.callErrorHandler(error);
143
                     GlobalOnErrorHandler.callErrorHandler(error);
144
                     logger.error('Transport replace failed', error);
144
                     logger.error('Transport replace failed', error);
145
                     sess.sendTransportReject();
145
                     sess.sendTransportReject();
191
             $iq({type: 'get', to: this.connection.domain})
191
             $iq({type: 'get', to: this.connection.domain})
192
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'})
192
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'})
193
                 .c('service', {host: 'turn.' + this.connection.domain}),
193
                 .c('service', {host: 'turn.' + this.connection.domain}),
194
-            (res) => {
194
+            res => {
195
                 let iceservers = [];
195
                 let iceservers = [];
196
                 $(res).find('>services>service').each((idx, el) => {
196
                 $(res).find('>services>service').each((idx, el) => {
197
                     el = $(el);
197
                     el = $(el);
240
                         }
240
                         }
241
                     }
241
                     }
242
                 });
242
                 });
243
-                self.ice_config.iceServers = iceservers;
244
-            }, (err) => {
243
+                this.ice_config.iceServers = iceservers;
244
+            }, err => {
245
                 logger.warn('getting turn credentials failed', err);
245
                 logger.warn('getting turn credentials failed', err);
246
                 logger.warn('is mod_turncredentials or similar installed?');
246
                 logger.warn('is mod_turncredentials or similar installed?');
247
             });
247
             });
253
      */
253
      */
254
     getLog () {
254
     getLog () {
255
         const data = {};
255
         const data = {};
256
-        Object.keys(this.sessions).forEach((sid) => {
257
-            const session = self.sessions[sid];
256
+        Object.keys(this.sessions).forEach(sid => {
257
+            const session = this.sessions[sid];
258
             const pc = session.peerconnection;
258
             const pc = session.peerconnection;
259
             if (pc && pc.updateLog) {
259
             if (pc && pc.updateLog) {
260
                 // FIXME: should probably be a .dump call
260
                 // FIXME: should probably be a .dump call

+ 1
- 1
package.json View File

25
     "sdp-interop": "0.1.11",
25
     "sdp-interop": "0.1.11",
26
     "sdp-simulcast": "0.1.7",
26
     "sdp-simulcast": "0.1.7",
27
     "sdp-transform": "1.5.*",
27
     "sdp-transform": "1.5.*",
28
-    "socket.io-client": "1.3.6",
28
+    "socket.io-client": "1.4.5",
29
     "strophe": "^1.2.2",
29
     "strophe": "^1.2.2",
30
     "strophejs-plugins": "^0.0.6"
30
     "strophejs-plugins": "^0.0.6"
31
   },
31
   },

Loading…
Cancel
Save