mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
AMI: Add AMI event to expose hook flash events
Although Asterisk can receive and propogate flash events, it currently provides no mechanism for doing anything with them itself. This AMI event allows flash events to be processed by Asterisk. Additionally, AST_CONTROL_FLASH is included in a switch statement in channel.c to avoid throwing a warning when we shouldn't. ASTERISK-29380 Change-Id: Ie17ffe65086e0282c88542e38eed6a461ec79e81
This commit is contained in:
committed by
Joshua Colp
parent
7b82587dd6
commit
0ad3504ce0
@@ -968,6 +968,24 @@ static void channel_dtmf_end_cb(void *data, struct stasis_subscription *sub,
|
||||
digit, duration_ms, direction);
|
||||
}
|
||||
|
||||
static void channel_flash_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
struct ast_channel_blob *obj = stasis_message_data(message);
|
||||
struct ast_str *channel_event_string;
|
||||
|
||||
channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
|
||||
if (!channel_event_string) {
|
||||
return;
|
||||
}
|
||||
|
||||
manager_event(EVENT_FLAG_CALL, "Flash",
|
||||
"%s",
|
||||
ast_str_buffer(channel_event_string));
|
||||
|
||||
ast_free(channel_event_string);
|
||||
}
|
||||
|
||||
static void channel_hangup_handler_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
@@ -1327,6 +1345,9 @@ int manager_channels_init(void)
|
||||
ret |= stasis_message_router_add(message_router,
|
||||
ast_channel_dtmf_end_type(), channel_dtmf_end_cb, NULL);
|
||||
|
||||
ret |= stasis_message_router_add(message_router,
|
||||
ast_channel_flash_type(), channel_flash_cb, NULL);
|
||||
|
||||
ret |= stasis_message_router_add(message_router,
|
||||
ast_channel_hangup_request_type(), channel_hangup_request_cb,
|
||||
NULL);
|
||||
|
Reference in New Issue
Block a user