diff --git a/src/dmr/Slot.cpp b/src/dmr/Slot.cpp index 312470b4..3475ca4b 100644 --- a/src/dmr/Slot.cpp +++ b/src/dmr/Slot.cpp @@ -736,7 +736,8 @@ void Slot::setSiteData(const std::vector voiceChNo, const std::unorder m_affiliations->addRFCh(chNo); } - m_affiliations->setRFChData(voiceChData); + std::unordered_map chData = std::unordered_map(voiceChData); + m_affiliations->setRFChData(chData); lc::CSBK::setSiteData(m_siteData); } diff --git a/src/lookups/AffiliationLookup.cpp b/src/lookups/AffiliationLookup.cpp index 57429ed9..a6e29012 100644 --- a/src/lookups/AffiliationLookup.cpp +++ b/src/lookups/AffiliationLookup.cpp @@ -443,7 +443,7 @@ VoiceChData AffiliationLookup::getRFChData(uint32_t chNo) const data = VoiceChData(); } - return VoiceChData(); + return data; } /// diff --git a/src/lookups/AffiliationLookup.h b/src/lookups/AffiliationLookup.h index fb753553..43f8dbdb 100644 --- a/src/lookups/AffiliationLookup.h +++ b/src/lookups/AffiliationLookup.h @@ -152,7 +152,7 @@ namespace lookups virtual uint32_t getGrantedSrcId(uint32_t srcId); /// Helper to set RF channel data. - void setRFChData(const std::unordered_map chData) { m_rfChDataTable = chData; } + void setRFChData(const std::unordered_map& chData) { m_rfChDataTable = chData; } /// Helper to get RF channel data. VoiceChData getRFChData(uint32_t chNo) const; diff --git a/src/nxdn/Control.cpp b/src/nxdn/Control.cpp index 8b1f6c04..e8294a26 100644 --- a/src/nxdn/Control.cpp +++ b/src/nxdn/Control.cpp @@ -272,7 +272,8 @@ void Control::setOptions(yaml::Node& conf, bool controlPermitTG, const std::stri m_affiliations.addRFCh(ch); } - m_affiliations.setRFChData(voiceChData); + std::unordered_map chData = std::unordered_map(voiceChData); + m_affiliations.setRFChData(chData); lc::RCCH::setSiteData(m_siteData); lc::RCCH::setCallsign(cwCallsign); diff --git a/src/p25/Control.cpp b/src/p25/Control.cpp index 0d5080eb..1c73436d 100644 --- a/src/p25/Control.cpp +++ b/src/p25/Control.cpp @@ -316,7 +316,8 @@ void Control::setOptions(yaml::Node& conf, bool controlPermitTG, const std::stri m_affiliations.addRFCh(ch); } - m_affiliations.setRFChData(voiceChData); + std::unordered_map chData = std::unordered_map(voiceChData); + m_affiliations.setRFChData(chData); uint32_t ccBcstInterval = p25Protocol["control"]["interval"].as(300U); m_trunk->m_adjSiteUpdateInterval += ccBcstInterval; diff --git a/src/p25/packet/Trunk.cpp b/src/p25/packet/Trunk.cpp index 7cbabf10..2512a21b 100644 --- a/src/p25/packet/Trunk.cpp +++ b/src/p25/packet/Trunk.cpp @@ -2237,6 +2237,7 @@ bool Trunk::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_t serviceOp // callback RCON to permit-tg on the specified voice channel if (m_p25->m_authoritative && m_p25->m_controlPermitTG) { ::lookups::VoiceChData voiceChData = m_p25->m_affiliations.getRFChData(chNo); + if (voiceChData.isValidCh() && !voiceChData.address().empty() && voiceChData.port() > 0 && chNo != m_p25->m_siteData.channelNo()) { json::object req = json::object(); diff --git a/src/remote/RESTClient.cpp b/src/remote/RESTClient.cpp index 84f391a2..4e605d0f 100644 --- a/src/remote/RESTClient.cpp +++ b/src/remote/RESTClient.cpp @@ -63,6 +63,7 @@ using namespace network::rest::http; bool RESTClient::m_responseAvailable = false; HTTPPayload RESTClient::m_response; +bool RESTClient::m_console = false; bool RESTClient::m_debug = false; // --------------------------------------------------------------------------- @@ -117,6 +118,7 @@ RESTClient::RESTClient(const std::string& address, uint32_t port, const std::str assert(!address.empty()); assert(port > 0U); + m_console = true; m_debug = debug; } @@ -234,7 +236,14 @@ int RESTClient::send(const std::string& address, uint32_t port, const std::strin return ERRNO_API_CALL_TIMEOUT; } - fprintf(stdout, "%s\r\n", m_response.content.c_str()); + if (m_console) { + fprintf(stdout, "%s\r\n", m_response.content.c_str()); + } + else { + if (m_debug) { + ::LogDebug(LOG_REST, "REST Response: %s", m_response.content.c_str()); + } + } client.close(); } diff --git a/src/remote/RESTClient.h b/src/remote/RESTClient.h index ba93135b..ace5cbaf 100644 --- a/src/remote/RESTClient.h +++ b/src/remote/RESTClient.h @@ -64,6 +64,8 @@ private: uint32_t m_port; std::string m_password; + static bool m_console; + static bool m_responseAvailable; static HTTPPayload m_response;