Changes between Version 75 and Version 76 of FAQ


Ignore:
Timestamp:
Aug 14, 2009 9:07:34 AM (15 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v75 v76  
    851851 
    852852 
    853  
     853=== My machine has multiple NICs (multihomed) and PJSIP chooses the wrong IP interface === #multihomed 
     854 
     855If the machine is multihomed (such as when VPN is used), PJSIP will use the following logic to determine which IP address is used for the Contact and Via header. 
     856 
     857First of all, by default PJSIP binds sockets to INADDR_ANY (0.0.0.0), so it will be able to send and receive to/from any destinations configured in the system. 
     858 
     859An IP address will be choosen by using [http://www.pjsip.org/pjlib/docs/html/group__pj__addr__resolve.htm#g410b1bd02dcabf108b129e95368beef4 pj_gethostip()] function. Since version 1.2 this function selects which IP interface to use based on a scoring algorithm as follows: 
     860  - add 1 to the score of the IP that is resolved from gethostbyname(gethostname()) 
     861  - add 2 to the score of the IP that is used as the default interface 
     862  - add 1 to the score of all interfaces from the interface enumeration.  
     863  - add the end of the algorithm, choose interface with the highest score 
     864 
     865(Note: please see ticket #800 for the algorithm used on PJSIP version older than 1.2) 
     866 
     867This IP address then will be used in the Contact and Via header of the outgoing request 
     868 
     869If REGISTER is used, then this is becoming less of an issue. PJSUA-LIB will inspect the 200/OK response, check if the IP/port number seen by the server match the IP/port that we use in Contact, and if they're not the same, PJSUA-LIB will update the registration by sending un-REGISTER and new REGISTER with a new Contact. This new Contact then will be used for subsequent requests generated on behalf of the account. 
    854870 
    855871