diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-11-13 22:01:43 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-11-13 22:01:43 +0000 |
commit | 9975c86560ae5822678aef1b0da8754a1ea61fad (patch) | |
tree | 6e6239ed2c30646d791346d2310a7fa5d8d3bb4d /channels | |
parent | 33d77410813b13cad042910f1f58451635d07463 (diff) |
Merged revisions 230145 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r230145 | file | 2009-11-13 16:00:44 -0600 (Fri, 13 Nov 2009) | 15 lines
Merged revisions 230144 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r230144 | file | 2009-11-13 16:00:19 -0600 (Fri, 13 Nov 2009) | 8 lines
Respect the maddr parameter in the Via header.
(closes issue #14446)
Reported by: frawd
Patches:
via_maddr.patch uploaded by frawd (license 610)
Tested by: frawd
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@230148 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a4ea3ca9d..b36abecaf 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -13697,7 +13697,7 @@ static attribute_unused void check_via_response(struct sip_pvt *p, struct sip_re static void check_via(struct sip_pvt *p, struct sip_request *req) { char via[512]; - char *c, *pt; + char *c, *pt, *maddr; struct hostent *hp; struct ast_hostent ahp; @@ -13713,8 +13713,16 @@ static void check_via(struct sip_pvt *p, struct sip_request *req) if (c && (c[6] != '=')) /* rport query, not answer */ ast_set_flag(&p->flags[1], SIP_PAGE2_RPORT_PRESENT); + /* Check for maddr */ + maddr = strstr(via, "maddr="); + if (maddr) { + maddr += 6; + c = maddr + strspn(maddr, "0123456789."); + *c = '\0'; + } + c = strchr(via, ';'); - if (c) + if (c) *c = '\0'; c = strchr(via, ' '); @@ -13728,6 +13736,9 @@ static void check_via(struct sip_pvt *p, struct sip_request *req) pt = strchr(c, ':'); if (pt) *pt++ = '\0'; /* remember port pointer */ + /* Use maddr if found */ + if (maddr) + c = maddr; hp = ast_gethostbyname(c, &ahp); if (!hp) { ast_log(LOG_WARNING, "'%s' is not a valid host\n", c); |