From 6d22af9566d71b3e1e160799c75e1fa9eb3eadd3 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 9 Jan 2020 12:40:30 -0500 Subject: [PATCH] TT#73900 ignore stray RTCP packets when confirming peer addresses fixes #697 Change-Id: Id2fdbd1b0b419b7fcc032c865a62a7ceed84f9f3 --- daemon/media_socket.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 8c8015215..10e28fc65 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1532,6 +1532,18 @@ static int media_packet_address_check(struct packet_handler_ctx *phc) goto out; } + // GH #697 - apparent Asterisk bug where it sends stray RTCP to the RTP port. + // work around this by detecting this situation and ignoring the packet for + // confirmation purposes when needed. This is regardless of whether rtcp-mux + // is enabled or not. + if (!PS_ISSET(phc->mp.stream, CONFIRMED) && PS_ISSET(phc->mp.stream, RTP)) { + if (rtcp_demux_is_rtcp(&phc->s)) { + ilog(LOG_DEBUG | LOG_FLAG_LIMIT, "Ignoring stray RTCP packet for " + "peer address confirmation purposes"); + goto out; + } + } + /* do not pay attention to source addresses of incoming packets for asymmetric streams */ if (MEDIA_ISSET(phc->mp.media, ASYMMETRIC) || rtpe_config.endpoint_learning == EL_OFF) PS_SET(phc->mp.stream, CONFIRMED);