Changeset 5481
- Timestamp:
- Nov 14, 2016 6:13:01 AM (8 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/config.h
r5339 r5481 264 264 */ 265 265 #ifndef PJ_ICE_MAX_TURN 266 # define PJ_ICE_MAX_TURN 2266 # define PJ_ICE_MAX_TURN 3 267 267 #endif 268 268 -
pjproject/trunk/pjnath/include/pjnath/turn_session.h
r4606 r5481 330 330 */ 331 331 int ka_interval; 332 333 /** 334 * The requested ADDRESS-FAMILY. Default is zero to request relay with 335 * address family matched to the one specified in TURN session creation. 336 * Valid values are zero, pj_AF_INET(), and pj_AF_INET6(). 337 * 338 * Default value is zero. 339 */ 340 int af; 341 332 342 333 343 } pj_turn_alloc_param; -
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r5474 r5481 1992 1992 comp->default_cand = (unsigned)(cand - comp->cand_list); 1993 1993 1994 /* Prefer IPv4 relay as default candidate for better connectivity 1995 * with IPv4 endpoints. 1996 */ 1997 if (cand->addr.addr.sa_family != pj_AF_INET()) { 1998 for (i=0; i<comp->cand_cnt; ++i) { 1999 if (comp->cand_list[i].type == PJ_ICE_CAND_TYPE_RELAYED && 2000 comp->cand_list[i].addr.addr.sa_family == pj_AF_INET() && 2001 comp->cand_list[i].status == PJ_SUCCESS) 2002 { 2003 comp->default_cand = i; 2004 break; 2005 } 2006 } 2007 } 2008 1994 2009 PJ_LOG(4,(comp->ice_st->obj_name, 1995 2010 "Comp %d: TURN allocation complete, relay address is %s", -
pjproject/trunk/pjnath/src/pjnath/turn_session.c
r5469 r5481 725 725 PJ_EINVALIDOP); 726 726 727 /* Verify address family in allocation param */ 728 if (param && param->af) { 729 PJ_ASSERT_RETURN(param->af==pj_AF_INET() || param->af==pj_AF_INET6(), 730 PJ_EINVAL); 731 } 732 727 733 pj_grp_lock_acquire(sess->grp_lock); 728 734 … … 771 777 } 772 778 773 /* Include ADDRESS-FAMILY for IPv6 request */ 774 if (sess->af == pj_AF_INET6()) { 775 enum { IPV6_AF_TYPE = 0x02 << 24 }; 776 pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg, 777 PJ_STUN_ATTR_REQ_ADDR_TYPE, IPV6_AF_TYPE); 779 /* Include ADDRESS-FAMILY if requested */ 780 if (sess->alloc_param.af || sess->af == pj_AF_INET6()) { 781 enum { IPV4_AF_TYPE = 0x01 << 24, 782 IPV6_AF_TYPE = 0x02 << 24 }; 783 784 if (sess->alloc_param.af == pj_AF_INET6() || 785 (sess->alloc_param.af == 0 && sess->af == pj_AF_INET6())) 786 { 787 pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg, 788 PJ_STUN_ATTR_REQ_ADDR_TYPE, IPV6_AF_TYPE); 789 } else if (sess->alloc_param.af == pj_AF_INET()) { 790 /* For IPv4, only add the attribute when explicitly requested */ 791 pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg, 792 PJ_STUN_ATTR_REQ_ADDR_TYPE, IPV4_AF_TYPE); 793 } 778 794 } 779 795 … … 1359 1375 return; 1360 1376 } 1361 if (raddr_attr && raddr_attr->sockaddr.addr.sa_family != sess->af) { 1377 if (raddr_attr && 1378 ((sess->alloc_param.af != 0 && 1379 raddr_attr->sockaddr.addr.sa_family != sess->alloc_param.af) || 1380 (sess->alloc_param.af == 0 && 1381 raddr_attr->sockaddr.addr.sa_family != sess->af))) 1382 { 1362 1383 on_session_fail(sess, method, PJNATH_EINSTUNMSG, 1363 1384 pj_cstr(&s, "Error: Mismatched RELAY-ADDRESS " -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5462 r5481 927 927 ice_cfg.turn_tp_cnt = 1; 928 928 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; 929 if (use_ipv6 && PJ_ICE_MAX_TURN >= 3) { 930 ice_cfg.turn_tp_cnt = 3; 931 931 932 pj_ice_strans_turn_cfg_default(&ice_cfg.turn_tp[1]); 932 933 ice_cfg.turn_tp[1].af = pj_AF_INET6(); 934 935 /* Additional candidate: IPv4 relay via IPv6 TURN server */ 936 pj_ice_strans_turn_cfg_default(&ice_cfg.turn_tp[2]); 937 ice_cfg.turn_tp[2].af = pj_AF_INET6(); 938 ice_cfg.turn_tp[2].alloc_param.af = pj_AF_INET(); 933 939 } 934 940 … … 957 963 &acc_cfg->turn_cfg.turn_auth_cred, 958 964 sizeof(ice_cfg.turn_tp[1].auth_cred)); 965 966 ice_cfg.turn_tp[2].server = ice_cfg.turn_tp[0].server; 967 ice_cfg.turn_tp[2].port = ice_cfg.turn_tp[0].port; 968 ice_cfg.turn_tp[2].conn_type = ice_cfg.turn_tp[0].conn_type; 969 pj_memcpy(&ice_cfg.turn_tp[2].auth_cred, 970 &acc_cfg->turn_cfg.turn_auth_cred, 971 sizeof(ice_cfg.turn_tp[2].auth_cred)); 959 972 } 960 973 … … 967 980 pj_memcpy(&ice_cfg.turn_tp[1].cfg.qos_params, &cfg->qos_params, 968 981 sizeof(cfg->qos_params)); 982 983 ice_cfg.turn_tp[2].cfg.qos_type = cfg->qos_type; 984 pj_memcpy(&ice_cfg.turn_tp[2].cfg.qos_params, &cfg->qos_params, 985 sizeof(cfg->qos_params)); 969 986 } 970 987 … … 984 1001 ice_cfg.turn_tp[1].cfg.port_range = 985 1002 ice_cfg.turn_tp[0].cfg.port_range; 1003 1004 pj_sockaddr_init(pj_AF_INET6(), 1005 &ice_cfg.turn_tp[2].cfg.bound_addr, 1006 &IN6_ADDR_ANY, (pj_uint16_t)cfg->port); 1007 ice_cfg.turn_tp[2].cfg.port_range = 1008 ice_cfg.turn_tp[0].cfg.port_range; 986 1009 } 987 1010 988 1011 /* Configure max packet size */ 989 1012 ice_cfg.turn_tp[0].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 990 if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) 1013 if (use_ipv6 && ice_cfg.turn_tp_cnt > 1) { 991 1014 ice_cfg.turn_tp[1].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 1015 ice_cfg.turn_tp[2].cfg.max_pkt_size = PJMEDIA_MAX_MRU; 1016 } 992 1017 } 993 1018
Note: See TracChangeset
for help on using the changeset viewer.