Changeset 5217 for pjproject


Ignore:
Timestamp:
Dec 24, 2015 12:25:58 PM (5 years ago)
Author:
nanang
Message:

Misc (re #1882): Fixed bug STUN still being used in media transport UDP & ICE after STUN is disabled in account config (media_stun_use == PJSUA_STUN_USE_DISABLED).

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

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

    r5128 r5217  
    609609/* acc use stun? */ 
    610610pj_bool_t pjsua_sip_acc_is_using_stun(pjsua_acc_id acc_id); 
     611pj_bool_t pjsua_media_acc_is_using_stun(pjsua_acc_id acc_id); 
    611612 
    612613/* Get local transport address suitable to be used for Via or Contact address 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r5188 r5217  
    24812481 
    24822482    return acc->cfg.sip_stun_use != PJSUA_STUN_USE_DISABLED && 
    2483             pjsua_var.ua_cfg.stun_srv_cnt != 0; 
     2483           pjsua_var.ua_cfg.stun_srv_cnt != 0; 
     2484} 
     2485 
     2486pj_bool_t pjsua_media_acc_is_using_stun(pjsua_acc_id acc_id) 
     2487{ 
     2488    pjsua_acc *acc = &pjsua_var.acc[acc_id]; 
     2489 
     2490    return acc->cfg.media_stun_use != PJSUA_STUN_USE_DISABLED && 
     2491           pjsua_var.ua_cfg.stun_srv_cnt != 0; 
    24842492} 
    24852493 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5205 r5217  
    254254 
    255255    /* Make sure STUN server resolution has completed */ 
    256     if (!use_ipv6 && pjsua_sip_acc_is_using_stun(call_med->call->acc_id)) { 
     256    if (!use_ipv6 && pjsua_media_acc_is_using_stun(call_med->call->acc_id)) { 
    257257        status = resolve_stun_server(PJ_TRUE); 
    258258        if (status != PJ_SUCCESS) { 
     
    351351         * and make sure that the mapped RTCP port is adjacent with the RTP. 
    352352         */ 
    353         if (!use_ipv6 && pjsua_sip_acc_is_using_stun(call_med->call->acc_id) && 
     353        if (!use_ipv6 && 
     354            pjsua_media_acc_is_using_stun(call_med->call->acc_id) && 
    354355            pjsua_var.stun_srv.addr.sa_family != 0) 
    355356        { 
     
    748749 
    749750    /* Make sure STUN server resolution has completed */ 
    750     status = resolve_stun_server(PJ_TRUE); 
    751     if (status != PJ_SUCCESS) { 
    752         pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
    753         return status; 
     751    if (pjsua_media_acc_is_using_stun(call_med->call->acc_id)) { 
     752        status = resolve_stun_server(PJ_TRUE); 
     753        if (status != PJ_SUCCESS) { 
     754            pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 
     755            return status; 
     756        } 
    754757    } 
    755758 
     
    766769 
    767770    /* Configure STUN settings */ 
    768     if (pj_sockaddr_has_addr(&pjsua_var.stun_srv)) { 
     771    if (pj_sockaddr_has_addr(&pjsua_var.stun_srv) && 
     772        pjsua_media_acc_is_using_stun(call_med->call->acc_id)) 
     773    { 
    769774        pj_sockaddr_print(&pjsua_var.stun_srv, stunip, sizeof(stunip), 0); 
    770775        ice_cfg.stun.server = pj_str(stunip); 
Note: See TracChangeset for help on using the changeset viewer.