diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 08a33d8876..74871304b3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1771,14 +1771,16 @@ static void build_via(struct sip_pvt *p) */ static enum sip_result ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us) { - struct sockaddr_in theirs; + struct sockaddr_in theirs, ours; /* Get our local information */ ast_ouraddrfor(them, us); theirs.sin_addr = *them; + ours.sin_addr = *us; if (localaddr && externip.sin_addr.s_addr && - ast_apply_ha(localaddr, &theirs)) { + (ast_apply_ha(localaddr, &theirs)) && + (!ast_apply_ha(localaddr, &ours))) { if (externexpire && time(NULL) >= externexpire) { struct ast_hostent ahp; struct hostent *hp;