[asterisk-commits] kmoore: branch 1.8 r373702 - /branches/1.8/res/res_rtp_asterisk.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 25 14:32:50 CDT 2012
Author: kmoore
Date: Tue Sep 25 14:32:46 2012
New Revision: 373702
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373702
Log:
Fix an issue where media would not flow for situations where the legacy STUN code is in use.
The STUN packets should *not* be blocked by strict RTP.
(closes issue ASTERISK-20415)
Reported-by: Michele Cicciotti
Patch-by: Josh Colp (trunk r369817)
Modified:
branches/1.8/res/res_rtp_asterisk.c
Modified: branches/1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_rtp_asterisk.c?view=diff&rev=373702&r1=373701&r2=373702
==============================================================================
--- branches/1.8/res/res_rtp_asterisk.c (original)
+++ branches/1.8/res/res_rtp_asterisk.c Tue Sep 25 14:32:46 2012
@@ -2157,39 +2157,6 @@
return &ast_null_frame;
}
- /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
- if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
- ast_debug(1, "%p -- start learning mode pass with addr = %s\n", rtp, ast_sockaddr_stringify(&addr));
- /* For now, we always copy the address. */
- ast_sockaddr_copy(&rtp->strict_rtp_address, &addr);
-
- /* Send the rtp and the seqno from header to rtp_learning_rtp_seq_update to see whether we can exit or not*/
- if (rtp_learning_rtp_seq_update(rtp, ntohl(rtpheader[0]))) {
- ast_debug(1, "%p -- Condition for learning hasn't exited, so reject the frame.\n", rtp);
- return &ast_null_frame;
- }
-
- ast_debug(1, "%p -- Probation Ended. Set strict_rtp_state to STRICT_RTP_CLOSED with address %s\n", rtp, ast_sockaddr_stringify(&addr));
- rtp->strict_rtp_state = STRICT_RTP_CLOSED;
- } else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
- if (ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
- /* Hmm, not the strict addres. Perhaps we're getting audio from the alternate? */
- if (!ast_sockaddr_cmp(&rtp->alt_rtp_address, &addr)) {
- /* ooh, we did! You're now the new expected address, son! */
- ast_sockaddr_copy(&rtp->strict_rtp_address,
- &addr);
- } else {
- const char *real_addr = ast_strdupa(ast_sockaddr_stringify(&addr));
- const char *expected_addr = ast_strdupa(ast_sockaddr_stringify(&rtp->strict_rtp_address));
-
- ast_debug(1, "Received RTP packet from %s, dropping due to strict RTP protection. Expected it to be from %s\n",
- real_addr, expected_addr);
-
- return &ast_null_frame;
- }
- }
- }
-
/* Get fields and verify this is an RTP packet */
seqno = ntohl(rtpheader[0]);
@@ -2215,6 +2182,39 @@
ast_rtp_instance_set_remote_address(instance, &addr);
}
return &ast_null_frame;
+ }
+
+ /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
+ if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
+ ast_debug(1, "%p -- start learning mode pass with addr = %s\n", rtp, ast_sockaddr_stringify(&addr));
+ /* For now, we always copy the address. */
+ ast_sockaddr_copy(&rtp->strict_rtp_address, &addr);
+
+ /* Send the rtp and the seqno from header to rtp_learning_rtp_seq_update to see whether we can exit or not*/
+ if (rtp_learning_rtp_seq_update(rtp, ntohl(rtpheader[0]))) {
+ ast_debug(1, "%p -- Condition for learning hasn't exited, so reject the frame.\n", rtp);
+ return &ast_null_frame;
+ }
+
+ ast_debug(1, "%p -- Probation Ended. Set strict_rtp_state to STRICT_RTP_CLOSED with address %s\n", rtp, ast_sockaddr_stringify(&addr));
+ rtp->strict_rtp_state = STRICT_RTP_CLOSED;
+ } else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
+ if (ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
+ /* Hmm, not the strict addres. Perhaps we're getting audio from the alternate? */
+ if (!ast_sockaddr_cmp(&rtp->alt_rtp_address, &addr)) {
+ /* ooh, we did! You're now the new expected address, son! */
+ ast_sockaddr_copy(&rtp->strict_rtp_address,
+ &addr);
+ } else {
+ const char *real_addr = ast_strdupa(ast_sockaddr_stringify(&addr));
+ const char *expected_addr = ast_strdupa(ast_sockaddr_stringify(&rtp->strict_rtp_address));
+
+ ast_debug(1, "Received RTP packet from %s, dropping due to strict RTP protection. Expected it to be from %s\n",
+ real_addr, expected_addr);
+
+ return &ast_null_frame;
+ }
+ }
}
/* If symmetric RTP is enabled see if the remote side is not what we expected and change where we are sending audio */
More information about the asterisk-commits
mailing list