Comparing version 0.8.3 to 0.8.4
@@ -6,3 +6,9 @@ # AUTHORS | ||
* <james@onsip.com> | ||
* GitHub [@james-criscuolo](https://github.com/james-criscuolo) | ||
## Eric Green | ||
* <eric.green@onsip.com> | ||
* GitHub [@egreenmachine](https://github.com/egreenmachine) | ||
## Joseph Frazier | ||
@@ -14,6 +20,2 @@ | ||
## Eric Green | ||
* <eric.green@onsip.com> | ||
## Will Mitchell | ||
@@ -32,2 +34,1 @@ | ||
* Saúl Ibarra Corretgé (Github [@saghul](https://github.com/saghul)) | ||
{ | ||
"name": "sip.js", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"authors": [ | ||
"James Criscuolo <james@onsip.com>", | ||
"Eric Green <eric.green@onsip.com>", | ||
"Joseph Frazier <1212jtraceur@gmail.com>", | ||
"Eric Green <eric.green@onsip.com>", | ||
"Will Mitchell <wakamoleguy@gmail.com>" | ||
@@ -18,3 +18,3 @@ ], | ||
"license": "MIT", | ||
"homepage": "http://sipjs.com", | ||
"homepage": "https://sipjs.com", | ||
"ignore": [ | ||
@@ -21,0 +21,0 @@ "**/.*", |
@@ -16,3 +16,3 @@ module.exports = function(config) { | ||
'dist/sip.js', | ||
'test/spec/*.js' | ||
'test/spec/**/*.js' | ||
], | ||
@@ -25,3 +25,5 @@ | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: {}, | ||
preprocessors: { | ||
'test/spec/WebRTC/SessionDescriptionHandler.spec.js': 'webpack' | ||
}, | ||
@@ -67,8 +69,9 @@ // test results reporter to use | ||
plugins : [ | ||
'karma-jasmine', | ||
'karma-jasmine', | ||
'karma-jasmine-html-reporter', | ||
'karma-mocha-reporter', | ||
'karma-phantomjs-launcher' | ||
] | ||
'karma-phantomjs-launcher', | ||
'karma-webpack' | ||
] | ||
}) | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple, intuitive, and powerful JavaScript signaling library", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"main": "dist/sip.min.js", | ||
@@ -11,4 +11,4 @@ "browser": { | ||
}, | ||
"homepage": "http://sipjs.com", | ||
"author": "OnSIP <developer@onsip.com> (http://sipjs.com/aboutus/)", | ||
"homepage": "https://sipjs.com", | ||
"author": "OnSIP <developer@onsip.com> (https://sipjs.com/aboutus/)", | ||
"contributors": [ | ||
@@ -40,2 +40,3 @@ { | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-webpack": "^2.0.6", | ||
"pegjs": "^0.10.0", | ||
@@ -42,0 +43,0 @@ "pegjs-loader": "^0.5.4", |
@@ -10,3 +10,3 @@ # SIP.js | ||
* [SIPjs.com](http://sipjs.com) | ||
* [SIPjs.com](https://sipjs.com) | ||
* [Mailing List](https://groups.google.com/forum/#!forum/sip_js) | ||
@@ -18,3 +18,3 @@ * [Issue Tracking](https://github.com/onsip/sip.js/issues) | ||
* [sipjs.com/download](http://sipjs.com/download/) | ||
* [sipjs.com/download](https://sipjs.com/download/) | ||
* Bower: `bower install sip.js` | ||
@@ -28,3 +28,9 @@ * npm: `npm install sip.js` | ||
* <james@onsip.com> | ||
* GitHub [@james-criscuolo](https://github.com/james-criscuolo) | ||
### Eric Green | ||
* <eric.green@onsip.com> | ||
* GitHub [@egreenmachine](https://github.com/egreenmachine) | ||
### Joseph Frazier | ||
@@ -36,6 +42,2 @@ | ||
### Eric Green | ||
* <eric.green@onsip.com> | ||
### Will Mitchell | ||
@@ -57,3 +59,3 @@ | ||
SIP.js is released under the [MIT license](http://sipjs.com/license). | ||
SIP.js is released under the [MIT license](https://sipjs.com/license). | ||
@@ -60,0 +62,0 @@ SIP.js contains substantial portions of the JsSIP software, under the following license: |
@@ -1146,2 +1146,4 @@ "use strict"; | ||
descriptionCreationFailed = function() { | ||
// TODO: This should check the actual error and make sure it is an | ||
// "expected" error. Otherwise it should throw. | ||
if (self.status === C.STATUS_TERMINATED) { | ||
@@ -1179,4 +1181,4 @@ return; | ||
this.sessionDescriptionHandler.getDescription(options.sessionDescriptionHandlerOptions, options.modifiers) | ||
.then(descriptionCreationSucceeded) | ||
.catch(descriptionCreationFailed); | ||
.catch(descriptionCreationFailed) | ||
.then(descriptionCreationSucceeded); | ||
} else if (this.sessionDescriptionHandler.hasDescription(this.request.getHeader('Content-Type'))) { | ||
@@ -1188,4 +1190,4 @@ this.hasOffer = true; | ||
}.bind(this)) | ||
.then(descriptionCreationSucceeded) | ||
.catch(descriptionCreationFailed); | ||
.catch(descriptionCreationFailed) | ||
.then(descriptionCreationSucceeded); | ||
} else { | ||
@@ -1192,0 +1194,0 @@ this.request.reply(415); |
@@ -90,3 +90,3 @@ "use strict"; | ||
NonInviteClientTransaction.prototype.timer_F = function() { | ||
this.logger.log('Timer F expired for non-INVITE client transaction ' + this.id); | ||
this.logger.debug('Timer F expired for non-INVITE client transaction ' + this.id); | ||
this.stateChanged(C.STATUS_TERMINATED); | ||
@@ -207,3 +207,3 @@ this.request_sender.ua.destroyTransaction(this); | ||
InviteClientTransaction.prototype.timer_M = function() { | ||
this.logger.log('Timer M expired for INVITE client transaction ' + this.id); | ||
this.logger.debug('Timer M expired for INVITE client transaction ' + this.id); | ||
@@ -219,3 +219,3 @@ if(this.state === C.STATUS_ACCEPTED) { | ||
InviteClientTransaction.prototype.timer_B = function() { | ||
this.logger.log('Timer B expired for INVITE client transaction ' + this.id); | ||
this.logger.debug('Timer B expired for INVITE client transaction ' + this.id); | ||
if(this.state === C.STATUS_CALLING) { | ||
@@ -229,3 +229,3 @@ this.stateChanged(C.STATUS_TERMINATED); | ||
InviteClientTransaction.prototype.timer_D = function() { | ||
this.logger.log('Timer D expired for INVITE client transaction ' + this.id); | ||
this.logger.debug('Timer D expired for INVITE client transaction ' + this.id); | ||
SIP.Timers.clearTimeout(this.B); | ||
@@ -436,3 +436,3 @@ this.stateChanged(C.STATUS_TERMINATED); | ||
NonInviteServerTransaction.prototype.timer_J = function() { | ||
this.logger.log('Timer J expired for non-INVITE server transaction ' + this.id); | ||
this.logger.debug('Timer J expired for non-INVITE server transaction ' + this.id); | ||
this.stateChanged(C.STATUS_TERMINATED); | ||
@@ -536,3 +536,3 @@ this.ua.destroyTransaction(this); | ||
InviteServerTransaction.prototype.timer_H = function() { | ||
this.logger.log('Timer H expired for INVITE server transaction ' + this.id); | ||
this.logger.debug('Timer H expired for INVITE server transaction ' + this.id); | ||
@@ -554,3 +554,3 @@ if(this.state === C.STATUS_COMPLETED) { | ||
InviteServerTransaction.prototype.timer_L = function() { | ||
this.logger.log('Timer L expired for INVITE server transaction ' + this.id); | ||
this.logger.debug('Timer L expired for INVITE server transaction ' + this.id); | ||
@@ -557,0 +557,0 @@ if(this.state === C.STATUS_ACCEPTED) { |
@@ -935,6 +935,3 @@ "use strict"; | ||
constraints: {}, | ||
peerConnectionOptions: { | ||
iceCheckingTimeout: 5000, | ||
rtcConfiguration: {} | ||
} | ||
peerConnectionOptions: {} | ||
}, | ||
@@ -1427,8 +1424,2 @@ | ||
rtcpMuxPolicy: function(rtcpMuxPolicy) { | ||
if (typeof rtcpMuxPolicy === 'string') { | ||
return rtcpMuxPolicy; | ||
} | ||
}, | ||
userAgentString: function(userAgentString) { | ||
@@ -1435,0 +1426,0 @@ if (typeof userAgentString === 'string') { |
@@ -27,16 +27,19 @@ /** | ||
stripG722: function(description) { | ||
var mline = description.sdp.match(/^m=audio.*$/gm)[0]; | ||
mline = mline.split(" "); | ||
// Ignore the first 3 parameters of the mline. The codec information is after that | ||
for (var i = 3; i < mline.length; i=i+1) { | ||
if (mline[i] === "9") { | ||
mline.splice(i, 1); | ||
var numberOfCodecs = parseInt(mline[1], 10); | ||
numberOfCodecs = numberOfCodecs - 1; | ||
mline[1] = numberOfCodecs.toString(); | ||
var parts = description.sdp.match(/^m=audio.*$/gm); | ||
if (parts) { | ||
var mline = parts[0]; | ||
mline = mline.split(" "); | ||
// Ignore the first 3 parameters of the mline. The codec information is after that | ||
for (var i = 3; i < mline.length; i=i+1) { | ||
if (mline[i] === "9") { | ||
mline.splice(i, 1); | ||
var numberOfCodecs = parseInt(mline[1], 10); | ||
numberOfCodecs = numberOfCodecs - 1; | ||
mline[1] = numberOfCodecs.toString(); | ||
} | ||
} | ||
mline = mline.join(" "); | ||
description.sdp = description.sdp.replace(/^m=audio.*$/gm, mline); | ||
description.sdp = description.sdp.replace(/^a=rtpmap:.*G722\/8000\r\n?/gm, "").replace(); | ||
} | ||
mline = mline.join(" "); | ||
description.sdp = description.sdp.replace(/^m=audio.*$/gm, mline); | ||
description.sdp = description.sdp.replace(/^a=rtpmap:.*G722\/8000\r\n?/gm, "").replace(); | ||
return SIP.Utils.Promise.resolve(description); | ||
@@ -43,0 +46,0 @@ } |
@@ -36,2 +36,6 @@ "use strict"; | ||
this.iceGatheringDeferred = null; | ||
this.iceGatheringTimeout = false; | ||
this.iceGatheringTimer = null; | ||
this.initPeerConnection(this.options.peerConnectionOptions); | ||
@@ -91,2 +95,3 @@ | ||
} | ||
this.resetIceGatheringComplete(); | ||
this.peerConnection.close(); | ||
@@ -118,10 +123,11 @@ } | ||
if (this.constraints && options.constraints && this.constraints === options.constraints) { | ||
shouldAcquireMedia = false; | ||
// Merge passed constraints with saved constraints and save | ||
var newConstraints = Object.assign({}, this.constraints, options.constraints); | ||
newConstraints = this.checkAndDefaultConstraints(newConstraints); | ||
if (JSON.stringify(newConstraints) !== JSON.stringify(this.constraints)) { | ||
this.constraints = newConstraints; | ||
} else { | ||
shouldAcquireMedia = false; | ||
} | ||
// Merge passed constraints with saved constraints and save | ||
this.constraints = Object.assign(this.constraints, options.constraints); | ||
this.constraints = this.checkAndDefaultConstraints(this.constraints); | ||
modifiers = modifiers || []; | ||
@@ -135,3 +141,3 @@ if (!Array.isArray(modifiers)) { | ||
if (!shouldAcquireMedia && this.peerConnection.localDescription && this.peerConnection.localDescription.sdp && this.peerConnection.localDescription.sdp !== '') { | ||
return this.createOfferOrAnswer({}, modifiers).then(function(sdp) { | ||
return this.createOfferOrAnswer(options.RTCOfferOptions, modifiers).then(function(sdp) { | ||
return { | ||
@@ -274,7 +280,6 @@ body: sdp, | ||
.then(function setRemoteDescriptionSuccess() { | ||
if (self.peerConnection.getRemoteStreams) { | ||
if (self.peerConnection.getReceivers) { | ||
self.emit('setRemoteDescription', self.peerConnection.getReceivers()); | ||
} else { | ||
self.emit('setRemoteDescription', self.peerConnection.getRemoteStreams()); | ||
} else { | ||
// This should be the default, and we should fall back to getRemoteStreams if this is not supported | ||
self.emit('setRemoteDescription', self.peerConnection.getReceivers()); | ||
} | ||
@@ -312,9 +317,3 @@ self.emit('confirmed', self); | ||
.then(function onSetLocalDescriptionSuccess() { | ||
return new SIP.Utils.Promise(function(resolve) { | ||
if (pc.iceGatheringState === 'complete' && (pc.iceConnectionState === 'connected' || pc.iceConnectionState === 'completed')) { | ||
resolve(); | ||
} else { | ||
self.onIceCompleted.promise.then(resolve); | ||
} | ||
}); | ||
return self.waitForIceGatheringComplete(); | ||
}) | ||
@@ -333,2 +332,9 @@ .then(function readySuccess() { | ||
addDefaultIceCheckingTimeout: {writable: true, value: function addDefaultIceCheckingTimeout (peerConnectionOptions) { | ||
if (peerConnectionOptions.iceCheckingTimeout === undefined) { | ||
peerConnectionOptions.iceCheckingTimeout = 5000; | ||
} | ||
return peerConnectionOptions; | ||
}}, | ||
addDefaultIceServers: {writable: true, value: function addDefaultIceServers (rtcConfiguration) { | ||
@@ -354,15 +360,8 @@ if (!rtcConfiguration.iceServers) { | ||
options = options || {}; | ||
options = this.addDefaultIceCheckingTimeout(options); | ||
options.rtcConfiguration = options.rtcConfiguration || {}; | ||
options.rtcConfiguration = this.addDefaultIceServers(options.rtcConfiguration); | ||
this.onIceCompleted = SIP.Utils.defer(); | ||
this.onIceCompleted.promise.then(function(pc) { | ||
self.emit('iceGatheringComplete', pc); | ||
if (self.iceCheckingTimer) { | ||
SIP.Timers.clearTimeout(self.iceCheckingTimer); | ||
self.iceCheckingTimer = null; | ||
} | ||
}); | ||
if (this.peerConnection) { | ||
this.resetIceGatheringComplete(); | ||
this.peerConnection.close(); | ||
@@ -391,11 +390,2 @@ } | ||
this.startIceCheckingTimer = function () { | ||
if (!self.iceCheckingTimer && options.iceCheckingTimeout) { | ||
self.iceCheckingTimer = SIP.Timers.setTimeout(function() { | ||
self.logger.log('RTCIceChecking Timeout Triggered after ' + options.iceCheckingTimeout + ' milliseconds'); | ||
self.onIceCompleted.resolve(this); | ||
}.bind(this.peerConnection), options.iceCheckingTimeout); | ||
} | ||
}; | ||
this.peerConnection.onicecandidate = function(e) { | ||
@@ -405,5 +395,2 @@ self.emit('iceCandidate', e); | ||
self.logger.log('ICE candidate received: '+ (e.candidate.candidate === null ? null : e.candidate.candidate.trim())); | ||
self.startIceCheckingTimer(); | ||
} else { | ||
self.onIceCompleted.resolve(this); | ||
} | ||
@@ -414,8 +401,18 @@ }; | ||
self.logger.log('RTCIceGatheringState changed: ' + this.iceGatheringState); | ||
if (this.iceGatheringState === 'gathering') { | ||
switch (this.iceGatheringState) { | ||
case 'gathering': | ||
self.emit('iceGathering', this); | ||
if (!self.iceGatheringTimer && options.iceCheckingTimeout) { | ||
self.iceGatheringTimeout = false; | ||
self.iceGatheringTimer = SIP.Timers.setTimeout(function() { | ||
self.logger.log('RTCIceChecking Timeout Triggered after ' + options.iceCheckingTimeout + ' milliseconds'); | ||
self.iceGatheringTimeout = true; | ||
self.triggerIceGatheringComplete(); | ||
}, options.iceCheckingTimeout); | ||
} | ||
break; | ||
case 'complete': | ||
self.triggerIceGatheringComplete(); | ||
break; | ||
} | ||
if (this.iceGatheringState === 'complete') { | ||
self.onIceCompleted.resolve(this); | ||
} | ||
}; | ||
@@ -426,6 +423,2 @@ | ||
if (this.iceConnectionState === 'checking') { | ||
self.startIceCheckingTimer(); | ||
} | ||
switch (this.iceConnectionState) { | ||
@@ -458,14 +451,2 @@ case 'new': | ||
self.emit(stateEvent, this); | ||
//Bria state changes are always connected -> disconnected -> connected on accept, so session gets terminated | ||
//normal calls switch from failed to connected in some cases, so checking for failed and terminated | ||
/*if (this.iceConnectionState === 'failed') { | ||
self.session.terminate({ | ||
cause: SIP.C.causes.RTP_TIMEOUT, | ||
status_code: 200, | ||
reason_phrase: SIP.C.causes.RTP_TIMEOUT | ||
}); | ||
} else if (e.currentTarget.iceGatheringState === 'complete' && this.iceConnectionState !== 'closed') { | ||
self.onIceCompleted(this); | ||
}*/ | ||
}; | ||
@@ -519,2 +500,47 @@ }}, | ||
return this.peerConnection.signalingState === offerState; | ||
}}, | ||
// ICE gathering state handling | ||
isIceGatheringComplete: {writable: true, value: function isIceGatheringComplete() { | ||
return this.peerConnection.iceGatheringState === 'complete' || this.iceGatheringTimeout; | ||
}}, | ||
resetIceGatheringComplete: {writable: true, value: function rejectIceGatheringComplete() { | ||
this.iceGatheringTimeout = false; | ||
if (this.iceGatheringTimer) { | ||
SIP.Timers.clearTimeout(this.iceGatheringTimer); | ||
this.iceGatheringTimer = null; | ||
} | ||
if (this.iceGatheringDeferred) { | ||
this.iceGatheringDeferred.reject(); | ||
this.iceGatheringDeferred = null; | ||
} | ||
}}, | ||
triggerIceGatheringComplete: {writable: true, value: function triggerIceGatheringComplete() { | ||
if (this.isIceGatheringComplete()) { | ||
this.emit('iceGatheringComplete', this); | ||
if (this.iceGatheringTimer) { | ||
SIP.Timers.clearTimeout(this.iceGatheringTimer); | ||
this.iceGatheringTimer = null; | ||
} | ||
if (this.iceGatheringDeferred) { | ||
this.iceGatheringDeferred.resolve(); | ||
this.iceGatheringDeferred = null; | ||
} | ||
} | ||
}}, | ||
waitForIceGatheringComplete: {writable: true, value: function waitForIceGatheringComplete() { | ||
if (this.isIceGatheringComplete()) { | ||
return SIP.Utils.Promise.resolve(); | ||
} else if (!this.isIceGatheringDeferred) { | ||
this.iceGatheringDeferred = SIP.Utils.defer(); | ||
} | ||
return this.iceGatheringDeferred.promise; | ||
}} | ||
@@ -521,0 +547,0 @@ }); |
@@ -56,4 +56,3 @@ "use strict"; | ||
// Error | ||
this.logger.error('At least one remote audio or video element is required for Simple.'); | ||
return; | ||
throw new Error('At least one remote audio or video element is required for Simple.'); | ||
} | ||
@@ -74,2 +73,6 @@ | ||
if (!this.options.ua.uri) { | ||
this.anonymous = true; | ||
} | ||
this.ua = new SIP.UA({ | ||
@@ -131,3 +134,3 @@ // User Configurable Options | ||
Simple.prototype.call = function(destination) { | ||
if (!this.ua || !this.ua.isRegistered()) { | ||
if (!this.ua || !this.checkRegistration()) { | ||
this.logger.warn('A registered UA is required for calling'); | ||
@@ -208,3 +211,3 @@ return; | ||
Simple.prototype.hold = function() { | ||
if (this.state !== C.STATUS_CONNECTED || this.session.isOnHold().local) { | ||
if (this.state !== C.STATUS_CONNECTED || this.session.local_hold) { | ||
this.logger.warn('Cannot put call on hold'); | ||
@@ -219,3 +222,3 @@ return; | ||
Simple.prototype.unhold = function() { | ||
if (this.state !== C.STATUS_CONNECTED || !this.session.isOnHold().local) { | ||
if (this.state !== C.STATUS_CONNECTED || !this.session.local_hold) { | ||
this.logger.warn('Cannot unhold a call that is not on hold'); | ||
@@ -257,3 +260,3 @@ return; | ||
Simple.prototype.message = function(destination, message) { | ||
if (!this.ua || !this.ua.isRegistered()) { | ||
if (!this.ua || !this.checkRegistration()) { | ||
this.logger.warn('A registered UA is required to send a message'); | ||
@@ -271,2 +274,6 @@ return; | ||
Simple.prototype.checkRegistration = function() { | ||
return (this.anonymous || (this.ua && this.ua.isRegistered())); | ||
}; | ||
Simple.prototype.setupRemoteMedia = function() { | ||
@@ -277,5 +284,3 @@ // If there is a video track, it will attach the video and audio to the same element | ||
if (pc.getRemoteStreams) { | ||
remoteStream = pc.getRemoteStreams()[0]; | ||
} else { | ||
if (pc.getReceivers) { | ||
remoteStream = new global.window.MediaStream(); | ||
@@ -288,2 +293,4 @@ pc.getReceivers().forEach(function(receiver) { | ||
}); | ||
} else { | ||
remoteStream = pc.getRemoteStreams()[0]; | ||
} | ||
@@ -290,0 +297,0 @@ if (this.video) { |
@@ -24,2 +24,6 @@ THANKS | ||
* [The RingCentral Team](https://github.com/ringcentral) | ||
* [Jeremy Lainé](https://github.com/jlaine) | ||
* [Matthieu Sieben](https://github.com/matthieusieben) | ||
* [Dan Jenkins](https://github.com/danjenkins) | ||
* [Vadym Yatsyuk](https://github.com/VadimDez) | ||
@@ -26,0 +30,0 @@ Much credit goes to the original authors of the JsSIP project. Thank you to all. |
@@ -10,4 +10,4 @@ var UglifyJSPlugin = require('uglifyjs-webpack-plugin'); | ||
Copyright (c) 2014-' + year + ' Junction Networks, Inc <http://www.onsip.com>\n\ | ||
Homepage: http://sipjs.com\n\ | ||
License: http://sipjs.com/license/\n\ | ||
Homepage: https://sipjs.com\n\ | ||
License: https://sipjs.com/license/\n\ | ||
\n\ | ||
@@ -14,0 +14,0 @@ \n\ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
82
1454986
14
53
28985