From 01a0d0b5e9473aca495a21258a90e5342bba7e4a Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 11 Nov 2016 07:20:25 +0000 Subject: [PATCH] Clean up the TG rewrite code. --- DMRAccessControl.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/DMRAccessControl.cpp b/DMRAccessControl.cpp index 0ac0736..89f59f1 100644 --- a/DMRAccessControl.cpp +++ b/DMRAccessControl.cpp @@ -213,32 +213,31 @@ unsigned int CDMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid, time_t currenttime = ::time(NULL); if (network) { - m_dstRewriteID[slot - 1U] = did; m_srcID[slot - 1U] = sid; - //not needed at present - for direct dial, which requires change at master end. + // Not needed at present - for direct dial, which requires change at master end. //memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC)); - if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP ) { - LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9",slot,did); + if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP) { + LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9", slot, did); return 9U; - // rewrite incoming BM voice prompts to TG 9 + // Rewrite incoming BM voice prompts to TG 9 } else if (m_bmRewriteReflectorVoicePrompts && (sid >= 4000U && sid <= 5000U) && dmrLC->getFLCO() == FLCO_USER_USER) { dmrLC->setFLCO(FLCO_GROUP); - LogMessage("DMR Slot %u, Rewrite inbound private call to %u to Group Call on TG 9 (BM reflector voice prompt)",slot,did); + LogMessage("DMR Slot %u, Rewrite inbound private call to %u to Group Call on TG 9 (BM reflector voice prompt)", slot, did); return 9U; } else { return 0U; } - } else if (m_bmAutoRewrite && did == 9U && m_dstRewriteID[slot - 1U] != 9U && m_dstRewriteID[slot - 1U] != 0U && (m_time[slot - 1U] + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP ) { - LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)",slot,did,m_dstRewriteID[slot - 1]); + } else if (m_bmAutoRewrite && did == 9U && m_dstRewriteID[slot - 1U] != 9U && m_dstRewriteID[slot - 1U] != 0U && (m_time[slot - 1U] + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP) { + LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)", slot, did, m_dstRewriteID[slot - 1U]); return m_dstRewriteID[slot - 1U]; } else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && did != 9990U && did < 99999U && dmrLC->getFLCO() == FLCO_USER_USER) { m_dstRewriteID[slot - 1U] = did; dmrLC->setFLCO(FLCO_GROUP); - LogMessage("DMR Slot %u, Rewrite outbound private call to %u Group Call (Connect talkgroup by private call)",slot,did); + LogMessage("DMR Slot %u, Rewrite outbound private call to %u Group Call (Connect talkgroup by private call)", slot, did); return did; - } else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && did > 99999U) { + } else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && did != 9990U && did > 99999U) { m_dstRewriteID[slot - 1U] = did; }