Changeset 1533 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Oct 31, 2007 8:59:29 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r1477 r1533 99 99 call->res_time.sec = 0; 100 100 call->res_time.msec = 0; 101 call->rem_nat_type = PJ_STUN_NAT_TYPE_UNKNOWN; 101 102 } 102 103 … … 427 428 PJSUA_UNLOCK(); 428 429 return status; 430 } 431 432 433 /* Get the NAT type information in remote's SDP */ 434 static void update_remote_nat_type(pjsua_call *call, 435 const pjmedia_sdp_session *sdp) 436 { 437 const pjmedia_sdp_attr *xnat; 438 439 xnat = pjmedia_sdp_attr_find2(sdp->attr_count, sdp->attr, "X-nat", NULL); 440 if (xnat) { 441 call->rem_nat_type = (pj_stun_nat_type) (xnat->value.ptr[0] - '0'); 442 } else { 443 call->rem_nat_type = PJ_STUN_NAT_TYPE_UNKNOWN; 444 } 445 446 PJ_LOG(5,(THIS_FILE, "Call %d: remote NAT type is %d (%s)", call->index, 447 call->rem_nat_type, pj_stun_get_nat_name(call->rem_nat_type))); 429 448 } 430 449 … … 659 678 } 660 679 680 /* Update NAT type of remote endpoint */ 681 if (pjsua_var.ua_cfg.nat_type_in_sdp) { 682 const pjmedia_sdp_session *remote_sdp; 683 684 if (pjmedia_sdp_neg_get_neg_remote(inv->neg, &remote_sdp)==PJ_SUCCESS) 685 update_remote_nat_type(call, remote_sdp); 686 } 661 687 662 688 /* Create and attach pjsua_var data to the dialog: */ … … 1020 1046 NULL); 1021 1047 return pjsua_var.calls[call_id].user_data; 1048 } 1049 1050 1051 /* 1052 * Get remote's NAT type. 1053 */ 1054 PJ_DEF(pj_status_t) pjsua_call_get_rem_nat_type(pjsua_call_id call_id, 1055 pj_stun_nat_type *p_type) 1056 { 1057 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1058 PJ_EINVAL); 1059 PJ_ASSERT_RETURN(p_type != NULL, PJ_EINVAL); 1060 1061 *p_type = pjsua_var.calls[call_id].rem_nat_type; 1062 return PJ_SUCCESS; 1022 1063 } 1023 1064 … … 2268 2309 } 2269 2310 2270 2271 2311 status = pjmedia_sdp_neg_get_active_remote(call->inv->neg, &remote_sdp); 2272 2312 if (status != PJ_SUCCESS) { … … 2279 2319 } 2280 2320 2321 /* Update remote's NAT type */ 2322 if (pjsua_var.ua_cfg.nat_type_in_sdp) { 2323 update_remote_nat_type(call, remote_sdp); 2324 } 2325 2326 /* Update media channel with the new SDP */ 2281 2327 status = pjsua_media_channel_update(call->index, local_sdp, remote_sdp); 2282 2328 if (status != PJ_SUCCESS) {
Note: See TracChangeset
for help on using the changeset viewer.