summaryrefslogtreecommitdiff
path: root/apps/app_chanspy.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-08-06 12:55:28 +0000
committerKinsey Moore <kmoore@digium.com>2014-08-06 12:55:28 +0000
commitf1036f40dc22c4d4b30cc2ab36199cd749ead9c5 (patch)
tree4fd17b406cb14b5eee97cf0be44382b792ccbff9 /apps/app_chanspy.c
parentac5c75b45d9d7fe047ccd9d1d094cb9d30df8b51 (diff)
Stasis: Allow message types to be blocked
This introduces stasis.conf and a mechanism to prevent certain message types from being published. Internally, this works by preventing the chosen message types from being created which ensures that those message types can never be published. This patch also adjusts message publishers such that message payloads are not created if the related message type is not available. ASTERISK-23943 #close Review: https://reviewboard.asterisk.org/r/3823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_chanspy.c')
-rw-r--r--apps/app_chanspy.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index af69be303..5806b997d 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -557,13 +557,14 @@ static void publish_chanspy_message(struct ast_channel *spyer,
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+ struct stasis_message_type *type = start ? ast_channel_chanspy_start_type(): ast_channel_chanspy_stop_type();
if (!spyer) {
ast_log(AST_LOG_WARNING, "Attempt to publish ChanSpy message for NULL spyer channel\n");
return;
}
blob = ast_json_null();
- if (!blob) {
+ if (!blob || !type) {
return;
}
@@ -582,9 +583,7 @@ static void publish_chanspy_message(struct ast_channel *spyer,
}
}
- message = stasis_message_create(
- start ? ast_channel_chanspy_start_type(): ast_channel_chanspy_stop_type(),
- payload);
+ message = stasis_message_create(type, payload);
if (!message) {
return;
}