diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-09 01:15:43 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-09 01:15:43 +0000 |
commit | d6e1f284a67001fdf0ada8ed1c54d3d67b086cf9 (patch) | |
tree | 74e4d87aaf729d63319cc69727ef73626203124f /channels | |
parent | ce9dac7be7e96b956b3ac85c69fe0425473fd8f1 (diff) |
Minor externip fixes (bug #3262)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4722 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 23b65087c..fdfec45e7 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -648,19 +648,19 @@ static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us) */ struct sockaddr_in theirs; theirs.sin_addr = *them; - if (externexpire && (time(NULL) >= externexpire)) { - struct ast_hostent ahp; - struct hostent *hp; - time(&externexpire); - externexpire += externrefresh; - if ((hp = ast_gethostbyname(externhost, &ahp))) { - memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip)); - } else - ast_log(LOG_NOTICE, "Warning: Re-lookup of '%s' failed!\n", externhost); - } if (localaddr && externip.sin_addr.s_addr && ast_apply_ha(localaddr, &theirs)) { char iabuf[INET_ADDRSTRLEN]; + if (externexpire && (time(NULL) >= externexpire)) { + struct ast_hostent ahp; + struct hostent *hp; + time(&externexpire); + externexpire += externrefresh; + if ((hp = ast_gethostbyname(externhost, &ahp))) { + memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr)); + } else + ast_log(LOG_NOTICE, "Warning: Re-lookup of '%s' failed!\n", externhost); + } memcpy(us, &externip.sin_addr, sizeof(struct in_addr)); ast_inet_ntoa(iabuf, sizeof(iabuf), *(struct in_addr *)&them->s_addr); ast_log(LOG_DEBUG, "Target address %s is not local, substituting externip\n", iabuf); |