From 39e0e4a254cf840d4cd43977444bdde4b4748b62 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Mon, 19 Jun 2023 18:59:01 -0400 Subject: [PATCH] add option to selectively enable/disable CC notification from a VC for traffic channel updates (this option defaults to enabled/on for all configurations but VOC); --- configs/config.example.yml | 4 +++- src/dmr/Control.cpp | 7 ++++++- src/dmr/Slot.cpp | 7 +++---- src/dmr/Slot.h | 3 +++ src/nxdn/Control.cpp | 11 +++++++---- src/nxdn/Control.h | 2 ++ src/p25/Control.cpp | 16 ++++++++++++---- src/p25/Control.h | 2 ++ 8 files changed, 38 insertions(+), 14 deletions(-) diff --git a/configs/config.example.yml b/configs/config.example.yml index d5ffc2d1..2bbb9303 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -327,7 +327,7 @@ system: # # Control Channel # Note: These parameters are used by a voice channel to communicate back to a - # control channel to give the control channel "realtime" traffic channel updates. + # control channel to give the control channel "real time" traffic channel updates. # controlCh: # REST API IP Address for control channel. @@ -336,6 +336,8 @@ system: restPort: 9990 # REST API access password for control channel. restPassword: "PASSWORD" + # Flag indicating voice channels will notify the control channel of traffic status. + notifyEnable: true # # Voice Channels diff --git a/src/dmr/Control.cpp b/src/dmr/Control.cpp index b8c35ff3..b870bbd1 100644 --- a/src/dmr/Control.cpp +++ b/src/dmr/Control.cpp @@ -178,7 +178,12 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vector(true); + m_slot1->setNotifyCC(notifyCC); + m_slot2->setNotifyCC(notifyCC); uint32_t silenceThreshold = dmrProtocol["silenceThreshold"].as(dmr::DEFAULT_SILENCE_THRESHOLD); if (silenceThreshold > MAX_DMR_VOICE_ERRORS) { diff --git a/src/dmr/Slot.cpp b/src/dmr/Slot.cpp index 718abd71..fbbdaca2 100644 --- a/src/dmr/Slot.cpp +++ b/src/dmr/Slot.cpp @@ -164,6 +164,7 @@ Slot::Slot(uint32_t slotNo, uint32_t timeout, uint32_t tgHang, uint32_t queueSiz m_disableGrantSrcIdCheck(false), m_lastLateEntry(0U), m_supervisor(false), + m_notifyCC(true), m_verbose(verbose), m_debug(debug) { @@ -915,8 +916,7 @@ void Slot::notifyCC_ReleaseGrant(uint32_t dstId) { // callback REST API to release the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send release grants to ourselves + if (!m_notifyCC) { return; } @@ -943,8 +943,7 @@ void Slot::notifyCC_TouchGrant(uint32_t dstId) { // callback REST API to touch the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send touch grants to ourselves + if (!m_notifyCC) { return; } diff --git a/src/dmr/Slot.h b/src/dmr/Slot.h index 8a51b2d7..2134ab38 100644 --- a/src/dmr/Slot.h +++ b/src/dmr/Slot.h @@ -116,6 +116,8 @@ namespace dmr void setSupervisor(bool supervisor) { m_supervisor = supervisor; } /// Sets a flag indicating whether the slot has will perform source ID checks before issuing a grant. void setDisableSourceIDGrantCheck(bool disableSourceIdGrant) { m_disableGrantSrcIdCheck = disableSourceIdGrant; } + /// Sets a flag indicating whether the voice channels will notify the TSCC of traffic channel changes. + void setNotifyCC(bool notifyCC) { m_notifyCC = notifyCC; } /// Helper to set the voice error silence threshold. void setSilenceThreshold(uint32_t threshold); @@ -209,6 +211,7 @@ namespace dmr uint32_t m_lastLateEntry; bool m_supervisor; + bool m_notifyCC; bool m_verbose; bool m_debug; diff --git a/src/nxdn/Control.cpp b/src/nxdn/Control.cpp index 4f182966..990615da 100644 --- a/src/nxdn/Control.cpp +++ b/src/nxdn/Control.cpp @@ -140,6 +140,7 @@ Control::Control(bool authoritative, uint32_t ran, uint32_t callHang, uint32_t q m_aveRSSI(0U), m_rssiCount(0U), m_dumpRCCH(dumpRCCHData), + m_notifyCC(true), m_verbose(verbose), m_debug(debug) { @@ -316,6 +317,10 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw m_trunk->m_disableGrantSrcIdCheck = control["disableGrantSourceIdCheck"].as(false); + yaml::Node rfssConfig = systemConf["config"]; + yaml::Node controlCh = rfssConfig["controlCh"]; + m_notifyCC = controlCh["notifyEnable"].as(true); + if (printOptions) { LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); @@ -893,8 +898,7 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId) { // callback REST API to release the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send release grants to ourselves + if (!m_notifyCC) { return; } @@ -919,8 +923,7 @@ void Control::notifyCC_TouchGrant(uint32_t dstId) { // callback REST API to touch the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send touch grants to ourselves + if (!m_notifyCC) { return; } diff --git a/src/nxdn/Control.h b/src/nxdn/Control.h index f9f307b5..98d11ffa 100644 --- a/src/nxdn/Control.h +++ b/src/nxdn/Control.h @@ -202,6 +202,8 @@ namespace nxdn bool m_dumpRCCH; + bool m_notifyCC; + bool m_verbose; bool m_debug; diff --git a/src/p25/Control.cpp b/src/p25/Control.cpp index af9ba58e..f8d810d7 100644 --- a/src/p25/Control.cpp +++ b/src/p25/Control.cpp @@ -140,6 +140,7 @@ Control::Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t q m_minRSSI(0U), m_aveRSSI(0U), m_rssiCount(0U), + m_notifyCC(true), m_verbose(verbose), m_debug(debug) { @@ -358,6 +359,15 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw m_trunk->m_disableGrantSrcIdCheck = p25Protocol["control"]["disableGrantSourceIdCheck"].as(false); + yaml::Node rfssConfig = systemConf["config"]; + yaml::Node controlCh = rfssConfig["controlCh"]; + m_notifyCC = controlCh["notifyEnable"].as(true); + + // voice on control forcibly disables CC notification + if (m_voiceOnControl) { + m_notifyCC = false; + } + if (printOptions) { LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); @@ -1262,8 +1272,7 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId) { // callback REST API to release the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send release grants to ourselves + if (!m_notifyCC) { return; } @@ -1288,8 +1297,7 @@ void Control::notifyCC_TouchGrant(uint32_t dstId) { // callback REST API to touch the granted TG on the specified control channel if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { - if (m_controlChData.address() == "127.0.0.1") { - // cowardly ignore trying to send touch grants to ourselves + if (!m_notifyCC) { return; } diff --git a/src/p25/Control.h b/src/p25/Control.h index 16c6d4e1..b207d195 100644 --- a/src/p25/Control.h +++ b/src/p25/Control.h @@ -220,6 +220,8 @@ namespace p25 uint32_t m_aveRSSI; uint32_t m_rssiCount; + bool m_notifyCC; + bool m_verbose; bool m_debug;