From 07edd0dbff9869040c3e2a97f698509a2d0de12a Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Thu, 13 Mar 2025 09:22:55 -0400 Subject: [PATCH] handle illegal call end properly; --- src/bridge/HostBridge.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/bridge/HostBridge.cpp b/src/bridge/HostBridge.cpp index 6aa134ca..4bd93296 100644 --- a/src/bridge/HostBridge.cpp +++ b/src/bridge/HostBridge.cpp @@ -1256,13 +1256,19 @@ void HostBridge::processUDPAudio() if (m_overrideSrcIdFromUDP) { uint32_t udpSrcId = __GET_UINT32(buffer, pcmLength + 8U); - // if the UDP source ID now doesn't match the current call ID, reset call states - if (m_resetCallForSourceIdChange && (udpSrcId != m_udpSrcId)) { - callEnd(m_udpSrcId, m_dstId); - m_udpDstId = m_dstId; - } + if (udpSrcId != 0U) { + // if the UDP source ID now doesn't match the current call ID, reset call states + if (m_resetCallForSourceIdChange && (udpSrcId != m_udpSrcId)) { + callEnd(m_udpSrcId, m_dstId); + m_udpDstId = m_dstId; + } - m_udpSrcId = udpSrcId; + m_udpSrcId = udpSrcId; + } else { + if (m_udpSrcId == 0U) { + m_udpSrcId = m_srcId; + } + } } } else { m_udpSrcId = m_srcId; @@ -2557,6 +2563,11 @@ void HostBridge::callEnd(uint32_t srcId, uint32_t dstId) trafficType = UDP_CALL; } + if (srcId == 0U && !m_audioDetect && !m_dropTime.isRunning()) { + LogError(LOG_HOST, "%s, call end, ignoring invalid call end, srcId = %u, dstId = %u", trafficType.c_str(), srcId, dstId); + return; + } + LogMessage(LOG_HOST, "%s, call end, srcId = %u, dstId = %u", trafficType.c_str(), srcId, dstId); m_audioDetect = false;