Changeset 5462 for pjproject


Ignore:
Timestamp:
Oct 17, 2016 7:50:28 AM (7 years ago)
Author:
nanang
Message:

Close #1971: Updated pjsua to enable IPv6 TURN in ICE media transport.

File:
1 edited

Legend:

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

    r5417 r5462  
    927927        ice_cfg.turn_tp_cnt = 1; 
    928928        pj_ice_strans_turn_cfg_default(&ice_cfg.turn_tp[0]); 
     929        if (use_ipv6 && PJ_ICE_MAX_TURN >= 2) { 
     930            ice_cfg.turn_tp_cnt = 2; 
     931            pj_ice_strans_turn_cfg_default(&ice_cfg.turn_tp[1]); 
     932            ice_cfg.turn_tp[1].af = pj_AF_INET6(); 
     933        } 
     934 
     935        /* Configure TURN server */ 
    929936        status = parse_host_port(&acc_cfg->turn_cfg.turn_server, 
    930937                                 &ice_cfg.turn_tp[0].server, 
     
    934941            return PJ_EINVAL; 
    935942        } 
     943 
     944        /* Configure TURN connection settings and credential */ 
    936945        if (ice_cfg.turn_tp[0].port == 0) 
    937946            ice_cfg.turn_tp[0].port = 3479; 
     
    941950                  sizeof(ice_cfg.turn_tp[0].auth_cred)); 
    942951 
    943         /* Copy QoS setting to TURN setting */ 
     952        if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) { 
     953            ice_cfg.turn_tp[1].server    = ice_cfg.turn_tp[0].server; 
     954            ice_cfg.turn_tp[1].port      = ice_cfg.turn_tp[0].port; 
     955            ice_cfg.turn_tp[1].conn_type = ice_cfg.turn_tp[0].conn_type; 
     956            pj_memcpy(&ice_cfg.turn_tp[1].auth_cred,  
     957                      &acc_cfg->turn_cfg.turn_auth_cred, 
     958                      sizeof(ice_cfg.turn_tp[1].auth_cred)); 
     959        } 
     960 
     961        /* Configure QoS setting */ 
    944962        ice_cfg.turn_tp[0].cfg.qos_type = cfg->qos_type; 
    945963        pj_memcpy(&ice_cfg.turn_tp[0].cfg.qos_params, &cfg->qos_params, 
    946964                  sizeof(cfg->qos_params)); 
    947  
    948         /* Copy binding port setting to TURN setting */ 
     965        if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) { 
     966            ice_cfg.turn_tp[1].cfg.qos_type = cfg->qos_type; 
     967            pj_memcpy(&ice_cfg.turn_tp[1].cfg.qos_params, &cfg->qos_params, 
     968                      sizeof(cfg->qos_params)); 
     969        } 
     970 
     971        /* Configure binding address */ 
    949972        pj_sockaddr_init(ice_cfg.turn_tp[0].af, &ice_cfg.turn_tp[0].cfg.bound_addr, 
    950973                         &cfg->bound_addr, (pj_uint16_t)cfg->port); 
     
    954977                                 (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); 
    955978 
     979        if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) { 
     980            pj_str_t IN6_ADDR_ANY = {"0", 1}; 
     981            pj_sockaddr_init(pj_AF_INET6(), 
     982                             &ice_cfg.turn_tp[1].cfg.bound_addr, 
     983                             &IN6_ADDR_ANY, (pj_uint16_t)cfg->port); 
     984            ice_cfg.turn_tp[1].cfg.port_range = 
     985                            ice_cfg.turn_tp[0].cfg.port_range; 
     986        } 
     987 
    956988        /* Configure max packet size */ 
    957989        ice_cfg.turn_tp[0].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
     990        if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) 
     991            ice_cfg.turn_tp[1].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
    958992    } 
    959993 
Note: See TracChangeset for help on using the changeset viewer.