diff --git a/p25/TrunkPacket.cpp b/p25/TrunkPacket.cpp index d37d0f38..af704526 100644 --- a/p25/TrunkPacket.cpp +++ b/p25/TrunkPacket.cpp @@ -337,7 +337,7 @@ bool TrunkPacket::process(uint8_t* data, uint32_t len) LogMessage(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request), srcId = %u, dstId = %u", srcId, dstId); } - writeRF_TSDU_Grant(true, false); + writeRF_TSDU_Grant(true, false, false); break; case TSBK_IOSP_UU_VCH: // make sure control data is supported @@ -378,7 +378,7 @@ bool TrunkPacket::process(uint8_t* data, uint32_t len) } if (m_rfTSBK.getResponse() == P25_ANS_RSP_PROCEED) { - writeRF_TSDU_Grant(false, false); + writeRF_TSDU_Grant(false, false, false); } else if (m_rfTSBK.getResponse() == P25_ANS_RSP_DENY) { writeRF_TSDU_Deny(P25_DENY_RSN_TGT_UNIT_REFUSED, TSBK_IOSP_UU_ANS); @@ -1928,8 +1928,9 @@ void TrunkPacket::queueRF_TSBK_Ctrl_MBF(uint8_t lco) /// /// /// +/// /// -bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) +bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip, bool net) { uint8_t lco = m_rfTSBK.getLCO(); @@ -1940,22 +1941,26 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) // are we skipping checking? if (!skip) { if (m_p25->m_rfState != RS_RF_LISTENING && m_p25->m_rfState != RS_RF_DATA) { - LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", m_rfTSBK.getDstId()); - writeRF_TSDU_Deny(P25_DENY_RSN_PTT_COLLIDE, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + if (!net) { + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", m_rfTSBK.getDstId()); + writeRF_TSDU_Deny(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", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); - m_p25->m_rfState = RS_RF_REJECTED; + ::ActivityLog("P25", true, "group grant request from %u to TG %u denied", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + m_p25->m_rfState = RS_RF_REJECTED; + } m_rfTSBK.setLCO(lco); return false; } if (m_p25->m_netState != RS_NET_IDLE && m_rfTSBK.getDstId() == m_p25->m_netLastDstId) { - LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", m_rfTSBK.getDstId()); - writeRF_TSDU_Deny(P25_DENY_RSN_PTT_COLLIDE, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + if (!net) { + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", m_rfTSBK.getDstId()); + writeRF_TSDU_Deny(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", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); - m_p25->m_rfState = RS_RF_REJECTED; + ::ActivityLog("P25", true, "group grant request from %u to TG %u denied", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + m_p25->m_rfState = RS_RF_REJECTED; + } m_rfTSBK.setLCO(lco); return false; @@ -1964,8 +1969,11 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) // don't transmit grants if the destination ID's don't match and the network TG hang timer is running if (m_p25->m_rfLastDstId != 0U) { if (m_p25->m_rfLastDstId != m_rfTSBK.getDstId() && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { - writeRF_TSDU_Deny(P25_DENY_RSN_PTT_BONK, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); - m_p25->m_rfState = RS_RF_REJECTED; + if (!net) { + writeRF_TSDU_Deny(P25_DENY_RSN_PTT_BONK, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + m_p25->m_rfState = RS_RF_REJECTED; + } + m_rfTSBK.setLCO(lco); return false; } @@ -1974,21 +1982,25 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) if (!hasDstIdGranted(m_rfTSBK.getDstId())) { if (m_voiceChTable.empty()) { if (grp) { - LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) queued, no channels available, dstId = %u", m_rfTSBK.getDstId()); - writeRF_TSDU_Queue(P25_QUE_RSN_CHN_RESOURCE_NOT_AVAIL, TSBK_IOSP_GRP_VCH); + if (!net) { + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) queued, no channels available, dstId = %u", m_rfTSBK.getDstId()); + writeRF_TSDU_Queue(P25_QUE_RSN_CHN_RESOURCE_NOT_AVAIL, TSBK_IOSP_GRP_VCH); - ::ActivityLog("P25", true, "group grant request from %u to TG %u queued", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); - m_p25->m_rfState = RS_RF_REJECTED; + ::ActivityLog("P25", true, "group grant request from %u to TG %u queued", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + m_p25->m_rfState = RS_RF_REJECTED; + } m_rfTSBK.setLCO(lco); return false; } else { - LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_UU_VCH (Unit-to-Unit Voice Channel Request) queued, no channels available, dstId = %u", m_rfTSBK.getDstId()); - writeRF_TSDU_Queue(P25_QUE_RSN_CHN_RESOURCE_NOT_AVAIL, TSBK_IOSP_UU_VCH); + if (!net) { + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_UU_VCH (Unit-to-Unit Voice Channel Request) queued, no channels available, dstId = %u", m_rfTSBK.getDstId()); + writeRF_TSDU_Queue(P25_QUE_RSN_CHN_RESOURCE_NOT_AVAIL, TSBK_IOSP_UU_VCH); - ::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u queued", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); - m_p25->m_rfState = RS_RF_REJECTED; + ::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u queued", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + m_p25->m_rfState = RS_RF_REJECTED; + } m_rfTSBK.setLCO(lco); return false; @@ -2018,7 +2030,9 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) } if (grp) { - ::ActivityLog("P25", true, "group grant request from %u to TG %u", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + if (!net) { + ::ActivityLog("P25", true, "group grant request from %u to TG %u", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + } if (m_verbose) { LogMessage(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Grant), emerg = %u, encrypt = %u, prio = %u, chNo = %u, srcId = %u, dstId = %u", @@ -2030,7 +2044,9 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip) writeRF_TSDU_SBF(true, true); } else { - ::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + if (!net) { + ::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u", m_rfTSBK.getSrcId(), m_rfTSBK.getDstId()); + } if (m_verbose) { LogMessage(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_UU_VCH (Unit-to-Unit Voice Channel Grant), emerg = %u, encrypt = %u, prio = %u, chNo = %u, srcId = %u, dstId = %u", diff --git a/p25/TrunkPacket.h b/p25/TrunkPacket.h index 1a3911eb..4b4b59ff 100644 --- a/p25/TrunkPacket.h +++ b/p25/TrunkPacket.h @@ -213,11 +213,11 @@ namespace p25 void queueRF_TSBK_Ctrl_MBF(uint8_t lco); /// Helper to write a grant packet. - bool writeRF_TSDU_Grant(bool grp, bool skip); + bool writeRF_TSDU_Grant(bool grp, bool skip, bool net); /// Helper to write a unit to unit answer request packet. void writeRF_TSDU_UU_Ans_Req(uint32_t srcId, uint32_t dstId); /// Helper to write a acknowledge packet. - void writeRF_TSDU_ACK_FNE(uint32_t srcId, uint32_t service, bool extended, bool noNetwork); + void writeRF_TSDU_ACK_FNE(uint32_t srcId, uint32_t service, bool extended, bool noActivityLog); /// Helper to write a deny packet. void writeRF_TSDU_Deny(uint8_t reason, uint8_t service); /// Helper to write a group affiliation response packet. diff --git a/p25/VoicePacket.cpp b/p25/VoicePacket.cpp index a9e5212e..2742eacb 100644 --- a/p25/VoicePacket.cpp +++ b/p25/VoicePacket.cpp @@ -316,7 +316,7 @@ bool VoicePacket::process(uint8_t* data, uint32_t len) } } - if (!m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), false)) { + if (!m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), false, false)) { return false; } } @@ -329,7 +329,7 @@ bool VoicePacket::process(uint8_t* data, uint32_t len) // single-channel trunking or voice on control support? if (m_p25->m_control && m_p25->m_voiceOnControl) { m_p25->m_ccRunning = false; // otherwise the grant will be bundled with other packets - m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true); + m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true, false); } m_p25->m_trunk->writeRF_TDULC_ChanGrant(m_rfLC.getGroup(), srcId, dstId); @@ -1104,7 +1104,7 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData& m_lastPatchGroup = dstId; } - if (!m_p25->m_trunk->writeRF_TSDU_Grant(group, false)) { + if (!m_p25->m_trunk->writeRF_TSDU_Grant(group, false, true)) { if (m_network != NULL) m_network->resetP25(); @@ -1127,7 +1127,7 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData& // single-channel trunking or voice on control support? if (m_p25->m_control && m_p25->m_voiceOnControl) { m_p25->m_ccRunning = false; // otherwise the grant will be bundled with other packets - m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true); + m_p25->m_trunk->writeRF_TSDU_Grant(m_rfLC.getGroup(), true, true); } m_p25->m_trunk->writeRF_TDULC_ChanGrant(group, srcId, dstId);