diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md
index f631f24b8..f7f41c0aa 100644
--- a/docs/CONFIGURE.md
+++ b/docs/CONFIGURE.md
@@ -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
(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? |
diff --git a/plugins/unit_script/unit_script.cc b/plugins/unit_script/unit_script.cc
index 4bc5d1342..43fd53556 100644
--- a/plugins/unit_script/unit_script.cc
+++ b/plugins/unit_script/unit_script.cc
@@ -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;
}
diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc
index ae53cf789..0ad2411ce 100755
--- a/trunk-recorder/main.cc
+++ b/trunk-recorder/main.cc
@@ -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) {
@@ -1048,7 +1048,7 @@ void handle_message(std::vector 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:
diff --git a/trunk-recorder/plugin_manager/plugin_api.h b/trunk-recorder/plugin_manager/plugin_api.h
index 67306613a..1a8610948 100644
--- a/trunk-recorder/plugin_manager/plugin_api.h
+++ b/trunk-recorder/plugin_manager/plugin_api.h
@@ -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(){};
diff --git a/trunk-recorder/plugin_manager/plugin_manager.cc b/trunk-recorder/plugin_manager/plugin_manager.cc
index 3ee81ceaa..573c7f843 100644
--- a/trunk-recorder/plugin_manager/plugin_manager.cc
+++ b/trunk-recorder/plugin_manager/plugin_manager.cc
@@ -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::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;
}
}
}
diff --git a/trunk-recorder/plugin_manager/plugin_manager.h b/trunk-recorder/plugin_manager/plugin_manager.h
index 94805fef7..aa72feca2 100644
--- a/trunk-recorder/plugin_manager/plugin_manager.h
+++ b/trunk-recorder/plugin_manager/plugin_manager.h
@@ -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
diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc
index 81700af44..8b07bdaa6 100644
--- a/trunk-recorder/systems/p25_parser.cc
+++ b/trunk-recorder/systems/p25_parser.cc
@@ -490,6 +490,7 @@ std::vector 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)