Changeset 4218 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Aug 7, 2012 2:18:15 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r4197 r4218 166 166 167 167 /* Perform NAT detection */ 168 status = pjsua_detect_nat_type(); 169 if (status != PJ_SUCCESS) { 170 PJ_PERROR(1,(THIS_FILE, status, "NAT type detection failed")); 168 if (pjsua_var.ua_cfg.stun_srv_cnt) { 169 status = pjsua_detect_nat_type(); 170 if (status != PJ_SUCCESS) { 171 PJ_PERROR(1,(THIS_FILE, status, "NAT type detection failed")); 172 } 171 173 } 172 174 … … 227 229 * address via STUN. 228 230 */ 229 static pj_status_t create_rtp_rtcp_sock(const pjsua_transport_config *cfg, 231 static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med, 232 const pjsua_transport_config *cfg, 230 233 pjmedia_sock_info *skinfo) 231 234 { … … 241 244 242 245 /* Make sure STUN server resolution has completed */ 243 status = resolve_stun_server(PJ_TRUE); 244 if (status != PJ_SUCCESS) { 245 pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 246 return status; 246 if (pjsua_sip_acc_is_using_stun(call_med->call->acc_id)) { 247 status = resolve_stun_server(PJ_TRUE); 248 if (status != PJ_SUCCESS) { 249 pjsua_perror(THIS_FILE, "Error resolving STUN server", status); 250 return status; 251 } 247 252 } 248 253 … … 319 324 * and make sure that the mapped RTCP port is adjacent with the RTP. 320 325 */ 321 if (pjsua_var.stun_srv.addr.sa_family != 0) { 326 if (pjsua_sip_acc_is_using_stun(call_med->call->acc_id) && 327 pjsua_var.stun_srv.addr.sa_family != 0) 328 { 322 329 char ip_addr[32]; 323 330 pj_str_t stun_srv; … … 441 448 pj_status_t status; 442 449 443 status = create_rtp_rtcp_sock(c fg, &skinfo);450 status = create_rtp_rtcp_sock(call_med, cfg, &skinfo); 444 451 if (status != PJ_SUCCESS) { 445 452 pjsua_perror(THIS_FILE, "Unable to create RTP/RTCP socket", … … 661 668 { 662 669 char stunip[PJ_INET6_ADDRSTRLEN]; 670 pjsua_acc_config *acc_cfg; 663 671 pj_ice_strans_cfg ice_cfg; 664 672 pjmedia_ice_cb ice_cb; … … 666 674 unsigned comp_cnt; 667 675 pj_status_t status; 676 677 acc_cfg = &pjsua_var.acc[call_med->call->acc_id].cfg; 668 678 669 679 /* Make sure STUN server resolution has completed */ … … 683 693 ice_cfg.resolver = pjsua_var.resolver; 684 694 685 ice_cfg.opt = pjsua_var.media_cfg.ice_opt;695 ice_cfg.opt = acc_cfg->ice_cfg.ice_opt; 686 696 687 697 /* Configure STUN settings */ … … 691 701 ice_cfg.stun.port = pj_sockaddr_get_port(&pjsua_var.stun_srv); 692 702 } 693 if ( pjsua_var.media_cfg.ice_max_host_cands >= 0)694 ice_cfg.stun.max_host_cands = pjsua_var.media_cfg.ice_max_host_cands;703 if (acc_cfg->ice_cfg.ice_max_host_cands >= 0) 704 ice_cfg.stun.max_host_cands = acc_cfg->ice_cfg.ice_max_host_cands; 695 705 696 706 /* Copy QoS setting to STUN setting */ … … 700 710 701 711 /* Configure TURN settings */ 702 if ( pjsua_var.media_cfg.enable_turn) {703 status = parse_host_port(& pjsua_var.media_cfg.turn_server,712 if (acc_cfg->turn_cfg.enable_turn) { 713 status = parse_host_port(&acc_cfg->turn_cfg.turn_server, 704 714 &ice_cfg.turn.server, 705 715 &ice_cfg.turn.port); … … 710 720 if (ice_cfg.turn.port == 0) 711 721 ice_cfg.turn.port = 3479; 712 ice_cfg.turn.conn_type = pjsua_var.media_cfg.turn_conn_type;722 ice_cfg.turn.conn_type = acc_cfg->turn_cfg.turn_conn_type; 713 723 pj_memcpy(&ice_cfg.turn.auth_cred, 714 & pjsua_var.media_cfg.turn_auth_cred,724 &acc_cfg->turn_cfg.turn_auth_cred, 715 725 sizeof(ice_cfg.turn.auth_cred)); 716 726 … … 731 741 732 742 comp_cnt = 1; 733 if (PJMEDIA_ADVERTISE_RTCP && ! pjsua_var.media_cfg.ice_no_rtcp)743 if (PJMEDIA_ADVERTISE_RTCP && !acc_cfg->ice_cfg.ice_no_rtcp) 734 744 ++comp_cnt; 735 745 … … 859 869 860 870 /* Create the transports */ 861 if (pjsua_var. media_cfg.enable_ice) {871 if (pjsua_var.ice_cfg.enable_ice) { 862 872 status = create_ice_media_transports(&cfg); 863 873 } else { … … 1245 1255 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_CREATING); 1246 1256 1247 if (pjsua_var. media_cfg.enable_ice) {1257 if (pjsua_var.acc[call_med->call->acc_id].cfg.ice_cfg.enable_ice) { 1248 1258 status = create_ice_media_transport(tcfg, call_med, async); 1249 1259 if (async && status == PJ_EPENDING) {
Note: See TracChangeset
for help on using the changeset viewer.