From: Mark Spencer Date: Mon, 13 Sep 2004 12:24:38 +0000 (+0000) Subject: Use fromdomain in creating callid if specified (bug #2427) X-Git-Tag: 1.0.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89447a99ec743f56e4aee15fe5e61278561b648c;p=thirdparty%2Fasterisk.git Use fromdomain in creating callid if specified (bug #2427) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3769 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 632b0711ce..832dfb0635 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1261,6 +1261,7 @@ static int create_addr(struct sip_pvt *r, char *opeer) struct sip_peer *p; int found=0; char *port; + char *callhost; int portno; char host[256], *hostn; char peer[256]=""; @@ -1294,6 +1295,11 @@ static int create_addr(struct sip_pvt *r, char *opeer) strncpy(r->username, p->username, sizeof(r->username)-1); strncpy(r->tohost, p->tohost, sizeof(r->tohost)-1); strncpy(r->fullcontact, p->fullcontact, sizeof(r->fullcontact)-1); + if (!r->initreq.headers && !ast_strlen_zero(p->fromdomain)) { + if ((callhost = strchr(r->callid, '@'))) { + strncpy(callhost + 1, p->fromdomain, sizeof(r->callid) - (callhost - r->callid) - 2); + } + } if (ast_strlen_zero(r->tohost)) { if (p->addr.sin_addr.s_addr) ast_inet_ntoa(r->tohost, sizeof(r->tohost), p->addr.sin_addr);