Changeset 5339 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Jun 8, 2016 3:17:45 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5326 r5339 845 845 pjsip_endpt_get_timer_heap(pjsua_var.endpt)); 846 846 847 ice_cfg.af = pj_AF_INET();848 847 ice_cfg.resolver = pjsua_var.resolver; 849 848 850 849 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 } 851 859 852 860 /* Configure STUN settings */ … … 855 863 { 856 864 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); 859 867 } 860 868 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; 862 870 863 871 /* 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, 865 873 &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 = 869 877 (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); 870 878 871 879 /* 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, 874 882 sizeof(cfg->qos_params)); 875 883 876 884 /* Configure TURN settings */ 877 885 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]); 878 888 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) { 882 892 PJ_LOG(1,(THIS_FILE, "Invalid TURN server setting")); 883 893 return PJ_EINVAL; 884 894 } 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, 889 899 &acc_cfg->turn_cfg.turn_auth_cred, 890 sizeof(ice_cfg.turn .auth_cred));900 sizeof(ice_cfg.turn_tp[0].auth_cred)); 891 901 892 902 /* 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, 895 905 sizeof(cfg->qos_params)); 896 906 897 907 /* 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, 899 909 &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 = 903 913 (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); 904 914 } 905 915 906 916 /* 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; 909 919 910 920 pj_bzero(&ice_cb, sizeof(pjmedia_ice_cb));
Note: See TracChangeset
for help on using the changeset viewer.