aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-13 22:00:19 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-13 22:00:19 +0000
commit28512ee80df0cff878f6cd3facf22dd111ae1468 (patch)
tree8f8df28803365bb1ec365ff92228256041a72124 /channels
parent107993f4dbbcca602d0d68750882c82a4b59eecb (diff)
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.4@230144 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 87244ab2c..368de4b58 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9932,7 +9932,7 @@ static int get_also_info(struct sip_pvt *p, struct sip_request *oreq)
static void check_via(struct sip_pvt *p, const struct sip_request *req)
{
char via[512];
- char *c, *pt;
+ char *c, *pt, *maddr;
struct hostent *hp;
struct ast_hostent ahp;
@@ -9948,8 +9948,16 @@ static void check_via(struct sip_pvt *p, const 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, ' ');
@@ -9963,6 +9971,9 @@ static void check_via(struct sip_pvt *p, const 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);