Skip to content

Commit

Permalink
Merge pull request #758 from tadscottsmith/multi-site-v1
Browse files Browse the repository at this point in the history
Enable Multi-site mode features.
  • Loading branch information
robotastic authored Feb 7, 2023
2 parents a11e502 + 088ae9f commit 47c27ca
Show file tree
Hide file tree
Showing 18 changed files with 266 additions and 18 deletions.
17 changes: 12 additions & 5 deletions docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,14 @@ Here is a map of the different sections of the *config.json* file:
| decodeTPS | | false | **true** / **false** | [ Conventional systems only ] enable the Motorola Tactical Public Safety (aka FDNY Fireground) signaling decoder. |
| enabled | | true | **true** / **false** | control whether a configured system is enabled or disabled |

#### System Object - Experimental Options

| 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.** |

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.

#### Plugin Object

Expand Down Expand Up @@ -382,12 +389,12 @@ The Trunk Record program really only uses the priority information and the Dec T

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.

| DEC | HEX | Mode | Alpha Tag | Description | Tag | Group | Priority |
|------|-----|------|--------------|----------------|----------------|----------|----------|
| 101 | 065 | D | DCFD 01 Disp | 01 Dispatch | Fire Dispatch | Fire | 1 |
| 2227 | 8b3 | D | DC StcarYard | Streetcar Yard | Transportation | Services | 3 |

| DEC | HEX | Mode | Alpha Tag | Description | Tag | Group | Priority | PreferredNAC (optional) |
|-----|-----|------|-----------|-------------|-----|-------|----------|----------|
|101 | 065 | D | DCFD 01 Disp | 01 Dispatch | Fire Dispatch | Fire | 1 | 1000 |
|2227 | 8b3 | D | DC StcarYard | Streetcar Yard | Transportation | Services | 3 | 1001 |

In Multi-Site mode, the preferred NAC for a specific talk group is used to specify the site you prefer the talk group to be recorded from.

## channelFile

Expand Down
2 changes: 2 additions & 0 deletions trunk-recorder/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Call {
virtual bool get_sigmf_recording() = 0;
virtual void set_state(State s) = 0;
virtual State get_state() = 0;
virtual void set_monitoring_state(MonitoringState s) = 0;
virtual MonitoringState get_monitoring_state() = 0;
virtual void set_phase2_tdma(bool m) = 0;
virtual bool get_phase2_tdma() = 0;
virtual void set_tdma_slot(int s) = 0;
Expand Down
9 changes: 8 additions & 1 deletion trunk-recorder/call_concluder/call_concluder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con
call_info.audio_type = "digital";
}


