File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -719,7 +719,7 @@ JsSIP.UA.prototype.loadConfig = function(configuration) {
719719
720720 // Via Host
721721 if ( settings . hack_ip_in_contact ) {
722- settings . via_host = JsSIP . Utils . getRandomIP ( ) ;
722+ settings . via_host = JsSIP . Utils . getRandomTestNetIP ( ) ;
723723 }
724724
725725 // Transports
Original file line number Diff line number Diff line change @@ -137,11 +137,15 @@ JsSIP.Utils= {
137137 return JsSIP . C . causes . SIP_FAILURE_CODE ;
138138 } ,
139139
140- getRandomIP : function ( ) {
141- function get_octet ( ) {
142- return ( Math . random ( ) * 255 | 0 ) + 1 ;
140+ /**
141+ * Generate a random Test-Net IP (http://tools.ietf.org/html/rfc5735)
142+ * @private
143+ */
144+ getRandomTestNetIP : function ( ) {
145+ function getOctet ( from , to ) {
146+ return window . Math . floor ( window . Math . random ( ) * ( to - from + 1 ) + from ) ;
143147 }
144- return get_octet ( ) + '.' + get_octet ( ) + '.' + get_octet ( ) + '.' + get_octet ( ) ;
148+ return '192.0.2.' + getOctet ( 1 , 254 ) ;
145149 } ,
146150
147151 checkUAStatus : function ( ua ) {
You can’t perform that action at this time.
0 commit comments