aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-05-03 03:29:58 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-05-03 03:29:58 +0000
commitf02a06d64b0415c568e5131808d8fc3526a99e2f (patch)
tree54b5657b3830d95ece3a0a9d792629a5054ad8bb /channels/chan_sip.c
parent69841867537dfa3d428ff5006c5f4a76a4a781ab (diff)
Build tohost on options
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@952 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rwxr-xr-xchannels/chan_sip.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 74ae10c48..10f2075cf 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4740,7 +4740,10 @@ static int sip_poke_peer(struct sip_peer *peer)
}
memcpy(&p->sa, &peer->addr, sizeof(p->sa));
memcpy(&p->recv, &peer->addr, sizeof(p->sa));
- strncpy(p->tohost, peer->tohost, sizeof(p->tohost) - 1);
+ if (strlen(p->tohost))
+ strncpy(p->tohost, peer->tohost, sizeof(p->tohost) - 1);
+ else
+ snprintf(p->tohost, sizeof(p->tohost), "%s", inet_ntoa(p->addr.sin_addr));
/* Recalculate our side, and recalculate Call ID */
memcpy(&p->ourip, myaddrfor(&p->sa.sin_addr), sizeof(p->ourip));