diff --git a/configs/samples/stasis.conf.sample b/configs/samples/stasis.conf.sample index 6fadc74073..b62d1c60ae 100644 --- a/configs/samples/stasis.conf.sample +++ b/configs/samples/stasis.conf.sample @@ -54,6 +54,7 @@ ; decline=ast_channel_dtmf_begin_type ; decline=ast_channel_dtmf_end_type ; decline=ast_channel_flash_type +; decline=ast_channel_wink_type ; decline=ast_channel_hold_type ; decline=ast_channel_unhold_type ; decline=ast_channel_chanspy_start_type diff --git a/doc/CHANGES-staging/ami_wink.txt b/doc/CHANGES-staging/ami_wink.txt new file mode 100644 index 0000000000..9d27cca87f --- /dev/null +++ b/doc/CHANGES-staging/ami_wink.txt @@ -0,0 +1,3 @@ +Subject: ami + +An AMI event now exists for "Wink". diff --git a/include/asterisk/stasis_channels.h b/include/asterisk/stasis_channels.h index f345228717..80c79ebd2e 100644 --- a/include/asterisk/stasis_channels.h +++ b/include/asterisk/stasis_channels.h @@ -528,6 +528,13 @@ struct stasis_message_type *ast_channel_dtmf_end_type(void); */ struct stasis_message_type *ast_channel_flash_type(void); +/*! + * \brief Message type for when a wink occurs on a channel. + * + * \return A stasis message type + */ +struct stasis_message_type *ast_channel_wink_type(void); + /*! * \since 12 * \brief Message type for when a channel is placed on hold. diff --git a/main/channel.c b/main/channel.c index e5a6bc9d59..3428e3a9e7 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3405,6 +3405,11 @@ static void send_flash_event(struct ast_channel *chan) ast_channel_publish_blob(chan, ast_channel_flash_type(), NULL); } +static void send_wink_event(struct ast_channel *chan) +{ + ast_channel_publish_blob(chan, ast_channel_wink_type(), NULL); +} + static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f) { struct ast_generator *generator; @@ -3873,6 +3878,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio, int f = &ast_null_frame; } else if (f->subclass.integer == AST_CONTROL_FLASH) { send_flash_event(chan); + } else if (f->subclass.integer == AST_CONTROL_WINK) { + send_wink_event(chan); } break; case AST_FRAME_DTMF_END: diff --git a/main/manager_channels.c b/main/manager_channels.c index a7cec8def8..8af3465a29 100644 --- a/main/manager_channels.c +++ b/main/manager_channels.c @@ -1000,6 +1000,34 @@ static void channel_flash_cb(void *data, struct stasis_subscription *sub, ast_free(channel_event_string); } +static void channel_wink_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; + } + + /*** DOCUMENTATION + + + Raised when a wink occurs on a channel. + + + + + + ***/ + manager_event(EVENT_FLAG_CALL, "Wink", + "%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) { @@ -1362,6 +1390,9 @@ int manager_channels_init(void) ret |= stasis_message_router_add(message_router, ast_channel_flash_type(), channel_flash_cb, NULL); + ret |= stasis_message_router_add(message_router, + ast_channel_wink_type(), channel_wink_cb, NULL); + ret |= stasis_message_router_add(message_router, ast_channel_hangup_request_type(), channel_hangup_request_cb, NULL); diff --git a/main/stasis.c b/main/stasis.c index a75fe66647..cf89a9980b 100644 --- a/main/stasis.c +++ b/main/stasis.c @@ -121,6 +121,7 @@ + diff --git a/main/stasis_channels.c b/main/stasis_channels.c index 5e39c07654..8becf96f89 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -1599,6 +1599,7 @@ STASIS_MESSAGE_TYPE_DEFN(ast_channel_unhold_type, .to_json = unhold_to_json, ); STASIS_MESSAGE_TYPE_DEFN(ast_channel_flash_type); +STASIS_MESSAGE_TYPE_DEFN(ast_channel_wink_type); STASIS_MESSAGE_TYPE_DEFN(ast_channel_chanspy_start_type); STASIS_MESSAGE_TYPE_DEFN(ast_channel_chanspy_stop_type); STASIS_MESSAGE_TYPE_DEFN(ast_channel_fax_type); @@ -1644,6 +1645,7 @@ static void stasis_channels_cleanup(void) STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_begin_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_end_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_flash_type); + STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_wink_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_hold_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_unhold_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_chanspy_start_type); @@ -1698,6 +1700,7 @@ int ast_stasis_channels_init(void) res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_begin_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_end_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_flash_type); + res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_wink_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hold_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_unhold_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_chanspy_start_type);