[Asterisk-cvs] asterisk/channels chan_sip.c,1.439,1.440

markster at lists.digium.com markster at lists.digium.com
Thu Jul 8 08:00:28 CDT 2004


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

Modified Files:
	chan_sip.c 
Log Message:
Extend bindaddr to RTP connections on SIP (bug #1989 et al)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.439
retrieving revision 1.440
diff -u -d -r1.439 -r1.440
--- chan_sip.c	8 Jul 2004 11:05:03 -0000	1.439
+++ chan_sip.c	8 Jul 2004 11:46:15 -0000	1.440
@@ -2222,9 +2222,16 @@
 #ifdef OSP_SUPPORT
 	p->osphandle = -1;
 #endif	
-	p->rtp = ast_rtp_new(sched, io, 1, 0);
+	if (sin) {
+		memcpy(&p->sa, sin, sizeof(p->sa));
+		if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))
+			memcpy(&p->ourip, &__ourip, sizeof(p->ourip));
+	} else {
+		memcpy(&p->ourip, &__ourip, sizeof(p->ourip));
+	}
+	p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, p->ourip);
 	if (videosupport)
-		p->vrtp = ast_rtp_new(sched, io, 1, 0);
+		p->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, p->ourip);
 	p->branch = rand();	
 	p->tag = rand();
 	
@@ -2248,13 +2255,6 @@
 			ast_rtp_setnat(p->vrtp, (p->nat == SIP_NAT_ALWAYS));
 	}
 
-	if (sin) {
-		memcpy(&p->sa, sin, sizeof(p->sa));
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))
-			memcpy(&p->ourip, &__ourip, sizeof(p->ourip));
-	} else {
-		memcpy(&p->ourip, &__ourip, sizeof(p->ourip));
-	}
 	/* z9hG4bK is a magic cookie.  See RFC 3261 section 8.1.1.7 */
 	if (p->nat != SIP_NAT_NEVER)
 		snprintf(p->via, sizeof(p->via), "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x;rport", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport, p->branch);




More information about the svn-commits mailing list