Comparing version 0.6.3 to 0.6.4
{ | ||
"name": "sip.js", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Will Mitchell <will@onsip.com>", |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple, intuitive, and powerful JavaScript signaling library", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"main": "src/SIP.js", | ||
@@ -8,0 +8,0 @@ "homepage": "http://sipjs.com", |
@@ -9,8 +9,4 @@ /** | ||
module.exports = function (window) { | ||
var Hacks; | ||
Hacks = { | ||
module.exports = function (SIP) { | ||
var Hacks = { | ||
AllBrowsers: { | ||
@@ -43,8 +39,2 @@ maskDtls: function (message) { | ||
cannotHandleRelayCandidates: function (message) { | ||
if (this.isFirefox() && message.body) { | ||
message.body = message.body.replace(/relay/g, 'host generation 0'); | ||
} | ||
}, | ||
cannotHandleExtraWhitespace: function (message) { | ||
@@ -82,3 +72,3 @@ if (this.isFirefox() && message.body) { | ||
if (sdp.substr(insertAt,2)!=='c=') { | ||
sdp = sdp.substr(0,insertAt) + '\r\nc=IN IP 4 0.0.0.0' + sdp.substr(insertAt); | ||
sdp = sdp.substr(0,insertAt) + '\r\nc=IN IP4 0.0.0.0' + sdp.substr(insertAt); | ||
} | ||
@@ -94,2 +84,15 @@ | ||
return sdp; | ||
}, | ||
hasIncompatibleCLineWithSomeSIPEndpoints: function(sdp) { | ||
/* | ||
* Firefox appears to be following https://tools.ietf.org/html/rfc5245#section-9.1.1.1 | ||
* and using a c line IP address of 0.0.0.0. This is completely valid, however it is | ||
* causing some endpoints (such as FreeSWITCH) to interpret the SDP as being on hold | ||
* https://freeswitch.org/jira/browse/FS-6955. To get around this issue we pull the | ||
* replace the c line with 1.1.1.1 which SIP clients do not interpret as hold. | ||
* This makes the other endpoint believe that the call is not on hold and audio flows | ||
* because ICE determines the media pathway (not the c line). | ||
*/ | ||
return sdp.replace(/(0\.0\.0\.0)/gmi, SIP.Utils.getRandomTestNetIP()); | ||
} | ||
@@ -122,4 +125,4 @@ }, | ||
return Hacks; | ||
}; | ||
@@ -48,3 +48,3 @@ /** | ||
require('./UA.js')(SIP, window); | ||
SIP.Hacks = require('./Hacks.js')(window); | ||
SIP.Hacks = require('./Hacks.js')(SIP); | ||
require('./SanityCheck.js')(SIP); | ||
@@ -51,0 +51,0 @@ SIP.DigestAuthentication = require('./DigestAuthentication.js')(SIP.Utils); |
@@ -252,2 +252,3 @@ /** | ||
options = options || {}; | ||
options = SIP.Utils.desugarSessionOptions(options); | ||
SIP.Utils.optionsOverride(options, 'media', 'mediaConstraints', true, this.logger); | ||
@@ -899,2 +900,3 @@ | ||
hackIpInContact: false, | ||
hackWssInTransport: false, | ||
@@ -949,2 +951,4 @@ //autostarting | ||
var emptyArraysAllowed = ['stunServers', 'turnServers']; | ||
// Check Optional parameters | ||
@@ -956,4 +960,7 @@ for(parameter in UA.configuration_check.optional) { | ||
// If the parameter value is null, empty string,undefined, or empty array then apply its default value. | ||
if(value === null || value === "" || value === undefined || (value instanceof Array && value.length === 0)) { continue; } | ||
// If the parameter value is an empty array, but shouldn't be, apply its default value. | ||
if (value instanceof Array && value.length === 0 && emptyArraysAllowed.indexOf(parameter) < 0) { continue; } | ||
// If the parameter value is null, empty string, or undefined then apply its default value. | ||
if(value === null || value === "" || value === undefined) { continue; } | ||
// If it's a number with NaN value then also apply its default value. | ||
@@ -1024,3 +1031,3 @@ // NOTE: JS does not allow "value === NaN", the following does the work: | ||
temp_gruu: null, | ||
uri: new SIP.URI('sip', SIP.Utils.createRandomToken(8), settings.viaHost, null, {transport: 'ws'}), | ||
uri: new SIP.URI('sip', SIP.Utils.createRandomToken(8), settings.viaHost, null, {transport: ((settings.hackWssInTransport)?'wss':'ws')}), | ||
toString: function(options){ | ||
@@ -1035,3 +1042,3 @@ options = options || {}; | ||
if (anonymous) { | ||
contact += (this.temp_gruu || 'sip:anonymous@anonymous.invalid;transport=ws').toString(); | ||
contact += (this.temp_gruu || ('sip:anonymous@anonymous.invalid;transport='+(settings.hackWssInTransport)?'wss':'ws')).toString(); | ||
} else { | ||
@@ -1106,2 +1113,3 @@ contact += (this.pub_gruu || this.uri).toString(); | ||
"hackIpInContact", //false | ||
"hackWssInTransport", //false | ||
"instanceId", | ||
@@ -1281,2 +1289,8 @@ "noAnswerTimeout", // 30 seconds. | ||
hackWssInTransport: function(hackWssInTransport) { | ||
if (typeof hackWssInTransport === 'boolean') { | ||
return hackWssInTransport; | ||
} | ||
}, | ||
instanceId: function(instanceId) { | ||
@@ -1283,0 +1297,0 @@ if(typeof instanceId !== 'string') { |
@@ -37,2 +37,21 @@ /** | ||
desugarSessionOptions: function desugarSessionOptions (options) { | ||
if (global.HTMLMediaElement && options instanceof global.HTMLMediaElement) { | ||
options = { | ||
media: { | ||
constraints: { | ||
audio: true, | ||
video: options.tagName === 'VIDEO' | ||
}, | ||
render: { | ||
remote: { | ||
video: options | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
return options; | ||
}, | ||
str_utf8_length: function(string) { | ||
@@ -39,0 +58,0 @@ return encodeURIComponent(string).replace(/%[A-F\d]{2}/g, 'U').length; |
@@ -21,2 +21,3 @@ /** | ||
'iceGathering', | ||
'iceCandidate', | ||
'iceComplete', | ||
@@ -59,3 +60,5 @@ 'iceFailed', | ||
*/ | ||
servers.push({'url': stunServers}); | ||
[].concat(stunServers).forEach(function (server) { | ||
servers.push({'url': server}); | ||
}); | ||
@@ -85,2 +88,3 @@ length = turnServers.length; | ||
this.peerConnection.onicecandidate = function(e) { | ||
self.emit('iceCandidate', e); | ||
if (e.candidate) { | ||
@@ -420,2 +424,3 @@ self.logger.log('ICE candidate received: '+ (e.candidate.candidate === null ? null : e.candidate.candidate.trim())); | ||
sdp = SIP.Hacks.AllBrowsers.unmaskDtls(sdp); | ||
sdp = SIP.Hacks.Firefox.hasIncompatibleCLineWithSomeSIPEndpoints(sdp); | ||
@@ -422,0 +427,0 @@ var sdpWrapper = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
736239
16925
2