app_chanspy: Spyee information missing in ChanSpyStop AMI Event

The documentation in the wiki says there should be spyee-channel
information elements in the ChanSpyStop AMI event.

    https://wiki.asterisk.org/wiki/x/Xc5uAg

However, this is not the case in Asterisk <= 16.10.0 Version. We're
using these Spyee* arguments since Asterisk 11.x, so these arguments
vanished in Asterisk 12 or higher.

For maximum compatibility, we still send the ChanSpyStop event even if
we are not able to find any 'Spyee' information.

ASTERISK-28883 #close

Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
This commit is contained in:
Sean Bright
2020-12-11 14:27:56 -05:00
committed by George Joseph
parent 4b450b4334
commit 13682210e2
3 changed files with 25 additions and 11 deletions

View File

@@ -808,12 +808,15 @@ static void channel_chanspy_stop_cb(void *data, struct stasis_subscription *sub,
struct stasis_message *message)
{
RAII_VAR(struct ast_str *, spyer_channel_string, NULL, ast_free);
RAII_VAR(struct ast_str *, spyee_channel_string, NULL, ast_free);
struct ast_channel_snapshot *spyer;
struct ast_channel_snapshot *spyee;
const char *spyee_info = "";
struct ast_multi_channel_blob *payload = stasis_message_data(message);
spyer = ast_multi_channel_blob_get_channel(payload, "spyer_channel");
if (!spyer) {
ast_log(AST_LOG_WARNING, "Received ChanSpy Start event with no spyer channel!\n");
ast_log(AST_LOG_WARNING, "Received ChanSpy Stop event with no spyer channel!\n");
return;
}
@@ -822,9 +825,18 @@ static void channel_chanspy_stop_cb(void *data, struct stasis_subscription *sub,
return;
}
spyee = ast_multi_channel_blob_get_channel(payload, "spyee_channel");
if (spyee) {
spyee_channel_string = ast_manager_build_channel_state_string_prefix(spyee, "Spyee");
if (spyee_channel_string) {
spyee_info = ast_str_buffer(spyee_channel_string);
}
}
manager_event(EVENT_FLAG_CALL, "ChanSpyStop",
"%s",
ast_str_buffer(spyer_channel_string));
"%s%s",
ast_str_buffer(spyer_channel_string),
spyee_info);
}
static void channel_chanspy_start_cb(void *data, struct stasis_subscription *sub,