Ignore:
Timestamp:
May 31, 2016 7:59:06 AM (3 years ago)
Author:
nanang
Message:

Misc (re #1917): Print warning (instead of returning error) in creating SIP UDP transport IPv6 with STUN enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5326 r5327  
    21382138            pj_sockaddr_set_port(p_pub_addr, (pj_uint16_t)port); 
    21392139 
    2140     } else if (stun_srv.slen) { 
     2140    } else if (stun_srv.slen && af == pj_AF_INET()) { 
    21412141        pjstun_setting stun_opt; 
    21422142 
    21432143        /* 
    21442144         * STUN is specified, resolve the address with STUN. 
     2145         * Currently, this is available for IPv4 address only. 
    21452146         */ 
    2146         if (af != pj_AF_INET()) { 
    2147             pjsua_perror(THIS_FILE, "Cannot use STUN", PJ_EAFNOTSUP); 
    2148             pj_sock_close(sock); 
    2149             return PJ_EAFNOTSUP; 
    2150         } 
    2151  
    21522147        pj_bzero(&stun_opt, sizeof(stun_opt)); 
    21532148        stun_opt.use_stun2 = pjsua_var.ua_cfg.stun_map_use_stun2; 
     
    21642159 
    21652160    } else { 
     2161 
    21662162        pj_bzero(p_pub_addr, sizeof(pj_sockaddr)); 
    21672163 
     
    21792175        p_pub_addr->addr.sa_family = (pj_uint16_t)af; 
    21802176        pj_sockaddr_set_port(p_pub_addr, (pj_uint16_t)port); 
     2177 
     2178        if (stun_srv.slen && af != pj_AF_INET()) { 
     2179            /* STUN is specified, but it is not IPv4, just print warning */ 
     2180            PJ_PERROR(2, (THIS_FILE, PJ_EAFNOTSUP, 
     2181                          "Cannot use STUN for SIP UDP socket %s:%d", 
     2182                          addr_string(p_pub_addr), 
     2183                          (int)pj_sockaddr_get_port(p_pub_addr))); 
     2184        } 
     2185 
    21812186    } 
    21822187 
Note: See TracChangeset for help on using the changeset viewer.