Ignore:
Timestamp:
Jun 8, 2016 3:17:45 AM (8 years ago)
Author:
nanang
Message:

Re #422: Added IPv6 support to PJNATH, changes:

  • Deprecated 'pj_ice_strans_cfg.af', if set, the value will be ignored, address family setting is now specified via transport setting, i.e: 'pj_ice_strans_cfg.stun_tp/turn_tp'.
  • Deprecated 'pj_ice_strans_cfg.stun/turn', for backward compatibility, this field value will be checked if 'pj_ice_strans_cfg.stun_tp_cnt/turn_tp_cnt' is set to zero.
  • Added 'pj_ice_strans_stun_cfg' & 'pj_ice_strans_stun_cfg' and the corresponding 'pj_ice_strans_stun/turn_cfg_default()'
  • Added 'pj_ice_strans_cfg.stun_tp/turn_tp' as replacement of 'pj_ice_strans_cfg.stun/turn', it is now an array so app can have multiple STUN/TURN transports.
  • Added macro PJ_ICE_MAX_STUN/TURN to specify maximum number of STUN/TURN transports in each ICE component in compile-time.
  • Miscellaneous: fixed socket number limit in concurrency test in pjnath-test, updated pjsua_media.c to use new 'pj_ice_strans_cfg' setting.
File:
1 edited

