Changes between Version 122 and Version 123 of FAQ


Ignore:
Timestamp:
Mar 13, 2014 10:13:22 PM (7 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v122 v123  
    10381038=== My machine has multiple NICs (multihomed) and PJSIP chooses the wrong IP interface === #multihomed 
    10391039 
    1040 If 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. 
    1041  
    1042 First 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. 
     1040If the machine is multihomed (such as when VPN is used), PJSIP will use the following logic to determine which '''initial''' IP address is used for the Contact and Via header. This was implemented in ticket #1412 for version 2.1. 
     1041 
     1042The initial value will take into account whether STUN is enabled or disabled in the account. If it is enabled, the STUN address will  be used. If it is disabled, local IP will be used. For UDP transport, if STUN is not used or disabled for the account, an attempt will be made to use the correct IP interface to be placed in the Contact URI, by querying the OS about the interface to send to the destination. This would work well for LAN destinations; if the destination is across the Internet, then whatever interface that is used to connect to it will be used by PJSIP. Thus the selected address would depend on the OS routing. Note that this is OS behavior and not PJSIP. 
     1043 
     1044No change for TCP; the correct IP has already been selected in the Contact URI. 
     1045 
     1046If registration is enabled, the correct address of Contact and Via header are by default recalculated again by looking at the REGISTER response. Please see the documentation of {{{allow_contact_rewrite}}} and {{{allow_via_rewrite}}} in the {{{pjsua_acc_config}}}. 
     1047 
     1048 
     1049=== The pj_gethostip() algorithm === 
     1050 
     1051This is only for reference. 
    10431052 
    10441053An 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: