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..4bfc749d4 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();