app_send(app, msg);
}
-static void blob_handler(struct app *app, struct ast_channel_blob *blob)
-{
- /* To simplify events, we'll only generate on DTMF end */
- if (strcmp(ast_channel_blob_json_type(blob), "dtmf_end") == 0) {
- dtmf_handler(app, blob);
- }
-}
-
static void sub_handler(void *data, struct stasis_subscription *sub,
struct stasis_topic *topic,
struct stasis_message *message)
{
struct app *app = data;
+
+ if (stasis_subscription_final_message(sub, message)) {
+ ao2_cleanup(data);
+ return;
+ }
+
if (ast_channel_snapshot_type() == stasis_message_type(message)) {
RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
struct ast_channel_snapshot *snapshot =
return;
}
app_send(app, msg);
- } else if (ast_channel_blob_type() == stasis_message_type(message)) {
+ } else if (ast_channel_dtmf_end_type() == stasis_message_type(message)) {
+ /* To simplify events, we'll only generate on DTMF end */
struct ast_channel_blob *blob = stasis_message_data(message);
- blob_handler(app, blob);
- }
- if (stasis_subscription_final_message(sub, message)) {
- ao2_cleanup(data);
+ dtmf_handler(app, blob);
}
+
}
/*!