// loop through the transmission list, pull in things to fill in totals for call_info
// Using a for loop with iterator
for (std::vector<Transmission>::iterator it = call_info.transmission_list.begin(); it != call_info.transmission_list.end();) {
Expand Down Expand Up @@ -307,7 +308,12 @@ void Call_Concluder::conclude_call(Call *call, System *sys, Config config) {

Call_Data_t call_info = create_call_data(call, sys, config);

if (call_info.transmission_list.size() == 0 && call_info.min_transmissions_removed == 0) {
if(call->get_state() == MONITORING && call->get_monitoring_state() == SUPERSEDED){
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tCall has been superseded. Removing files.";
remove_call_files(call_info);
return;
}
else if (call_info.transmission_list.size()== 0 && call_info.min_transmissions_removed == 0) {
BOOST_LOG_TRIVIAL(error) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\t Freq: " << format_freq(call_info.freq) << "\tNo Transmissions were recorded!";
return;
}
Expand All @@ -322,6 +328,7 @@ void Call_Concluder::conclude_call(Call *call, System *sys, Config config) {
return;
}


call_data_workers.push_back(std::async(std::launch::async, upload_call_worker, call_info));
}

Expand Down
15 changes: 13 additions & 2 deletions trunk-recorder/call_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Call_impl::Call_impl(long t, double f, System *s, Config c) {
stop_time = time(NULL);
last_update = time(NULL);
state = MONITORING;
monitoringState = UNSPECIFIED;
debug_recording = false;
sigmf_recording = false;
recorder = NULL;
Expand Down Expand Up @@ -63,6 +64,7 @@ Call_impl::Call_impl(TrunkMessage message, System *s, Config c) {
stop_time = time(NULL);
last_update = time(NULL);
state = MONITORING;
monitoringState = UNSPECIFIED;
debug_recording = false;
sigmf_recording = false;
recorder = NULL;
Expand Down Expand Up @@ -126,7 +128,7 @@ void Call_impl::conclude_call() {
// BOOST_LOG_TRIVIAL(info) << "conclude_call()";
stop_time = time(NULL);

if (state == COMPLETED) {
if (state == COMPLETED || (state == MONITORING && monitoringState == SUPERSEDED)) {
final_length = recorder->get_current_length();

if (!recorder) {
Expand All @@ -145,7 +147,8 @@ void Call_impl::conclude_call() {
}

Call_Concluder::conclude_call(this, sys, config);
} else {
}
else {
BOOST_LOG_TRIVIAL(error) << "[" << sys->get_short_name() << "]\t\033[0;34m" << this->get_call_num() << "C\033[0m\tTG: " << this->get_talkgroup_display() << "Concluding call, but call state is not COMPLETED!";
}
}
Expand Down Expand Up @@ -255,6 +258,14 @@ State Call_impl::get_state() {
return state;
}

void Call_impl::set_monitoring_state(MonitoringState s) {
monitoringState = s;
}

MonitoringState Call_impl::get_monitoring_state() {
return monitoringState;
}

void Call_impl::set_encrypted(bool m) {
encrypted = m;
}
Expand Down
3 changes: 3 additions & 0 deletions trunk-recorder/call_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Call_impl : public Call {
bool get_sigmf_recording();
void set_state(State s);
State get_state();
void set_monitoring_state(MonitoringState s);
MonitoringState get_monitoring_state();
void set_phase2_tdma(bool m);
bool get_phase2_tdma();
void set_tdma_slot(int s);
Expand Down Expand Up @@ -86,6 +88,7 @@ class Call_impl : public Call {

protected:
State state;
MonitoringState monitoringState;
static long call_counter;
long call_num;
long talkgroup;
Expand Down
42 changes: 42 additions & 0 deletions trunk-recorder/formatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,45 @@ std::string format_state(State state) {
}
return boost::lexical_cast<std::string>(state);
}

std::string format_state(State state, MonitoringState monitoringState) {
if (statusAsString) {
if (state == MONITORING){
if(monitoringState == UNSPECIFIED)
return "monitoring";
else if(monitoringState == UNKNOWN_TG)
return "monitoring : UNKNOWN TG";
else if(monitoringState == IGNORED_TG)
return "monitoring : IGNORED TG";
else if(monitoringState == NO_SOURCE)
return "monitoring : NO SOURCE COVERING FREQ";
else if(monitoringState == NO_RECORDER)
return "monitoring : NO RECORDER AVAILABLE";
else if(monitoringState == ENCRYPTED)
return "monitoring : ENCRYPTED";
else if(monitoringState == DUPLICATE)
return "monitoring : DUPLICATE";
else if(monitoringState == SUPERSEDED)
return "monitoring : SUPERSEDED";
else
return "monitoring";
}
else if (state == RECORDING)
return "recording";
else if (state == INACTIVE)
return "inactive";
else if (state == ACTIVE)
return "active";
else if (state == IDLE)
return "idle";
else if (state == COMPLETED)
return "completed";
else if (state == STOPPED)
return "stopped";
else if (state == AVAILABLE)
return "available";
return "Unknown";
}
return boost::lexical_cast<std::string>(state);
}

1 change: 1 addition & 0 deletions trunk-recorder/formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
extern boost::format format_freq(double f);
extern boost::format FormatSamplingRate(float f);
extern std::string format_state(State state);
extern std::string format_state(State state, MonitoringState monitoringState);
std::string get_frequency_format();
extern int frequency_format;
extern bool statusAsString;
Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/gr_blocks/transmission_sink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void transmission_sink::set_source(long src) {
gr::thread::scoped_lock guard(d_mutex);

if (curr_src_id == -1) {

BOOST_LOG_TRIVIAL(info) << "[" << d_current_call_short_name << "]\t\033[0;34m" << d_current_call_num << "C\033[0m\tTG: " << d_current_call_talkgroup_display << "\tFreq: " << format_freq(d_current_call_freq) << "\tUnit ID set via Control Channel, ext: " << src << "\tcurrent: " << curr_src_id << "\t samples: " << d_sample_count;

curr_src_id = src;
Expand Down
Loading

0 comments on commit 47c27ca

Please sign in to comment.