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
This commit is contained in:
Kinsey Moore
2014-08-06 12:55:28 +00:00
parent ac5c75b45d
commit f1036f40dc
39 changed files with 708 additions and 73 deletions

View File

@@ -304,6 +304,10 @@ void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_cha
RAII_VAR(struct ast_channel_snapshot *, peer_snapshot, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, forwarded_snapshot, NULL, ao2_cleanup);
if (!ast_channel_dial_type()) {
return;
}
ast_assert(peer != NULL);
blob = ast_json_pack("{s: s, s: s, s: s}",
"dialstatus", S_OR(dialstatus, ""),
@@ -405,9 +409,15 @@ struct stasis_message *ast_channel_blob_create_from_cache(const char *channel_id
struct ast_json *blob)
{
RAII_VAR(struct ast_channel_snapshot *, snapshot,
ast_channel_snapshot_get_latest(channel_id),
NULL,
ao2_cleanup);
if (!type) {
return NULL;
}
snapshot = ast_channel_snapshot_get_latest(channel_id);
return create_channel_blob_message(snapshot, type, blob);
}
@@ -416,6 +426,10 @@ struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
{
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
if (!type) {
return NULL;
}
if (chan) {
snapshot = ast_channel_snapshot_create(chan);
}
@@ -644,6 +658,10 @@ void ast_channel_publish_snapshot(struct ast_channel *chan)
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
if (!ast_channel_snapshot_type()) {
return;
}
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE)) {
return;
}
@@ -793,6 +811,10 @@ void ast_publish_channel_state(struct ast_channel *chan)
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
if (!ast_channel_snapshot_type()) {
return;
}
ast_assert(chan != NULL);
if (!chan) {
return;