; decline=ast_channel_hangup_request_type
; decline=ast_channel_dtmf_begin_type
; decline=ast_channel_dtmf_end_type
+; decline=ast_channel_flash_type
; decline=ast_channel_hold_type
; decline=ast_channel_unhold_type
; decline=ast_channel_chanspy_start_type
--- /dev/null
+Subject: AMI Flash event
+
+Hook flash events are now exposed as AMI events.
*/
struct stasis_message_type *ast_channel_dtmf_end_type(void);
+/*!
+ * \brief Message type for when a hook flash occurs on a channel.
+ *
+ * \retval A stasis message type
+ */
+struct stasis_message_type *ast_channel_flash_type(void);
+
/*!
* \since 12
* \brief Message type for when a channel is placed on hold.
case AST_CONTROL_UPDATE_RTP_PEER:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
+ case AST_CONTROL_FLASH:
case -1:
/* Unimportant */
break;
ast_channel_publish_cached_blob(chan, ast_channel_dtmf_end_type(), blob);
}
+static void send_flash_event(struct ast_channel *chan)
+{
+ ast_channel_publish_blob(chan, ast_channel_flash_type(), NULL);
+}
+
static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)
{
struct ast_generator *generator;
*/
ast_frfree(f);
f = &ast_null_frame;
+ } else if (f->subclass.integer == AST_CONTROL_FLASH) {
+ send_flash_event(chan);
}
break;
case AST_FRAME_DTMF_END:
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)
{
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);
<enum name="ast_channel_hangup_request_type" />
<enum name="ast_channel_dtmf_begin_type" />
<enum name="ast_channel_dtmf_end_type" />
+ <enum name="ast_channel_flash_type" />
<enum name="ast_channel_hold_type" />
<enum name="ast_channel_unhold_type" />
<enum name="ast_channel_chanspy_start_type" />
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_chanspy_start_type);
STASIS_MESSAGE_TYPE_DEFN(ast_channel_chanspy_stop_type);
STASIS_MESSAGE_TYPE_DEFN(ast_channel_fax_type);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_masquerade_type);
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_hold_type);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_unhold_type);
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_chanspy_start_type);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_masquerade_type);
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_hold_type);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_unhold_type);
res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_chanspy_start_type);