feat: ARI "ChannelToneDetected" event

A stasis event is now produced when using the TONE_DETECT dialplan
function. This event is published over ARI using the ChannelToneDetected
event. This change does not make it available over AMI.

Fixes: #811

UserNote: Setting the TONE_DETECT dialplan function on a channel
in ARI will now cause a ChannelToneDetected ARI event to be raised
when the specified tone is detected.
This commit is contained in:
gibbz00
2024-07-18 12:13:25 +02:00
committed by asterisk-org-access-app[bot]
parent 0f67c2696f
commit 99a5064a07
8 changed files with 169 additions and 0 deletions

View File

@@ -1592,6 +1592,13 @@ static struct ast_json *hold_to_json(struct stasis_message *message,
"channel", json_channel);
}
static struct ast_json *tone_detect_to_json(struct stasis_message *message,
const struct stasis_message_sanitizer *sanitize)
{
return channel_blob_to_json(message, "ChannelToneDetected", sanitize);
}
static struct ast_json *unhold_to_json(struct stasis_message *message,
const struct stasis_message_sanitizer *sanitize)
{
@@ -1661,6 +1668,9 @@ STASIS_MESSAGE_TYPE_DEFN(ast_channel_talking_stop,
.to_ami = talking_stop_to_ami,
.to_json = talking_stop_to_json,
);
STASIS_MESSAGE_TYPE_DEFN(ast_channel_tone_detect,
.to_json = tone_detect_to_json,
);
/*! @} */
@@ -1697,6 +1707,7 @@ static void stasis_channels_cleanup(void)
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_agent_logoff_type);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_talking_start);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_talking_stop);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_tone_detect);
}
int ast_stasis_channels_init(void)
@@ -1748,6 +1759,7 @@ int ast_stasis_channels_init(void)
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_mixmonitor_mute_type);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_talking_start);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_talking_stop);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_tone_detect);
return res;
}