diff --git a/src/fne/network/FNENetwork.cpp b/src/fne/network/FNENetwork.cpp index d94c1cff..081c4550 100644 --- a/src/fne/network/FNENetwork.cpp +++ b/src/fne/network/FNENetwork.cpp @@ -143,6 +143,7 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port, m_verbosePacketData(false), m_sndcpStartAddr(__IP_FROM_STR("10.10.1.10")), m_sndcpEndAddr(__IP_FROM_STR("10.10.1.254")), + m_totalActiveCalls(0U), m_totalCallsProcessed(0U), m_logDenials(false), m_logUpstreamCallStartEnd(true), diff --git a/src/fne/network/FNENetwork.h b/src/fne/network/FNENetwork.h index c3e9aac5..c78c2017 100644 --- a/src/fne/network/FNENetwork.h +++ b/src/fne/network/FNENetwork.h @@ -406,6 +406,7 @@ namespace network uint32_t m_sndcpStartAddr; uint32_t m_sndcpEndAddr; + int32_t m_totalActiveCalls; uint64_t m_totalCallsProcessed; bool m_logDenials; diff --git a/src/fne/network/callhandler/TagAnalogData.cpp b/src/fne/network/callhandler/TagAnalogData.cpp index 88a82320..bbde7737 100644 --- a/src/fne/network/callhandler/TagAnalogData.cpp +++ b/src/fne/network/callhandler/TagAnalogData.cpp @@ -127,6 +127,10 @@ bool TagAnalogData::processFrame(const uint8_t* data, uint32_t len, uint32_t pee else if (!fromUpstream) LogInfoEx(LOG_MASTER, CALL_END_LOG); + m_network->m_totalActiveCalls--; + if (m_network->m_totalActiveCalls < 0) + m_network->m_totalActiveCalls = 0; + // report call event to InfluxDB if (m_network->m_enableInfluxDB) { influxdb::QueryBuilder() @@ -266,6 +270,7 @@ bool TagAnalogData::processFrame(const uint8_t* data, uint32_t len, uint32_t pee m_status.unlock(); m_network->m_totalCallsProcessed++; + m_network->m_totalActiveCalls++; #define CALL_START_LOG "Analog, Call Start, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, fromUpstream = %u", peerId, ssrc, srcId, dstId, streamId, fromUpstream if (m_network->m_logUpstreamCallStartEnd && fromUpstream) diff --git a/src/fne/network/callhandler/TagDMRData.cpp b/src/fne/network/callhandler/TagDMRData.cpp index b5d0162e..697dac72 100644 --- a/src/fne/network/callhandler/TagDMRData.cpp +++ b/src/fne/network/callhandler/TagDMRData.cpp @@ -207,6 +207,10 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId LogInfoEx(LOG_MASTER, CALL_END_LOG); } + m_network->m_totalActiveCalls--; + if (m_network->m_totalActiveCalls < 0) + m_network->m_totalActiveCalls = 0; + // report call event to InfluxDB if (m_network->m_enableInfluxDB) { influxdb::QueryBuilder() @@ -367,6 +371,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId m_status.unlock(); m_network->m_totalCallsProcessed++; + m_network->m_totalActiveCalls++; // is this a private call? if (flco == FLCO::PRIVATE) { diff --git a/src/fne/network/callhandler/TagNXDNData.cpp b/src/fne/network/callhandler/TagNXDNData.cpp index f4498e83..243cd754 100644 --- a/src/fne/network/callhandler/TagNXDNData.cpp +++ b/src/fne/network/callhandler/TagNXDNData.cpp @@ -246,6 +246,10 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI LogInfoEx(LOG_MASTER, CALL_END_LOG); } + m_network->m_totalActiveCalls--; + if (m_network->m_totalActiveCalls < 0) + m_network->m_totalActiveCalls = 0; + // report call event to InfluxDB if (m_network->m_enableInfluxDB) { influxdb::QueryBuilder() @@ -403,6 +407,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI m_status.unlock(); m_network->m_totalCallsProcessed++; + m_network->m_totalActiveCalls++; // is this a private call? if (!group) { diff --git a/src/fne/network/callhandler/TagP25Data.cpp b/src/fne/network/callhandler/TagP25Data.cpp index c41f8092..afdf7314 100644 --- a/src/fne/network/callhandler/TagP25Data.cpp +++ b/src/fne/network/callhandler/TagP25Data.cpp @@ -288,6 +288,10 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId LogInfoEx(LOG_MASTER, CALL_END_LOG); } + m_network->m_totalActiveCalls--; + if (m_network->m_totalActiveCalls < 0) + m_network->m_totalActiveCalls = 0; + // report call event to InfluxDB if (m_network->m_enableInfluxDB) { influxdb::QueryBuilder() @@ -446,6 +450,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId m_status.unlock(); m_network->m_totalCallsProcessed++; + m_network->m_totalActiveCalls++; // is this a private call? if (lco == LCO::PRIVATE) { diff --git a/src/fne/restapi/RESTAPI.cpp b/src/fne/restapi/RESTAPI.cpp index e1b6722e..34a3397d 100644 --- a/src/fne/restapi/RESTAPI.cpp +++ b/src/fne/restapi/RESTAPI.cpp @@ -1827,6 +1827,8 @@ void RESTAPI::restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, c // total calls processed uint32_t totalCallsProcessed = m_network->m_totalCallsProcessed; response["totalCallsProcessed"].set(totalCallsProcessed); + int32_t totalActiveCalls = m_network->m_totalActiveCalls; + response["totalActiveCalls"].set(totalActiveCalls); // table totals uint32_t ridTotalEntries = m_network->m_ridLookup->table().size();