Do not resolve SIP address with STUN if public address is configured

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1571 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2007-11-11 03:06:07 +00:00
parent bc9baa9791
commit 744aca06f2
1 changed files with 9 additions and 9 deletions

View File

@ -1240,7 +1240,15 @@ static pj_status_t create_sip_udp_sock(pj_in_addr bound_addr,
/* Get the published address, either by STUN or by resolving
* the name of local host.
*/
if (stun_srv.slen) {
if (p_pub_addr->sin_addr.s_addr != 0) {
/*
* Public address is already specified, no need to resolve the
* address, only set the port.
*/
if (p_pub_addr->sin_port == 0)
p_pub_addr->sin_port = pj_htons((pj_uint16_t)port);
} else if (stun_srv.slen) {
/*
* STUN is specified, resolve the address with STUN.
*/
@ -1254,14 +1262,6 @@ static pj_status_t create_sip_udp_sock(pj_in_addr bound_addr,
return status;
}
} else if (p_pub_addr->sin_addr.s_addr != 0) {
/*
* Public address is already specified, no need to resolve the
* address, only set the port.
*/
if (p_pub_addr->sin_port == 0)
p_pub_addr->sin_port = pj_htons((pj_uint16_t)port);
} else {
pj_bzero(p_pub_addr, sizeof(pj_sockaddr_in));