Skip to content
Permalink
Browse files

hack_ip_in_contact now generates a IP in the range of Test-Net as sta…

…ted in RFC 5735 (192.0.2.0/24).
  • Loading branch information
ibc committed Feb 4, 2013
1 parent 42b3749 commit f306d3cd2d993612b46217351238c43a02fbd8dd
Showing with 9 additions and 5 deletions.
  1. +1 −1 src/UA.js
  2. +8 −4 src/Utils.js
@@ -719,7 +719,7 @@ JsSIP.UA.prototype.loadConfig = function(configuration) {

// Via Host
if (settings.hack_ip_in_contact) {
settings.via_host = JsSIP.Utils.getRandomIP();
settings.via_host = JsSIP.Utils.getRandomTestNetIP();
}

// Transports
@@ -137,11 +137,15 @@ JsSIP.Utils= {
return JsSIP.C.causes.SIP_FAILURE_CODE;
},

getRandomIP: function() {
function get_octet() {
return (Math.random() * 255 | 0) + 1;
/**
* Generate a random Test-Net IP (http://tools.ietf.org/html/rfc5735)
* @private
*/
getRandomTestNetIP: function() {
function getOctet(from,to) {
return window.Math.floor(window.Math.random()*(to-from+1)+from);
}
return get_octet()+'.'+get_octet()+'.'+get_octet()+'.'+get_octet();
return '192.0.2.' + getOctet(1, 254);
},

checkUAStatus: function(ua) {

0 comments on commit f306d3c

Please sign in to comment.
You can’t perform that action at this time.