aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-07 21:30:19 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-07 21:30:19 +0000
commit649342bdb36fc0f3cd346ae2ad8352ef29aa06c8 (patch)
treea40c9e9222f995e798bef9accd5c7936c39767d1 /channels
parenta2a72bc5953ece7786b2795336f5b67683fa4bf9 (diff)
Handle swapout of "fromdomain" in callid properly (bug #6154)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7861 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 027f10081..39b5c2352 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1830,8 +1830,6 @@ static struct sip_user *find_user(const char *name, int realtime)
/*! \brief create_addr_from_peer: create address structure from peer reference ---*/
static int create_addr_from_peer(struct sip_pvt *r, struct sip_peer *peer)
{
- char *callhost;
-
if ((peer->addr.sin_addr.s_addr || peer->defaddr.sin_addr.s_addr) &&
(!peer->maxms || ((peer->lastms >= 0) && (peer->lastms <= peer->maxms)))) {
if (peer->addr.sin_addr.s_addr) {
@@ -1867,8 +1865,15 @@ static int create_addr_from_peer(struct sip_pvt *r, struct sip_peer *peer)
ast_string_field_set(r, tohost, peer->tohost);
ast_string_field_set(r, fullcontact, peer->fullcontact);
if (!r->initreq.headers && !ast_strlen_zero(peer->fromdomain)) {
- if ((callhost = strchr(r->callid, '@'))) {
- strncpy(callhost + 1, peer->fromdomain, sizeof(r->callid) - (callhost - r->callid) - 2);
+ char *tmpcall;
+ char *c;
+ tmpcall = ast_strdupa(r->callid);
+ if (tmpcall) {
+ c = strchr(tmpcall, '@');
+ if (c) {
+ *c = '\0';
+ ast_string_field_build(r, callid, "%s@%s", tmpcall, peer->fromdomain);
+ }
}
}
if (ast_strlen_zero(r->tohost)) {