From a341af0e775e34c208a140c865ead17a2208e251 Mon Sep 17 00:00:00 2001 From: tadscottsmith <78445808+tadscottsmith@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:12:55 -0500 Subject: [PATCH 1/3] Revert "No overlap uuv" --- trunk-recorder/global_structs.h | 1 - trunk-recorder/main.cc | 14 -------------- trunk-recorder/systems/p25_parser.cc | 6 +++--- trunk-recorder/systems/parser.h | 2 -- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/trunk-recorder/global_structs.h b/trunk-recorder/global_structs.h index 2aeafe129..33b73ebd4 100644 --- a/trunk-recorder/global_structs.h +++ b/trunk-recorder/global_structs.h @@ -35,7 +35,6 @@ struct Config { int control_retune_limit; bool broadcast_signals; bool enable_audio_streaming; - bool record_uu_v_calls; }; diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 3ea698a7f..904c13dcd 100755 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -186,8 +186,6 @@ bool load_config(string config_file) { BOOST_LOG_TRIVIAL(info) << "Control channel retune limit: " << config.control_retune_limit; config.enable_audio_streaming = pt.get("audioStreaming", false); BOOST_LOG_TRIVIAL(info) << "Enable Audio Streaming: " << config.enable_audio_streaming; - config.record_uu_v_calls = pt.get("recordUUVCalls", false); - BOOST_LOG_TRIVIAL(info) << "Record Unit to Unit Voice Calls: " << config.record_uu_v_calls; std::string frequencyFormatString = pt.get("frequencyFormat", "exp"); if (boost::iequals(frequencyFormatString, "mhz")) { @@ -1107,18 +1105,6 @@ void handle_message(std::vector messages, System *sys) { handle_call_update(message, sys); break; - case UU_V_GRANT: - if(config.record_uu_v_calls){ - handle_call_grant(message, sys); - } - break; - - case UU_V_UPDATE: - if(config.record_uu_v_calls){ - handle_call_update(message, sys); - } - break; - case CONTROL_CHANNEL: sys->add_control_channel(message.freq); break; diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 5d898dbd0..cee6e76f8 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -181,7 +181,7 @@ std::vector P25Parser::decode_mbt_data(unsigned long opcode, boost unsigned long sa = bitset_shift_mask(header, 48, 0xffffff); unsigned long ta = bitset_shift_mask(mbt_data, 24, 0xffffff); - message.message_type = UU_V_GRANT; + message.message_type = GRANT; message.freq = f; message.talkgroup = ta; message.source = sa; @@ -448,7 +448,7 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long sa = bitset_shift_mask(tsbk, 16, 0xffffff); unsigned long ta = bitset_shift_mask(tsbk, 40, 0xffffff); - message.message_type = UU_V_GRANT; + message.message_type = GRANT; message.freq = f; message.talkgroup = ta; message.source = sa; @@ -499,7 +499,7 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long sa = bitset_shift_mask(tsbk, 16, 0xffffff); unsigned long ta = bitset_shift_mask(tsbk, 40, 0xffffff); - message.message_type = UU_V_UPDATE; + message.message_type = UPDATE; message.freq = f; message.talkgroup = ta; message.source = sa; diff --git a/trunk-recorder/systems/parser.h b/trunk-recorder/systems/parser.h index 20e2657cd..943a17403 100644 --- a/trunk-recorder/systems/parser.h +++ b/trunk-recorder/systems/parser.h @@ -18,8 +18,6 @@ enum MessageType { PATCH_DELETE = 11, DATA_GRANT = 12, UU_ANS_REQ = 13, - UU_V_GRANT = 14, - UU_V_UPDATE = 15, UNKNOWN = 99 }; From afad67b4c32e1dac90a2f7046edb3ea2085d9e14 Mon Sep 17 00:00:00 2001 From: Tad Smith Date: Tue, 7 Jun 2022 21:11:28 -0500 Subject: [PATCH 2/3] Improve talkgroup logging. --- docs/CONFIGURE.md | 2 ++ trunk-recorder/main.cc | 8 ++++---- trunk-recorder/source.cc | 37 +++++++++++++++++++++++-------------- trunk-recorder/source.h | 8 ++++---- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md index 9209ca169..ae8c4229b 100644 --- a/docs/CONFIGURE.md +++ b/docs/CONFIGURE.md @@ -373,6 +373,8 @@ This file provides info on the different talkgroups in a trunking system. A lot You may add an additional column that adds a priority for each talkgroup. The priority field specifies the number of recorders the system must have available to record a new call for the talkgroup. For example, a priority of 1, the highest means as long as at least a single recorder is available, the system will record the new call. If the priority is 2, the system would at least 2 free recorders to record the new call, and so on. If there is no priority set for a talkgroup entry, a prioity of 1 is assumed. +Talkgroups assigned a priority of -1 will never be recorded, regardless of the number of available recorders. + The Trunk Record program really only uses the priority information and the Dec Talkgroup ID. The Website uses the same file though to help display information about each talkgroup. Here are the column headers and some sample data: NOTE: If you are adding the Priority to a RR csv, as well as changing order you must use a heading for the first column other than "Decimal" eg DEC for TR to detect you are supplying this layout. diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 947b3d62f..e2dd84bd1 100755 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -647,10 +647,10 @@ bool start_recorder(Call *call, TrunkMessage message, System *sys) { } } if (talkgroup->mode.compare("A") == 0) { - recorder = source->get_analog_recorder(talkgroup); + recorder = source->get_analog_recorder(talkgroup, priority, call); call->set_is_analog(true); } else { - recorder = source->get_digital_recorder(talkgroup, priority); + recorder = source->get_digital_recorder(talkgroup, priority, call); } } else { BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tTG not in Talkgroup File "; @@ -659,10 +659,10 @@ bool start_recorder(Call *call, TrunkMessage message, System *sys) { // Use an analog recorder if this is a Type II trunk and defaultMode is analog. // All other cases use a digital recorder. if ((default_mode == "analog") && (sys->get_system_type() == "smartnet")) { - recorder = source->get_analog_recorder(); + recorder = source->get_analog_recorder(call); call->set_is_analog(true); } else { - recorder = source->get_digital_recorder(); + recorder = source->get_digital_recorder(call); } } // int total_recorders = get_total_recorders(); diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 2f2cfbf0a..a1b1e6b52 100644 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -154,19 +154,23 @@ void Source::create_analog_recorders(gr::top_block_sptr tb, int r) { } } -Recorder *Source::get_analog_recorder(Talkgroup *talkgroup) { +Recorder *Source::get_analog_recorder(Talkgroup *talkgroup, int priority, Call *call) { int num_available_recorders = get_num_available_analog_recorders(); - if (talkgroup && talkgroup->get_priority() > num_available_recorders) { // a low priority is bad. You need atleast the number of availalbe recorders to your priority - BOOST_LOG_TRIVIAL(info) << "\t\tNot recording talkgroup " << talkgroup->number << " (" << talkgroup->alpha_tag << ")" - << ", priority is " << talkgroup->get_priority() << " but only " << num_available_recorders << " recorders available"; + if(talkgroup && (priority == -1)){ + BOOST_LOG_TRIVIAL(info) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tNot recording talkgroup. Priority is -1."; return NULL; } - return get_analog_recorder(); + if (talkgroup && priority > num_available_recorders) { // a high priority is bad. You need at least the number of availalbe recorders to your priority + BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tNot recording talkgroup. Priority is " << priority << " but only " << num_available_recorders << " recorders are available."; + return NULL; + } + + return get_analog_recorder(call); } -Recorder *Source::get_analog_recorder() { +Recorder *Source::get_analog_recorder(Call *call) { for (std::vector::iterator it = analog_recorders.begin(); it != analog_recorders.end(); it++) { analog_recorder_sptr rx = *it; @@ -177,7 +181,7 @@ Recorder *Source::get_analog_recorder() { break; } } - BOOST_LOG_TRIVIAL(info) << "[ " << device << " ] No Analog Recorders Available"; + BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\t[ " << device << " ] No Analog Recorders Available."; return NULL; } @@ -331,19 +335,23 @@ int Source::get_num_available_analog_recorders() { return num_available_recorders; } -Recorder *Source::get_digital_recorder(Talkgroup *talkgroup, int priority) { +Recorder *Source::get_digital_recorder(Talkgroup *talkgroup, int priority, Call *call) { int num_available_recorders = get_num_available_digital_recorders(); - if (talkgroup && priority > num_available_recorders) { // a low priority is bad. You need atleast the number of availalbe recorders to your priority - BOOST_LOG_TRIVIAL(info) << "\t\tNot recording talkgroup " << talkgroup->number << " (" << talkgroup->alpha_tag << ")" - << ", priority is " << priority << " but only " << num_available_recorders << " recorders available"; + if(talkgroup && (priority == -1)){ + BOOST_LOG_TRIVIAL(info) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tNot recording talkgroup. Priority is -1."; return NULL; } - return get_digital_recorder(); + if (talkgroup && priority > num_available_recorders) { // a high priority is bad. You need at least the number of availalbe recorders to your priority + BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tNot recording talkgroup. Priority is " << priority << " but only " << num_available_recorders << " recorders are available."; + return NULL; + } + + return get_digital_recorder(call); } -Recorder *Source::get_digital_recorder() { +Recorder *Source::get_digital_recorder(Call *call) { for (std::vector::iterator it = digital_recorders.begin(); it != digital_recorders.end(); it++) { p25_recorder_sptr rx = *it; @@ -354,7 +362,8 @@ Recorder *Source::get_digital_recorder() { break; } } - BOOST_LOG_TRIVIAL(info) << "[ " << device << " ] No Digital Recorders Available"; + + BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\t[ " << device << " ] No Digital Recorders Available."; for (std::vector::iterator it = digital_recorders.begin(); it != digital_recorders.end(); it++) { diff --git a/trunk-recorder/source.h b/trunk-recorder/source.h index 45d0a8eac..9169193ba 100644 --- a/trunk-recorder/source.h +++ b/trunk-recorder/source.h @@ -115,10 +115,10 @@ class Source { p25_recorder_sptr create_digital_conventional_recorder(gr::top_block_sptr tb); dmr_recorder_sptr create_dmr_conventional_recorder(gr::top_block_sptr tb); - Recorder *get_digital_recorder(); - Recorder *get_digital_recorder(Talkgroup *talkgroup, int priority); - Recorder *get_analog_recorder(); - Recorder *get_analog_recorder(Talkgroup *talkgroup); + Recorder *get_digital_recorder(Call *call); + Recorder *get_digital_recorder(Talkgroup *talkgroup, int priority, Call *call); + Recorder *get_analog_recorder(Call *call); + Recorder *get_analog_recorder(Talkgroup *talkgroup, int priority, Call *call); Recorder *get_debug_recorder(); Recorder *get_sigmf_recorder(); From 14f3b24810ddad004a82554f36468daf3c1d200b Mon Sep 17 00:00:00 2001 From: Tad Smith Date: Tue, 7 Jun 2022 21:19:34 -0500 Subject: [PATCH 3/3] Fixed spacing. --- trunk-recorder/source.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index a1b1e6b52..4bfc749d4 100644 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -157,7 +157,7 @@ void Source::create_analog_recorders(gr::top_block_sptr tb, int r) { Recorder *Source::get_analog_recorder(Talkgroup *talkgroup, int priority, Call *call) { int num_available_recorders = get_num_available_analog_recorders(); - if(talkgroup && (priority == -1)){ + if(talkgroup && (priority == -1)){ BOOST_LOG_TRIVIAL(info) << "[" << call->get_system()->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\tNot recording talkgroup. Priority is -1."; return NULL; }