[svn-commits] file: branch 1.4 r230144 - /branches/1.4/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 13 16:00:25 CST 2009


Author: file
Date: Fri Nov 13 16:00:19 2009
New Revision: 230144

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230144
Log:
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

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=230144&r1=230143&r2=230144
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Fri Nov 13 16:00:19 2009
@@ -9932,7 +9932,7 @@
 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 @@
 	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 @@
 		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);




More information about the svn-commits mailing list