From 2b63866f42bcaf31e5a68073e36678cf4e2080f5 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Mon, 16 Nov 2026 16:52:30 -0500 Subject: [PATCH] ensure telephone calls stop upstream repetition of call frames if the call stream is sent to a local peer; --- src/fne/network/callhandler/TagP25Data.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/fne/network/callhandler/TagP25Data.cpp b/src/fne/network/callhandler/TagP25Data.cpp index fda6de12..3f1f7d16 100644 --- a/src/fne/network/callhandler/TagP25Data.cpp +++ b/src/fne/network/callhandler/TagP25Data.cpp @@ -691,6 +691,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId bool noConnectedPeerRepeat = false; bool privateCallInProgress = false; bool telInt = isTelIntTraffic(control, duid, tsbk.get()); + bool telIntRoutedToConnectedPeer = false; // is this a private call in-progress? if (m_network->m_privateCallRoutingEnabled) { @@ -812,6 +813,13 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId // perform TGID route rewrites if configured routeRewrite(outboundPeerBuffer, peer.first, duid, dstId); + // check if this traffic is routed through the telephone interconnect gateway + if (telInt && isTelIntGateway(ssrc)) { + uint32_t sitePeerId = conn->ccPeerId() > 0U ? conn->ccPeerId() : peer.first; + if (sitePeerId == m_network->findPeerUnitReg(dstId)) + telIntRoutedToConnectedPeer = true; + } + m_network->writePeerQueue(&queue, peer.first, ssrc, { NET_FUNC::PROTOCOL, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25 }, outboundPeerBuffer, len, pktSeq, streamId); if (m_debug) { LogDebugEx(LOG_P25, "TagP25Data::processFrame()", "Master, ssrc = %u, srcPeer = %u, dstPeer = %u, duid = $%02X, lco = $%02X, MFId = $%02X, srcId = %u, dstId = %u, len = %u, pktSeq = %u, streamId = %u, fromUpstream = %u, pci = %u, ncpr = %u", @@ -830,6 +838,12 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId return true; } + // like a private call, stop after delivering gateway traffic to the + // directly connected site selected by the unit-route registry + if (telIntRoutedToConnectedPeer) { + return true; + } + /* ** PEER TRAFFIC (e.g. upstream networks this FNE is peered to) */ @@ -852,6 +866,12 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId continue; } + // Apply the same gateway and unit-route policy to upstream + // peers that is used for peers connected to this master. + if (telInt && !isTelIntPeerPermitted(ssrc, dstPeerId, nullptr, dstId)) { + continue; + } + // is this peer ignored? if (!isPeerPermitted(dstPeerId, control, duid, streamId, true)) { continue;