|
|
@@ -182,56 +182,12 @@ JingleSessionPC.prototype.doInitialize = function () {
|
|
182
|
182
|
self.room.eventEmitter.emit(XMPPEvents.CONFERENCE_SETUP_FAILED);
|
|
183
|
183
|
break;
|
|
184
|
184
|
}
|
|
185
|
|
- onIceConnectionStateChange(self.sid, self);
|
|
186
|
185
|
};
|
|
187
|
186
|
this.peerconnection.onnegotiationneeded = function (event) {
|
|
188
|
187
|
self.room.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
|
|
189
|
188
|
};
|
|
190
|
189
|
};
|
|
191
|
190
|
|
|
192
|
|
-function onIceConnectionStateChange(sid, session) {
|
|
193
|
|
- switch (session.peerconnection.iceConnectionState) {
|
|
194
|
|
- case 'checking':
|
|
195
|
|
- session.timeChecking = (new Date()).getTime();
|
|
196
|
|
- session.firstconnect = true;
|
|
197
|
|
- break;
|
|
198
|
|
- case 'completed': // on caller side
|
|
199
|
|
- case 'connected':
|
|
200
|
|
- if (session.firstconnect) {
|
|
201
|
|
- session.firstconnect = false;
|
|
202
|
|
- var metadata = {};
|
|
203
|
|
- metadata.setupTime
|
|
204
|
|
- = (new Date()).getTime() - session.timeChecking;
|
|
205
|
|
- session.peerconnection.getStats(function (res) {
|
|
206
|
|
- if(res && res.result) {
|
|
207
|
|
- res.result().forEach(function (report) {
|
|
208
|
|
- if (report.type == 'googCandidatePair' &&
|
|
209
|
|
- report.stat('googActiveConnection') == 'true') {
|
|
210
|
|
- metadata.localCandidateType
|
|
211
|
|
- = report.stat('googLocalCandidateType');
|
|
212
|
|
- metadata.remoteCandidateType
|
|
213
|
|
- = report.stat('googRemoteCandidateType');
|
|
214
|
|
-
|
|
215
|
|
- // log pair as well so we can get nice pie
|
|
216
|
|
- // charts
|
|
217
|
|
- metadata.candidatePair
|
|
218
|
|
- = report.stat('googLocalCandidateType') +
|
|
219
|
|
- ';' +
|
|
220
|
|
- report.stat('googRemoteCandidateType');
|
|
221
|
|
-
|
|
222
|
|
- if (report.stat('googRemoteAddress').indexOf('[') === 0)
|
|
223
|
|
- {
|
|
224
|
|
- metadata.ipv6 = true;
|
|
225
|
|
- }
|
|
226
|
|
- }
|
|
227
|
|
- });
|
|
228
|
|
- }
|
|
229
|
|
- });
|
|
230
|
|
- }
|
|
231
|
|
- break;
|
|
232
|
|
- }
|
|
233
|
|
-}
|
|
234
|
|
-
|
|
235
|
191
|
JingleSessionPC.prototype.accept = function () {
|
|
236
|
192
|
this.state = 'active';
|
|
237
|
193
|
|