[asterisk-commits] kpfleming: branch 1.2 r41716 - in /branches/1.2: ./ channels/ include/asterisk/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Sep 1 10:35:06 MST 2006


Author: kpfleming
Date: Fri Sep  1 12:35:06 2006
New Revision: 41716

URL: http://svn.digium.com/view/asterisk?rev=41716&view=rev
Log:
put in proper fix for issue #7294 instead of the broken partial fix that was committed, and thereby also fix issue #7438

Modified:
    branches/1.2/channels/chan_sip.c
    branches/1.2/include/asterisk/rtp.h
    branches/1.2/rtp.c

Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=41716&r1=41715&r2=41716&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Fri Sep  1 12:35:06 2006
@@ -12931,21 +12931,25 @@
 static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active)
 {
 	struct sip_pvt *p;
+	int changed = 0;
 
 	p = chan->tech_pvt;
 	if (!p) 
 		return -1;
 	ast_mutex_lock(&p->lock);
 	if (rtp)
-		ast_rtp_get_peer(rtp, &p->redirip);
+		changed |= ast_rtp_get_peer(rtp, &p->redirip);
 	else
 		memset(&p->redirip, 0, sizeof(p->redirip));
 	if (vrtp)
-		ast_rtp_get_peer(vrtp, &p->vredirip);
+		changed |= ast_rtp_get_peer(vrtp, &p->vredirip);
 	else
 		memset(&p->vredirip, 0, sizeof(p->vredirip));
-	p->redircodecs = codecs;
-	if (codecs && !ast_test_flag(p, SIP_GOTREFER)) {
+	if (codecs && (p->redircodecs != codecs)) {
+		p->redircodecs = codecs;
+		changed = 1;
+	}
+	if (changed && !ast_test_flag(p, SIP_GOTREFER)) {
 		if (!p->pendinginvite) {
 			if (option_debug > 2) {
 				char iabuf[INET_ADDRSTRLEN];

Modified: branches/1.2/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/include/asterisk/rtp.h?rev=41716&r1=41715&r2=41716&view=diff
==============================================================================
--- branches/1.2/include/asterisk/rtp.h (original)
+++ branches/1.2/include/asterisk/rtp.h Fri Sep  1 12:35:06 2006
@@ -96,7 +96,7 @@
 
 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
 
-void ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
+int ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
 
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us);
 

Modified: branches/1.2/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/rtp.c?rev=41716&r1=41715&r2=41716&view=diff
==============================================================================
--- branches/1.2/rtp.c (original)
+++ branches/1.2/rtp.c Fri Sep  1 12:35:06 2006
@@ -1041,11 +1041,17 @@
 	rtp->rxseqno = 0;
 }
 
-void ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
-{
-	them->sin_family = AF_INET;
-	them->sin_port = rtp->them.sin_port;
-	them->sin_addr = rtp->them.sin_addr;
+int ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
+{
+	if ((them->sin_family != AF_INET) ||
+	    (them->sin_port != rtp->them.sin_port) ||
+	    (them->sin_addr.s_addr != rtp->them.sin_addr.s_addr)) {
+		them->sin_family = AF_INET;
+		them->sin_port = rtp->them.sin_port;
+		them->sin_addr = rtp->them.sin_addr;
+		return 1;
+	}
+	return 0;
 }
 
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us)



More information about the asterisk-commits mailing list