Changeset 5839


Ignore:
Timestamp:
Jul 25, 2018 11:56:39 PM (13 months ago)
Author:
ming
Message:

Fixed #2133: Skip IPv4 STUN resolution if account is using NAT64

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r5828 r5839  
    453453    pjsua_stun_resolve   stun_res;  /**< List of pending STUN resolution*/ 
    454454    unsigned             stun_srv_idx; /**< Resolved STUN server index  */ 
     455    unsigned             stun_opt;  /**< STUN resolution option.        */ 
    455456    pj_dns_resolver     *resolver;  /**< DNS resolver.                  */    
    456457 
     
    624625 */ 
    625626/* Resolve the STUN server */ 
    626 pj_status_t resolve_stun_server(pj_bool_t wait, pj_bool_t retry_if_cur_error); 
     627pj_status_t resolve_stun_server(pj_bool_t wait, pj_bool_t retry_if_cur_error, 
     628                                unsigned options); 
    627629 
    628630/**  
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5833 r5839  
    11251125 
    11261126    /* Start resolving STUN server */ 
    1127     status = resolve_stun_server(PJ_FALSE, PJ_FALSE); 
     1127    status = resolve_stun_server(PJ_FALSE, PJ_FALSE, 0); 
    11281128    if (status != PJ_SUCCESS && status != PJ_EPENDING) { 
    11291129        pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
     
    14531453        pj_assert(sess->idx < sess->count); 
    14541454 
     1455        if (pjsua_var.ua_cfg.stun_try_ipv6 && 
     1456            pjsua_var.stun_opt != PJSUA_NAT64_DISABLED && 
     1457            sess->af == pj_AF_INET()) 
     1458        { 
     1459            /* Skip IPv4 STUN resolution if NAT64 is not disabled. */ 
     1460            continue; 
     1461        } 
     1462 
    14551463        pj_ansi_snprintf(target, sizeof(target), "%.*s", 
    14561464                         (int)sess->srv[sess->idx].slen, 
     
    15491557    PJSUA_UNLOCK(); 
    15501558     
    1551     status = resolve_stun_server(wait, PJ_FALSE); 
     1559    status = resolve_stun_server(wait, PJ_FALSE, 0); 
    15521560    if (wait == PJ_FALSE && status == PJ_EPENDING) 
    15531561        status = PJ_SUCCESS; 
     
    16931701 * Resolve STUN server. 
    16941702 */ 
    1695 pj_status_t resolve_stun_server(pj_bool_t wait, pj_bool_t retry_if_cur_error) 
    1696 { 
     1703pj_status_t resolve_stun_server(pj_bool_t wait, pj_bool_t retry_if_cur_error, 
     1704                                unsigned options) 
     1705{ 
     1706    pjsua_var.stun_opt = options; 
     1707 
    16971708    /* Retry resolving if currently the STUN status is error */ 
    16981709    if (pjsua_var.stun_status != PJ_EPENDING && 
     
    21952206 
    21962207    /* Make sure STUN server resolution has completed */ 
    2197     status = resolve_stun_server(PJ_TRUE, PJ_TRUE); 
     2208    status = resolve_stun_server(PJ_TRUE, PJ_TRUE, 0); 
    21982209    if (status != PJ_SUCCESS) { 
    21992210        pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
     
    31033114 
    31043115    /* Make sure STUN server resolution has completed */ 
    3105     status = resolve_stun_server(PJ_TRUE, PJ_TRUE); 
     3116    status = resolve_stun_server(PJ_TRUE, PJ_TRUE, 0); 
    31063117    if (status != PJ_SUCCESS) { 
    31073118        pjsua_var.nat_status = status; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5825 r5839  
    270270                                PJSUA_STUN_RETRY_ON_FAILURE) == 
    271271                                PJSUA_STUN_RETRY_ON_FAILURE; 
    272         status = resolve_stun_server(PJ_TRUE, retry_stun); 
     272        status = resolve_stun_server(PJ_TRUE, retry_stun, 
     273                                     (unsigned)acc->cfg.nat64_opt); 
    273274        if (status != PJ_SUCCESS) { 
    274275            pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
     
    861862                                PJSUA_STUN_RETRY_ON_FAILURE) == 
    862863                                PJSUA_STUN_RETRY_ON_FAILURE; 
    863         status = resolve_stun_server(PJ_TRUE, retry_stun); 
     864        status = resolve_stun_server(PJ_TRUE, retry_stun, 
     865                                     (unsigned)acc_cfg->nat64_opt); 
    864866        if (status != PJ_SUCCESS) { 
    865867            pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
Note: See TracChangeset for help on using the changeset viewer.