[Asterisk-cvs] asterisk/channels chan_sip.c,1.437,1.438

markster at lists.digium.com markster at lists.digium.com
Thu Jul 8 03:36:05 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv2264/channels

Modified Files:
	chan_sip.c 
Log Message:
When doing rport, remove the ";rport" before adding ";rport=5060"


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.437
retrieving revision 1.438
diff -u -d -r1.437 -r1.438
--- chan_sip.c	7 Jul 2004 16:02:13 -0000	1.437
+++ chan_sip.c	8 Jul 2004 07:21:52 -0000	1.438
@@ -2843,14 +2843,24 @@
 /*--- copy_via_headers: Copy SIP VIA Headers from one request to another ---*/
 static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, struct sip_request *orig, char *field)
 {
-	char *tmp;
+	char tmp[256]="", *oh, *end;
 	int start = 0;
 	int copied = 0;
 	char new[256];
 	char iabuf[INET_ADDRSTRLEN];
 	for (;;) {
-		tmp = __get_header(orig, field, &start);
-		if (!ast_strlen_zero(tmp)) {
+		oh = __get_header(orig, field, &start);
+		if (!ast_strlen_zero(oh)) {
+			/* Strip ;rport */
+			strncpy(tmp, oh, sizeof(tmp) - 1);
+			oh = strstr(tmp, ";rport");
+			if (oh) {
+				end = strchr(oh + 1, ';');
+				if (end)
+					memmove(oh, end, strlen(end) + 1);
+				else
+					*oh = '\0';
+			}
 			if (!copied && (p->nat == SIP_NAT_ALWAYS)) {
 				/* Whoo hoo!  Now we can indicate port address translation too!  Just
 				   another RFC (RFC3581). I'll leave the original comments in for




More information about the svn-commits mailing list