Skip to content

Commit

Permalink
fix media loop on half port-detected channel when media is very early
Browse files Browse the repository at this point in the history
  • Loading branch information
willamowius committed Jun 23, 2021
1 parent 30e05e7 commit 8f7386e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ProxyChannel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "GkStatus.h"
#include <queue>
#include <math.h> // needed for ceil() on Solaris 11, OpenBSD
#include <algorithm>

#ifdef HAS_AVAYA_SUPPORT
#include "avaya.h"
Expand Down Expand Up @@ -13837,6 +13838,14 @@ void UDPProxySocket::SetForwardDestination(const Address & srcIP, WORD srcPort,
PTRACE(7, "JW RTP skip overwriting due to completed port detection");
return;
}

// doing port detection and forward source is already set (probably by port detection) and set to same as forward dest -> swap the directions (OR skip the setting ?)
H245_UnicastAddress fSrc = SocketToH245UnicastAddr(fSrcIP, fSrcPort); // for easy comparison
if (m_ignoreSignaledIPs && fSrc == *dstAddr) {
PTRACE(7, "JW RTP swap directions before SetForwardDestination to avoid loop");
swap(fSrcIP, rSrcIP); swap(fSrcPort, rSrcPort);
swap(fDestIP, rDestIP); swap(fDestPort, rDestPort);
}
#endif

if (!onlySetDest) {
Expand Down Expand Up @@ -13894,6 +13903,14 @@ void UDPProxySocket::SetReverseDestination(const Address & srcIP, WORD srcPort,
PTRACE(7, "JW RTP skip overwriting due to completed port detection");
return;
}

// doing port detection and reverse source is already set (probably by port detection) and set to same as reverse dest -> swap the directions (OR skip the setting ?)
H245_UnicastAddress rSrc = SocketToH245UnicastAddr(rSrcIP, rSrcPort); // for easy comparison
if (m_ignoreSignaledIPs && rSrc == *dstAddr) {
PTRACE(7, "JW RTP swap directions before SetReverseDestination to avoid loop");
swap(fSrcIP, rSrcIP); swap(fSrcPort, rSrcPort);
swap(fDestIP, rDestIP); swap(fDestPort, rDestPort);
}
#endif

if (!onlySetDest) {
Expand Down Expand Up @@ -14151,7 +14168,7 @@ ProxySocket::Result UDPProxySocket::ReceiveData()
}

if (m_ignoreSignaledIPs && !m_portDetectionDone) {
//// learn from data we already have (eg. from H.239 signaling)
//// learn from data we already have (eg. from signaling)
// set known destination as assumed source
if (fSrcIP == 0 && rSrcIP == 0 && fDestIP != 0) {
rSrcIP = fDestIP, rSrcPort = fDestPort;
Expand Down
1 change: 1 addition & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Changes from 5.7 to 5.8
=======================
- BUGFIX(ProxyChannel.cxx) fix media loop on half port-detected channel when media is very early
- new switches to set the HTTP Content-Type header: [HttpAcct] ContentType=, [HttpPasswordAuth] ContentType=
and [Routing::Http] ContentType=
- new switch [Proxy] AllowAnyRTPSourcePortForH239From= to handle incorrect RTCP addresses in H.239 OLC (EdgeProtect interop)
Expand Down

0 comments on commit 8f7386e

Please sign in to comment.