Legend:

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

    r5326 r5339  
    845845                        pjsip_endpt_get_timer_heap(pjsua_var.endpt)); 
    846846     
    847     ice_cfg.af = pj_AF_INET(); 
    848847    ice_cfg.resolver = pjsua_var.resolver; 
    849848     
    850849    ice_cfg.opt = acc_cfg->ice_cfg.ice_opt; 
     850 
     851    /* Check if STUN transport is configured */ 
     852    if ((pj_sockaddr_has_addr(&pjsua_var.stun_srv) && 
     853         pjsua_media_acc_is_using_stun(call_med->call->acc_id)) || 
     854        acc_cfg->ice_cfg.ice_max_host_cands != 0) 
     855    { 
     856        ice_cfg.stun_tp_cnt = 1; 
     857        pj_ice_strans_stun_cfg_default(&ice_cfg.stun_tp[0]); 
     858    } 
    851859 
    852860    /* Configure STUN settings */ 
     
    855863    { 
    856864        pj_sockaddr_print(&pjsua_var.stun_srv, stunip, sizeof(stunip), 0); 
    857         ice_cfg.stun.server = pj_str(stunip); 
    858         ice_cfg.stun.port = pj_sockaddr_get_port(&pjsua_var.stun_srv); 
     865        ice_cfg.stun_tp[0].server = pj_str(stunip); 
     866        ice_cfg.stun_tp[0].port = pj_sockaddr_get_port(&pjsua_var.stun_srv); 
    859867    } 
    860868    if (acc_cfg->ice_cfg.ice_max_host_cands >= 0) 
    861         ice_cfg.stun.max_host_cands = acc_cfg->ice_cfg.ice_max_host_cands; 
     869        ice_cfg.stun_tp[0].max_host_cands = acc_cfg->ice_cfg.ice_max_host_cands; 
    862870 
    863871    /* Copy binding port setting to STUN setting */ 
    864     pj_sockaddr_init(ice_cfg.af, &ice_cfg.stun.cfg.bound_addr, 
     872    pj_sockaddr_init(ice_cfg.stun_tp[0].af, &ice_cfg.stun_tp[0].cfg.bound_addr, 
    865873                     &cfg->bound_addr, (pj_uint16_t)cfg->port); 
    866     ice_cfg.stun.cfg.port_range = (pj_uint16_t)cfg->port_range; 
    867     if (cfg->port != 0 && ice_cfg.stun.cfg.port_range == 0) 
    868         ice_cfg.stun.cfg.port_range =  
     874    ice_cfg.stun_tp[0].cfg.port_range = (pj_uint16_t)cfg->port_range; 
     875    if (cfg->port != 0 && ice_cfg.stun_tp[0].cfg.port_range == 0) 
     876        ice_cfg.stun_tp[0].cfg.port_range =  
    869877                                 (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); 
    870878 
    871879    /* Copy QoS setting to STUN setting */ 
    872     ice_cfg.stun.cfg.qos_type = cfg->qos_type; 
    873     pj_memcpy(&ice_cfg.stun.cfg.qos_params, &cfg->qos_params, 
     880    ice_cfg.stun_tp[0].cfg.qos_type = cfg->qos_type; 
     881    pj_memcpy(&ice_cfg.stun_tp[0].cfg.qos_params, &cfg->qos_params, 
    874882              sizeof(cfg->qos_params)); 
    875883 
    876884    /* Configure TURN settings */ 
    877885    if (acc_cfg->turn_cfg.enable_turn) { 
     886        ice_cfg.turn_tp_cnt = 1; 
     887        pj_ice_strans_turn_cfg_default(&ice_cfg.turn_tp[0]); 
    878888        status = parse_host_port(&acc_cfg->turn_cfg.turn_server, 
    879                                  &ice_cfg.turn.server, 
    880                                  &ice_cfg.turn.port); 
    881         if (status != PJ_SUCCESS || ice_cfg.turn.server.slen == 0) { 
     889                                 &ice_cfg.turn_tp[0].server, 
     890                                 &ice_cfg.turn_tp[0].port); 
     891        if (status != PJ_SUCCESS || ice_cfg.turn_tp[0].server.slen == 0) { 
    882892            PJ_LOG(1,(THIS_FILE, "Invalid TURN server setting")); 
    883893            return PJ_EINVAL; 
    884894        } 
    885         if (ice_cfg.turn.port == 0) 
    886             ice_cfg.turn.port = 3479; 
    887         ice_cfg.turn.conn_type = acc_cfg->turn_cfg.turn_conn_type; 
    888         pj_memcpy(&ice_cfg.turn.auth_cred,  
     895        if (ice_cfg.turn_tp[0].port == 0) 
     896            ice_cfg.turn_tp[0].port = 3479; 
     897        ice_cfg.turn_tp[0].conn_type = acc_cfg->turn_cfg.turn_conn_type; 
     898        pj_memcpy(&ice_cfg.turn_tp[0].auth_cred,  
    889899                  &acc_cfg->turn_cfg.turn_auth_cred, 
    890                   sizeof(ice_cfg.turn.auth_cred)); 
     900                  sizeof(ice_cfg.turn_tp[0].auth_cred)); 
    891901 
    892902        /* Copy QoS setting to TURN setting */ 
    893         ice_cfg.turn.cfg.qos_type = cfg->qos_type; 
    894         pj_memcpy(&ice_cfg.turn.cfg.qos_params, &cfg->qos_params, 
     903        ice_cfg.turn_tp[0].cfg.qos_type = cfg->qos_type; 
     904        pj_memcpy(&ice_cfg.turn_tp[0].cfg.qos_params, &cfg->qos_params, 
    895905                  sizeof(cfg->qos_params)); 
    896906 
    897907        /* Copy binding port setting to TURN setting */ 
    898         pj_sockaddr_init(ice_cfg.af, &ice_cfg.turn.cfg.bound_addr, 
     908        pj_sockaddr_init(ice_cfg.turn_tp[0].af, &ice_cfg.turn_tp[0].cfg.bound_addr, 
    899909                         &cfg->bound_addr, (pj_uint16_t)cfg->port); 
    900         ice_cfg.turn.cfg.port_range = (pj_uint16_t)cfg->port_range; 
    901         if (cfg->port != 0 && ice_cfg.turn.cfg.port_range == 0) 
    902             ice_cfg.turn.cfg.port_range =  
     910        ice_cfg.turn_tp[0].cfg.port_range = (pj_uint16_t)cfg->port_range; 
     911        if (cfg->port != 0 && ice_cfg.turn_tp[0].cfg.port_range == 0) 
     912            ice_cfg.turn_tp[0].cfg.port_range =  
    903913                                 (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); 
    904914    } 
    905915 
    906916    /* Configure packet size for STUN and TURN sockets */ 
    907     ice_cfg.stun.cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
    908     ice_cfg.turn.cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
     917    ice_cfg.stun_tp[0].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
     918    ice_cfg.turn_tp[0].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 
    909919 
    910920    pj_bzero(&ice_cb, sizeof(pjmedia_ice_cb)); 
Note: See TracChangeset for help on using the changeset viewer.