diff --git a/src/p25/Control.cpp b/src/p25/Control.cpp index bb126dc9..f05da4c6 100644 --- a/src/p25/Control.cpp +++ b/src/p25/Control.cpp @@ -828,10 +828,12 @@ void Control::clock(uint32_t ms) if (m_netState == RS_NET_AUDIO || m_netState == RS_NET_DATA) { m_networkWatchdog.clock(ms); - if (m_networkWatchdog.hasExpired()) { + if (m_networkWatchdog.isRunning() && m_networkWatchdog.hasExpired()) { if (m_netState == RS_NET_AUDIO) { - ::ActivityLog("P25", false, "network watchdog has expired, %.1f seconds, %u%% packet loss", - float(m_voice->m_netFrames) / 50.0F, (m_voice->m_netLost * 100U) / m_voice->m_netFrames); + if (m_voice->m_netFrames > 0.0F) { + ::ActivityLog("P25", false, "network watchdog has expired, %.1f seconds, %u%% packet loss", + float(m_voice->m_netFrames) / 50.0F, (m_voice->m_netLost * 100U) / m_voice->m_netFrames); + } } else { ::ActivityLog("P25", false, "network watchdog has expired"); diff --git a/src/p25/packet/Trunk.cpp b/src/p25/packet/Trunk.cpp index 695848d9..10088ca4 100644 --- a/src/p25/packet/Trunk.cpp +++ b/src/p25/packet/Trunk.cpp @@ -2132,6 +2132,25 @@ bool Trunk::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_t serviceOp return true; // do not generate grant packets for $FFFF (All Call) TGID } + // are network channel grants disabled? + if (m_p25->m_disableNetworkGrant) { + // don't process RF grant if the network isn't in a idle state and the RF destination is the network destination + if (m_p25->m_netState != RS_NET_IDLE && dstId == m_p25->m_netLastDstId) { + LogWarning(LOG_RF, "Traffic collision detect, preempting new RF traffic to existing network traffic!"); + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic collision, dstId = %u", dstId); + writeRF_TSDU_Deny(srcId, dstId, P25_DENY_RSN_PTT_COLLIDE, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + + ::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId); + m_p25->m_rfState = RS_RF_REJECTED; + return false; + } + + // ensure network watchdog is stopped + if (m_p25->m_networkWatchdog.isRunning()) { + m_p25->m_networkWatchdog.stop(); + } + } + // are we skipping checking? if (!skip) { if (m_p25->m_rfState != RS_RF_LISTENING && m_p25->m_rfState != RS_RF_DATA) { diff --git a/src/p25/packet/Voice.cpp b/src/p25/packet/Voice.cpp index b65f0db0..cff54eff 100644 --- a/src/p25/packet/Voice.cpp +++ b/src/p25/packet/Voice.cpp @@ -96,6 +96,7 @@ void Voice::resetNet() m_netLost = 0U; m_vocLDU1Count = 0U; m_roamLDU1Count = 0U; + m_p25->m_networkWatchdog.stop(); } ///