Merge pull request #2882 from capilkey/09-update-sipjs

Updated SIP.js to match master
This commit is contained in:
Fred Dixon 2015-11-06 12:48:05 -05:00
commit 6ac691e76b

View File

@ -1,6 +1,6 @@
/*
* SIP version 0.6.3
* Copyright (c) 2014-2014 Junction Networks, Inc <http://www.onsip.com>
* Copyright (c) 2014-2015 Junction Networks, Inc <http://www.onsip.com>
* Homepage: http://sipjs.com
* License: http://sipjs.com/license/
*
@ -8884,6 +8884,7 @@ UA.prototype.loadConfig = function(configuration) {
userAgentString: SIP.C.USER_AGENT,
// Session parameters
iceCheckingTimeout: 5000,
noAnswerTimeout: 60,
stunServers: ['stun:stun.l.google.com:19302'],
turnServers: [],
@ -9107,6 +9108,7 @@ UA.configuration_skeleton = (function() {
"hackViaTcp", // false.
"hackIpInContact", //false
"hackWssInTransport", //false
"iceCheckingTimeout",
"instanceId",
"noAnswerTimeout", // 30 seconds.
"password",
@ -9282,6 +9284,12 @@ UA.configuration_check = {
}
},
iceCheckingTimeout: function(iceCheckingTimeout) {
if(SIP.Utils.isDecimal(iceCheckingTimeout)) {
return Math.max(500, iceCheckingTimeout);
}
},
hackWssInTransport: function(hackWssInTransport) {
if (typeof hackWssInTransport === 'boolean') {
return hackWssInTransport;
@ -10315,6 +10323,10 @@ var MediaHandler = function(session, options) {
this.onIceCompleted.promise.then(function(pc) {
self.logger.log('ICE Gathering Completed');
self.emit('iceComplete', pc);
if (self.iceCheckingTimer) {
SIP.Timers.clearTimeout(self.iceCheckingTimer);
self.iceCheckingTimer = null;
}
});
this.peerConnection = new SIP.WebRTC.RTCPeerConnection({'iceServers': servers}, this.RTCConstraints);
@ -10329,9 +10341,19 @@ var MediaHandler = function(session, options) {
self.logger.log('stream removed: '+ e.stream.id);
};
this.startIceCheckingTimer = function () {
if (!self.iceCheckingTimer) {
self.iceCheckingTimer = SIP.Timers.setTimeout(function() {
self.logger.log('RTCIceChecking Timeout Triggered after '+config.iceCheckingTimeout+' milliseconds');
self.onIceCompleted.resolve(this);
}.bind(this.peerConnection), config.iceCheckingTimeout);
}
};
this.peerConnection.onicecandidate = function(e) {
if (e.candidate) {
self.logger.log('ICE candidate received: '+ (e.candidate.candidate === null ? null : e.candidate.candidate.trim()));
self.startIceCheckingTimer();
} else {
self.onIceCompleted.resolve(this);
}
@ -10350,6 +10372,10 @@ var MediaHandler = function(session, options) {
this.peerConnection.oniceconnectionstatechange = function() { //need e for commented out case
self.logger.log('ICE connection state changed to "'+ this.iceConnectionState +'"');
if (this.iceConnectionState === 'checking') {
self.startIceCheckingTimer();
}
if (this.iceConnectionState === 'failed') {
self.emit('iceFailed', this);
}
@ -10890,7 +10916,9 @@ MediaStreamManager.prototype = Object.create(SIP.EventEmitter.prototype, {
streams.forEach(function (stream) {
var streamId = MediaStreamManager.streamId(stream);
if (this.acquisitions[streamId] === false) {
stream.stop();
stream.getTracks().forEach(function (track) {
track.stop();
});
}
delete this.acquisitions[streamId];
}, this);