diff --git a/DMRAccessControl.cpp b/DMRAccessControl.cpp index bc19efd..38db7a6 100644 --- a/DMRAccessControl.cpp +++ b/DMRAccessControl.cpp @@ -39,12 +39,12 @@ bool DMRAccessControl::m_selfOnly = false; unsigned int DMRAccessControl::m_id = 0U; -unsigned int DMRAccessControl::m_dstRewriteID = 0U; -unsigned int DMRAccessControl::m_srcID = 0U; +unsigned int DMRAccessControl::m_dstRewriteID[2]; +unsigned int DMRAccessControl::m_srcID[2]; CDMRLC* DMRAccessControl::m_lastdmrLC; -time_t DMRAccessControl::m_time; +time_t DMRAccessControl::m_time[2]; int DMRAccessControl::m_callHang; @@ -213,8 +213,9 @@ unsigned int DMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid, time_t currenttime = ::time(NULL); if (network) { - m_dstRewriteID = did; - m_srcID = sid; + + m_dstRewriteID[slot - 1U] = did; + m_srcID[slot - 1U] = sid; //not needed at present - for direct dial, which requires change at master end. //memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC)); @@ -229,22 +230,22 @@ unsigned int DMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid, } else { return 0U; } - } else if (m_bmAutoRewrite && did == 9U && m_dstRewriteID != 9U && m_dstRewriteID != 0U && (m_time + 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); - return m_dstRewriteID; + } 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]); + return m_dstRewriteID[slot - 1U]; } else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did !=9U && did < 99999U && dmrLC->getFLCO() == FLCO_USER_USER) { - m_dstRewriteID = did; + 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); return did; } else if (m_bmAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did !=9U && did > 99999U) { - m_dstRewriteID = did; + m_dstRewriteID[slot - 1U] = did; } return 0U; } -void DMRAccessControl::setOverEndTime() +void DMRAccessControl::setOverEndTime(unsigned int slot) { - m_time = ::time(NULL); + m_time[slot - 1U] = ::time(NULL); } diff --git a/DMRAccessControl.h b/DMRAccessControl.h index 6a6baf6..52bef69 100644 --- a/DMRAccessControl.h +++ b/DMRAccessControl.h @@ -28,7 +28,7 @@ public: static unsigned int dstIdRewrite(unsigned int id, unsigned int sid, unsigned int slot, bool network, CDMRLC* dmrLC); - static void setOverEndTime(); + static void setOverEndTime(unsigned int slot); private: static std::vector m_dstBlackListSlot1RF; @@ -55,10 +55,12 @@ private: static bool validateSrcId(unsigned int id); - static time_t m_time; + static time_t m_time[2]; + + + static unsigned int m_dstRewriteID[2]; + static unsigned int m_srcID[2]; - static unsigned int m_dstRewriteID; - static unsigned int m_srcID; static bool m_tgRewriteSlot1; static bool m_tgRewriteSlot2; diff --git a/DMRSlot.cpp b/DMRSlot.cpp index db87f5c..3e379f2 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -261,7 +261,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len) LogMessage("DMR Slot %u, received RF end of voice transmission, %.1f seconds, BER: %.1f%%", m_slotNo, float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits)); writeEndRF(); - DMRAccessControl::setOverEndTime(); + DMRAccessControl::setOverEndTime(m_slotNo); } else if (dataType == DT_DATA_HEADER) { if (m_rfState == RS_RF_DATA) return; @@ -915,7 +915,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) LogMessage("DMR Slot %u, received network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", m_slotNo, float(m_netFrames) / 16.667F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits)); writeEndNet(); - DMRAccessControl::setOverEndTime(); + DMRAccessControl::setOverEndTime(m_slotNo); } else if (dataType == DT_DATA_HEADER) { if (m_netState == RS_NET_DATA) return;