aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTad Smith <tadsmith@hotmail.com>2023-02-07 23:29:41 +0000
committerTad Smith <tadsmith@hotmail.com>2023-02-07 23:29:41 +0000
commit6e77daae7bba31391a5fe517c33f2e637b56c574 (patch)
tree1afedb9163bd79af7f1441d390e9434064a3a63f
parent913813504f70bd85140e438625351476e2c6b86c (diff)
Multi-site bug fixes and improvements.
-rw-r--r--docs/CONFIGURE.md5
-rw-r--r--trunk-recorder/main.cc30
-rw-r--r--trunk-recorder/systems/system.h3
-rw-r--r--trunk-recorder/systems/system_impl.cc8
-rw-r--r--trunk-recorder/systems/system_impl.h4
-rw-r--r--trunk-recorder/talkgroup.cc10
-rw-r--r--trunk-recorder/talkgroup.h6
-rw-r--r--trunk-recorder/talkgroups.cc2
8 files changed, 44 insertions, 24 deletions
diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md
index 9d0d104a..4511ba5e 100644
--- a/docs/CONFIGURE.md
+++ b/docs/CONFIGURE.md
@@ -204,9 +204,10 @@ Here is a map of the different sections of the *config.json* file:
| Key | Required | Default Value | Type | Description |
| ---------------------- | :------: | ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| multiSite | | false | **true** / **false** | Enables multiSite mode for this system |
-| multiSiteSystemName | | | string | The name of the system that this site belongs to. **This is required for SmartNet in Multi-Site mode.** |
+| multiSiteSystemName | | | string | The name of the system that this site belongs to. **This is required for SmartNet in Multi-Site mode.** |
+| multiSiteSystemNumber | | 0 | number | An arbitrary number used to identify this system for SmartNet in Multi-Site mode. |
-Multi-Site mode attempts to avoid recording duplicate calls being broadcasted on multiple sites. Trunk recorder will not record duplicate calls on the same talkgroup for systems that have multiSite enabled. To ensure that both calls belong to the same system, Trunk Recorder will verify that both sites have the same WACN for P25, or the same multiSiteSystemName for SmartNet. By default, trunk-recorder will record the call from the first site that it receives the grant on, and any additional grants for the same call on other sites will be ignored. If you want to to specify the preferred site for a specific talk group, you can specify the preffered NAC in decimal format in the talk group CSV file.
+Multi-Site mode attempts to avoid recording duplicate calls being broadcasted on multiple sites. Trunk recorder will not record duplicate calls on the same talkgroup for systems that have multiSite enabled. To ensure that both calls belong to the same system, Trunk Recorder will verify that both sites have the same WACN for P25, or the same multiSiteSystemName for SmartNet. By default, trunk-recorder will record the call from the first site that it receives the grant on, and any additional grants for the same call on other sites will be ignored. If you want to to specify the preferred site for a specific talk group, you can specify the preferred NAC in decimal format in the talk group CSV file.
#### Plugin Object
diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc
index 9063ae03..9afb7bc8 100644
--- a/trunk-recorder/main.cc
+++ b/trunk-recorder/main.cc
@@ -35,6 +35,7 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
+#include <utility>
#include "./global_structs.h"
#include "recorder_globals.h"
@@ -399,6 +400,8 @@ bool load_config(string config_file) {
BOOST_LOG_TRIVIAL(info) << "Multiple Site System: " << system->get_multiSite();
system->set_multiSiteSystemName(node.second.get<std::string>("multiSiteSystemName", ""));
BOOST_LOG_TRIVIAL(info) << "Multiple Site System Name: " << system->get_multiSiteSystemName();
+ system->set_multiSiteSystemNumber(node.second.get<unsigned long>("multiSiteSystemNumber", 0));
+ BOOST_LOG_TRIVIAL(info) << "Multiple Site System Number: " << system->get_multiSiteSystemNumber();
if (!system->get_compress_wav()) {
if ((system->get_api_key().length() > 0) || (system->get_bcfy_api_key().length() > 0)) {
@@ -995,12 +998,11 @@ void handle_call_grant(TrunkMessage message, System *sys) {
//BOOST_LOG_TRIVIAL(info) << "TG: " << message.talkgroup << " sys num: " << message.sys_num << " freq: " << message.freq << " TDMA Slot" << message.tdma_slot << " TDMA: " << message.phase2_tdma;
- int message_prefferedNAC = 0;
+ unsigned long message_preferredNAC = 0;
Talkgroup *message_talkgroup = sys->find_talkgroup(message.talkgroup);
if (message_talkgroup) {
- message_prefferedNAC = message_talkgroup->get_preferredNAC();
+ message_preferredNAC = message_talkgroup->get_preferredNAC();
}
- //BOOST_LOG_TRIVIAL(info) << "TG: " << message.talkgroup << " Preferred NAC: " << message_prefferedNAC << ".";
for (vector<Call *>::iterator it = calls.begin(); it != calls.end();) {
Call *call = *it;
@@ -1022,13 +1024,14 @@ void handle_call_grant(TrunkMessage message, System *sys) {
duplicate_grant = true;
original_call = call;
- int call_prefferedNAC = 0;
+ unsigned long call_preferredNAC = 0;
Talkgroup *call_talkgroup = call->get_system()->find_talkgroup(message.talkgroup);
if (call_talkgroup) {
- call_prefferedNAC = message_talkgroup->get_preferredNAC();
+ call_preferredNAC = call_talkgroup->get_preferredNAC();
+
}
- if ((call_prefferedNAC != call->get_system()->get_nac()) && (message_prefferedNAC == sys->get_nac())) {
+ if ((call_preferredNAC != call->get_system()->get_nac() ) && (message_preferredNAC == sys->get_nac())) {
superseding_grant = true;
}
@@ -1043,17 +1046,18 @@ void handle_call_grant(TrunkMessage message, System *sys) {
duplicate_grant = true;
original_call = call;
- // This is a hack to use the preferred Sytem Number as the preferredNAC.
- // Should investiage a method to add a preferred Site name when manually specifcying mutliSiteSystemName
- int call_prefferedNAC = 0;
+ unsigned long call_preferredNAC = 0;
Talkgroup *call_talkgroup = call->get_system()->find_talkgroup(message.talkgroup);
if (call_talkgroup) {
- call_prefferedNAC = message_talkgroup->get_preferredNAC();
- }
- if ((call_prefferedNAC != call->get_sys_num()) && (message_prefferedNAC == sys->get_sys_num())) {
- superseding_grant = true;
+ call_preferredNAC = call_talkgroup->get_preferredNAC();
}
+ if((call->get_system()->get_multiSiteSystemNumber() != 0 ) && (sys->get_multiSiteSystemNumber() != 0 ))
+ {
+ if ((call_preferredNAC != call->get_system()->get_multiSiteSystemNumber()) && (message_preferredNAC == sys->get_multiSiteSystemNumber())) {
+ superseding_grant = true;
+ }
+ }
}
}
}
diff --git a/trunk-recorder/systems/system.h b/trunk-recorder/systems/system.h
index 117bd093..aa2419fa 100644
--- a/trunk-recorder/systems/system.h
+++ b/trunk-recorder/systems/system.h
@@ -166,5 +166,8 @@ public:
virtual std::string get_multiSiteSystemName() = 0;
virtual void set_multiSiteSystemName(std::string multiSiteSystemName) = 0;
+ virtual unsigned long get_multiSiteSystemNumber() = 0;
+ virtual void set_multiSiteSystemNumber(unsigned long multiSiteSystemName) = 0;
+
};
#endif
diff --git a/trunk-recorder/systems/system_impl.cc b/trunk-recorder/systems/system_impl.cc
index b6488fa2..4424d6a0 100644
--- a/trunk-recorder/systems/system_impl.cc
+++ b/trunk-recorder/systems/system_impl.cc
@@ -605,4 +605,12 @@ std::string System_impl::get_multiSiteSystemName() {
void System_impl::set_multiSiteSystemName(std::string multiSiteSystemName) {
d_multiSiteSystemName = multiSiteSystemName;
+}
+
+unsigned long System_impl::get_multiSiteSystemNumber() {
+ return d_multiSiteSystemNumber;
+}
+
+void System_impl::set_multiSiteSystemNumber(unsigned long multiSiteSystemNumber) {
+ d_multiSiteSystemNumber = multiSiteSystemNumber;
} \ No newline at end of file
diff --git a/trunk-recorder/systems/system_impl.h b/trunk-recorder/systems/system_impl.h
index 216f1842..8f294449 100644
--- a/trunk-recorder/systems/system_impl.h
+++ b/trunk-recorder/systems/system_impl.h
@@ -224,12 +224,16 @@ public:
std::string get_multiSiteSystemName();
void set_multiSiteSystemName(std::string multiSiteSystemName);
+ unsigned long get_multiSiteSystemNumber();
+ void set_multiSiteSystemNumber(unsigned long multiSiteSystemNumber);
+
private:
TalkgroupDisplayFormat talkgroup_display_format;
bool d_hideEncrypted;
bool d_hideUnknown;
bool d_multiSite;
std::string d_multiSiteSystemName;
+ unsigned long d_multiSiteSystemNumber;
bool d_mdc_enabled;
bool d_fsync_enabled;
diff --git a/trunk-recorder/talkgroup.cc b/trunk-recorder/talkgroup.cc
index 5c648c57..b57f7ca8 100644
--- a/trunk-recorder/talkgroup.cc
+++ b/trunk-recorder/talkgroup.cc
@@ -1,6 +1,6 @@
#include "talkgroup.h"
-Talkgroup::Talkgroup(int sys_num, long num, std::string mode, std::string alpha_tag, std::string description, std::string tag, std::string group, int priority, int prefferedNAC) {
+Talkgroup::Talkgroup(int sys_num, long num, std::string mode, std::string alpha_tag, std::string description, std::string tag, std::string group, int priority, unsigned long preferredNAC) {
this->sys_num = sys_num;
this->number = num;
this->mode = mode;
@@ -12,7 +12,7 @@ Talkgroup::Talkgroup(int sys_num, long num, std::string mode, std::string alpha_
this->active = false;
this->freq = 0;
this->tone = 0;
- this->prefferedNAC = prefferedNAC;
+ this->preferredNAC = preferredNAC;
}
Talkgroup::Talkgroup(int sys_num, long num, double freq, double tone, std::string alpha_tag, std::string description, std::string tag, std::string group) {
@@ -27,7 +27,7 @@ Talkgroup::Talkgroup(int sys_num, long num, double freq, double tone, std::strin
this->freq = freq;
this->tone = tone;
this->priority = 0;
- this->prefferedNAC = 0;
+ this->preferredNAC = 0;
}
std::string Talkgroup::menu_string() {
@@ -48,8 +48,8 @@ int Talkgroup::get_priority() {
return priority;
}
-int Talkgroup::get_preferredNAC() {
- return prefferedNAC;
+unsigned long Talkgroup::get_preferredNAC() {
+ return preferredNAC;
}
void Talkgroup::set_priority(int new_priority) {
diff --git a/trunk-recorder/talkgroup.h b/trunk-recorder/talkgroup.h
index 33e1981a..82dec567 100644
--- a/trunk-recorder/talkgroup.h
+++ b/trunk-recorder/talkgroup.h
@@ -22,18 +22,18 @@ public:
double freq;
double tone;
- Talkgroup(int sys_num, long num, std::string mode, std::string alpha_tag, std::string description, std::string tag, std::string group, int priority, int preferredNAC);
+ Talkgroup(int sys_num, long num, std::string mode, std::string alpha_tag, std::string description, std::string tag, std::string group, int priority, unsigned long preferredNAC);
Talkgroup(int sys_num, long num, double freq, double tone, std::string alpha_tag, std::string description, std::string tag, std::string group);
bool is_active();
int get_priority();
- int get_preferredNAC();
+ unsigned long get_preferredNAC();
void set_priority(int new_priority);
void set_active(bool a);
std::string menu_string();
private:
- int prefferedNAC;
+ unsigned long preferredNAC;
bool active;
};
diff --git a/trunk-recorder/talkgroups.cc b/trunk-recorder/talkgroups.cc
index 9197b77f..839124ed 100644
--- a/trunk-recorder/talkgroups.cc
+++ b/trunk-recorder/talkgroups.cc
@@ -95,7 +95,7 @@ void Talkgroups::load_talkgroups(int sys_num, std::string filename) {
}
// TODO(nkw): more sanity checking here.
priority = (vec.size() == 8) ? atoi(vec[7].c_str()) : 1;
- int preferredNAC = (vec.size() == 9) ? atoi(vec[8].c_str()) : 0;
+ unsigned long preferredNAC = (vec.size() == 9) ? atoi(vec[8].c_str()) : 0;
tg = new Talkgroup(sys_num, atoi(vec[0].c_str()), vec[2].c_str(), vec[3].c_str(), vec[4].c_str(), vec[5].c_str(), vec[6].c_str(), priority, preferredNAC);