From f71773573b9cfe434aa0720a7b482846713a16d0 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Wed, 19 Jan 2022 22:59:14 -0500 Subject: [PATCH] Stops calls if an overlap in freq is detected --- trunk-recorder/main.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 5e5bdd679..011b02e35 100755 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -953,7 +953,10 @@ void handle_call(TrunkMessage message, System *sys) { /* Notes: it is possible for 2 Calls to exist for the same talkgroup on different freq. This happens when a Talkgroup starts on a freq that current recorder can't retune to. In this case, the current orig Talkgroup reocrder will keep going on the old freq, while a new recorder is start on a source that can cover that freq. This makes sure any of the remaining transmission that it is in the buffer - of the original recorder gets flushed. */ + of the original recorder gets flushed. + UPDATED: however if we have 2 different talkgroups on the same freq we should do a stop_call on the original call since it is being used by another TG now. This will let the recorder keep + going until it gets a termination flag. + */ for (vector::iterator it = calls.begin(); it != calls.end(); ++it) { Call *call = *it; @@ -969,8 +972,15 @@ void handle_call(TrunkMessage message, System *sys) { if (source_updated) { plugman_call_start(call); } - break; } + + // There is an existing call on freq and slot that the new call will be started on. We should stop the older call. The older recorder will + // keep writing to the file until it hits a termination flag, so no packets should be dropped. + if ((call->get_state() == RECORDING) && (call->get_talkgroup() != message.talkgroup) && (call->get_sys_num() == message.sys_num) && (call->get_freq() == message.freq) && (call->get_tdma_slot() == message.tdma_slot) && (call->get_phase2_tdma() == message.phase2_tdma)) { + BOOST_LOG_TRIVIAL(info) << "\t - Stopping call because of overlapping Freq"; + call->stop_call(); + } + } if (!call_found) {