diff -Nur asterisk-cvs/channels/chan_sip.c asterisk/channels/chan_sip.c --- asterisk-cvs/channels/chan_sip.c 2005-01-09 01:37:55.000000000 +0100 +++ asterisk/channels/chan_sip.c 2005-01-09 01:36:37.000000000 +0100 @@ -648,18 +648,18 @@ */ 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)) { + 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); + } char iabuf[INET_ADDRSTRLEN]; memcpy(us, &externip.sin_addr, sizeof(struct in_addr)); ast_inet_ntoa(iabuf, sizeof(iabuf), *(struct in_addr *)&them->s_addr);