Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor fix to unit answer reqest logging #663

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Here is a map of the different sections of the *config.json* file:
| broadcastifySystemId | | | number | [*if broadcastifyCallsServer is set*] System ID for Broadcastify Calls <br />(this is an integer, and different from the RadioReference system ID) |
| uploadScript | | | string | This is the filename of a script that is called after each recording has finished. Checkout *encode-upload.sh.sample* as an example. The script should be located in the same directory as the trunk-recorder executable. |
| compressWav | | true | bool | Convert the recorded .wav file to an .m4a file. **This is required for both OpenMHz and Broadcastify!** The `sox` and `fdkaac` packages need to be installed for this command to work. |
| unitScript | | | string | This is the filename of a script that runs when a radio (unit) registers (is turned on), affiliates (joins a talk group), deregisters (is turned off), sends an acknowledgment response or transmits. Passed as parameters: `shortName radioID on\|join\|off\|ackresp\|call\|data\|ans_req\|location`. On joins and transmissions, `talkgroup` is passed as a fourth parameter. On joins and transmissions, `patchedTalkgroups` (comma separated list of talkgroup IDs) is passed as a fifth parameter if the talkgroup is part of a patch on the system. See *examples/unit-script.sh* for a logging example. Note that for paths relative to recorder, this should start with `./`( or `../`). |
| unitScript | | | string | This is the filename of a script that runs when a radio (unit) registers (is turned on), affiliates (joins a talk group), deregisters (is turned off), gets an acknowledgment response, transmits, gets a data channel grant, a unit-unit answer request or a Location Registration Response. Passed as parameters: `shortName radioID on\|join\|off\|ackresp\|call\|data\|ans_req\|location`. On joins and transmissions, `talkgroup` is passed as a fourth parameter; on answer requests, the `source` is. On joins and transmissions, `patchedTalkgroups` (comma separated list of talkgroup IDs) is passed as a fifth parameter if the talkgroup is part of a patch on the system. See *examples/unit-script.sh* for a logging example. Note that for paths relative to recorder, this should start with `./`( or `../`). |
| audioArchive | | true | **true** / **false** | Should the recorded audio files be kept after successfully uploading them? |
| transmissionArchive | | false | **true** / **false** | Should each of the individual transmission be kept? These transmission are combined together with other recent ones to form a single call. |
| callLog | | false | **true** / **false** | Should a json file with the call details be kept after successful uploads? |
Expand Down
4 changes: 2 additions & 2 deletions plugins/unit_script/unit_script.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ int unit_data_grant(System *sys, long source_id) {
return 1;
}

int unit_answer_request(System *sys, long source_id) {
int unit_answer_request(System *sys, long source_id, long talkgroup) {
std::string system_script = get_system_script(sys->get_short_name());
if ((system_script != "") && (source_id != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li ans_req &", system_script.c_str(), sys->get_short_name().c_str(), source_id);
sprintf(shell_command, "%s %s %li ans_req %li &", system_script.c_str(), sys->get_short_name().c_str(), source_id, talkgroup);
int rc = system(shell_command);
return 0;
}
Expand Down
10 changes: 7 additions & 3 deletions trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,8 @@ void unit_data_grant(System *sys, long source_id) {
plugman_unit_data_grant(sys, source_id);
}

void unit_answer_request(System *sys, long source_id) {
plugman_unit_answer_request(sys, source_id);
void unit_answer_request(System *sys, long source_id, long talkgroup) {
plugman_unit_answer_request(sys, source_id, talkgroup);
}

void unit_location(System *sys, long source_id, long talkgroup_num) {
Expand Down Expand Up @@ -1048,7 +1048,7 @@ void handle_message(std::vector<TrunkMessage> messages, System *sys) {
break;

case UU_ANS_REQ:
unit_answer_request(sys, message.source);
unit_answer_request(sys, message.source, message.talkgroup);
break;

case UNKNOWN:
Expand Down Expand Up @@ -1236,6 +1236,10 @@ void monitor_messages() {
}
}

if (msg->type() == -1) {
BOOST_LOG_TRIVIAL(error) << "[" << sys->get_short_name() << "]\t process_data_unit timeout";
}

msg.reset();
} else {
current_time = time(NULL);
Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/plugin_manager/plugin_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Plugin_Api {
virtual int unit_acknowledge_response(System *sys, long source_id) { return 0; };
virtual int unit_group_affiliation(System *sys, long source_id, long talkgroup_num) { return 0; };
virtual int unit_data_grant(System *sys, long source_id) { return 0; };
virtual int unit_answer_request(System *sys, long source_id) { return 0; };
virtual int unit_answer_request(System *sys, long source_id, long talkgroup) { return 0; };
virtual int unit_location(System *sys, long source_id, long talkgroup_num) { return 0; };
void set_frequency_format(int f) { frequencyFormat = f;}
virtual ~Plugin_Api(){};
Expand Down
4 changes: 2 additions & 2 deletions trunk-recorder/plugin_manager/plugin_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ void plugman_unit_data_grant(System *system, long source_id) {
}
}
}
void plugman_unit_answer_request(System *system, long source_id) {
void plugman_unit_answer_request(System *system, long source_id, long talkgroup) {
for (std::vector<Plugin *>::iterator it = plugins.begin(); it != plugins.end(); it++) {
Plugin *plugin = *it;
if (plugin->state == PLUGIN_RUNNING) {
plugin->api->unit_data_grant(system, source_id);
plugin->api->unit_data_grant(system, source_id), talkgroup;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/plugin_manager/plugin_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ void plugman_unit_deregistration(System * system, long source_id);
void plugman_unit_acknowledge_response(System * system, long source_id);
void plugman_unit_group_affiliation(System * system, long source_id, long talkgroup_num);
void plugman_unit_data_grant(System * system, long source_id);
void plugman_unit_answer_request(System * system, long source_id);
void plugman_unit_answer_request(System * system, long source_id, long talkgroup);
void plugman_unit_location(System * system, long source_id, long talkgroup_num);
#endif // PLUGIN_MANAGER_H
1 change: 1 addition & 0 deletions trunk-recorder/systems/p25_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ std::vector<TrunkMessage> P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk,
message.mode = mode;
message.priority = priority;
message.source = sa;
message.talkgroup = si;

BOOST_LOG_TRIVIAL(debug) << "tsbk05\tUnit To Unit Answer Request\tsa " << sa << "\tSource ID: " << si;
} else if (opcode == 0x06) { // Unit to Unit Voice Channel Grant Update (UU_V_CH_GRANT_UPDT)
Expand Down