|
|
@@ -575,6 +575,39 @@ $(document).bind('setLocalDescription.jingle', function (event, sid) {
|
|
575
|
575
|
}
|
|
576
|
576
|
});
|
|
577
|
577
|
|
|
|
578
|
+$(document).bind('iceconnectionstatechange.jingle', function (event, sid, session) {
|
|
|
579
|
+ switch (session.peerconnection.iceConnectionState) {
|
|
|
580
|
+ case 'checking':
|
|
|
581
|
+ session.timeChecking = (new Date()).getTime();
|
|
|
582
|
+ session.firstconnect = true;
|
|
|
583
|
+ break;
|
|
|
584
|
+ case 'completed': // on caller side
|
|
|
585
|
+ case 'connected':
|
|
|
586
|
+ if (session.firstconnect) {
|
|
|
587
|
+ session.firstconnect = false;
|
|
|
588
|
+ var metadata = {};
|
|
|
589
|
+ metadata.setupTime = (new Date()).getTime() - session.timeChecking;
|
|
|
590
|
+ session.peerconnection.getStats(function (res) {
|
|
|
591
|
+ res.result().forEach(function (report) {
|
|
|
592
|
+ if (report.type == 'googCandidatePair' && report.stat('googActiveConnection') == 'true') {
|
|
|
593
|
+ metadata.localCandidateType = report.stat('googLocalCandidateType');
|
|
|
594
|
+ metadata.remoteCandidateType = report.stat('googRemoteCandidateType');
|
|
|
595
|
+
|
|
|
596
|
+ // log pair as well so we can get nice pie charts
|
|
|
597
|
+ metadata.candidatePair = report.stat('googLocalCandidateType') + ';' + report.stat('googRemoteCandidateType');
|
|
|
598
|
+
|
|
|
599
|
+ if (report.stat('googRemoteAddress').indexOf('[') === 0) {
|
|
|
600
|
+ metadata.ipv6 = true;
|
|
|
601
|
+ }
|
|
|
602
|
+ }
|
|
|
603
|
+ });
|
|
|
604
|
+ trackUsage('iceConnected', metadata);
|
|
|
605
|
+ });
|
|
|
606
|
+ }
|
|
|
607
|
+ break;
|
|
|
608
|
+ }
|
|
|
609
|
+});
|
|
|
610
|
+
|
|
578
|
611
|
$(document).bind('joined.muc', function (event, jid, info) {
|
|
579
|
612
|
updateRoomUrl(window.location.href);
|
|
580
|
613
|
document.getElementById('localNick').appendChild(
|