From a7de24c47b4b9ecb840d9e52f77381161453219a Mon Sep 17 00:00:00 2001 From: ilyacodes <33097525+ilyacodes@users.noreply.github.com> Date: Mon, 18 Mar 2024 07:47:34 -0400 Subject: [PATCH] EDACS: fixes and improvements to EA analog and i-call parsing (#204) * Fix MT1 math given esk_mask value is 0xA0 * EDACS: Clean up formatting for I-Calls * EDACS: typo, fix the TGID for group calls Fix copy-pasta * EDACS: Fix MT2 for I-Calls Incorrectly copied decimal values as hex - obviously MT2 is only 4 bits so it cannot be greater than 15. * EDACS: check LCN is > 0 before trying to tune An EA CC sometimes includes commands that parse as LCN 0 - but otherwise valid - analog call voice grants for TG 1. Since LCN 0 is not valid, ensure that we don't try to tune to them while we try to figure out what they're about. * EDACS: Process "login" message on CC Log "login" messages sent on the CC. Verified behaviour against UniTrunker. --- src/dsd_ncurses.c | 2 +- src/edacs-fme.c | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index db930dc..51f06de 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -3618,7 +3618,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("Target [%8lld] Source [%8lld] I-Call", call_matrix[j][2] - 100000, call_matrix[j][3]); else // Group call - printw ("Target [%8lld] Source [%8lld]", call_matrix[j][2] - 100000, call_matrix[j][3]); + printw ("Target [%8lld] Source [%8lld]", call_matrix[j][2], call_matrix[j][3]); } else { diff --git a/src/edacs-fme.c b/src/edacs-fme.c index dcb8e0c..393db86 100644 --- a/src/edacs-fme.c +++ b/src/edacs-fme.c @@ -651,7 +651,7 @@ void edacs(dsd_opts * opts, dsd_state * state) //this is working now with the new import setup if (opts->trunk_tune_group_calls == 1 && opts->p25_trunk == 1 && (strcmp(mode, "DE") != 0) && (strcmp(mode, "B") != 0) ) //DE is digital encrypted, B is block { - if (lcn < 26 && state->trunk_lcn_freq[lcn-1] != 0) //don't tune if zero (not loaded or otherwise) + if (lcn > 0 && lcn < 26 && state->trunk_lcn_freq[lcn-1] != 0) //don't tune if zero (not loaded or otherwise) { //openwav file and do per call right here, should probably check as well to make sure we have a valid trunking method active (rigctl, rtl) if (opts->dmr_stereo_wav == 1 && (opts->use_rigctl == 1 || opts->audio_in_type == 3)) @@ -714,20 +714,20 @@ void edacs(dsd_opts * opts, dsd_state * state) //if we are using allow/whitelist mode, then write 'B' to mode for block - no allow/whitelist support for i-calls if (opts->trunk_use_allow_list == 1) sprintf (mode, "%s", "B"); - if (mt2 == 0x10) fprintf (stderr, " Analog Call"); - if (mt2 == 0x14) fprintf (stderr, " Digital Call"); + if (mt2 == 0xA) fprintf (stderr, " Analog Call"); + if (mt2 == 0xE) fprintf (stderr, " Digital Call"); fprintf (stderr, "%s", KNRM); //this is working now with the new import setup if (opts->trunk_tune_private_calls == 1 && opts->p25_trunk == 1 && (strcmp(mode, "DE") != 0) && (strcmp(mode, "B") != 0) ) //DE is digital encrypted, B is block { - if (lcn < 26 && state->trunk_lcn_freq[lcn-1] != 0) //don't tune if zero (not loaded or otherwise) + if (lcn > 0 && lcn < 26 && state->trunk_lcn_freq[lcn-1] != 0) //don't tune if zero (not loaded or otherwise) { //openwav file and do per call right here, should probably check as well to make sure we have a valid trunking method active (rigctl, rtl) if (opts->dmr_stereo_wav == 1 && (opts->use_rigctl == 1 || opts->audio_in_type == 3)) { sprintf (opts->wav_out_file, "./WAV/%s %s EDACS Site %lld TGT %d SRC %d.wav", getDateE(), timestr, state->edacs_site_id, target, source); - if (mt2 == 0x14) //digital + if (mt2 == 0xE) //digital openWavOutFile (opts, state); else //analog openWavOutFile48k (opts, state); // @@ -741,7 +741,7 @@ void edacs(dsd_opts * opts, dsd_state * state) state->edacs_tuned_lcn = lcn; opts->p25_is_tuned = 1; // - if (mt2 == 0x10) + if (mt2 == 0xA) //analog edacs_analog(opts, state, target, lcn); } @@ -760,6 +760,13 @@ void edacs(dsd_opts * opts, dsd_state * state) } } } + //Login + else if (mt1 == 0x19) + { + int group = (fr_1t & 0xFFFF000) >> 12; + int source = (fr_4t & 0xFFFFF000) >> 12; + fprintf (stderr, " Login Group [%08d] Source [%08d]", group, source); + } else //print frames for debug/analysis { fprintf (stderr, " FR_1 [%010llX]", fr_1t);