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

@@ -267,6 +267,10 @@ void ast_bridge_publish_state(struct ast_bridge *bridge)
RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_bridge_snapshot_type()) {
return;
}
ast_assert(bridge != NULL);
snapshot = ast_bridge_snapshot_create(bridge);
@@ -358,6 +362,10 @@ void ast_bridge_publish_merge(struct ast_bridge *to, struct ast_bridge *from)
RAII_VAR(struct ast_bridge_merge_message *, merge_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_bridge_merge_message_type()) {
return;
}
ast_assert(to != NULL);
ast_assert(from != NULL);
@@ -394,6 +402,10 @@ struct stasis_message *ast_bridge_blob_create(
RAII_VAR(struct ast_bridge_blob *, obj, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!message_type) {
return NULL;
}
obj = ao2_alloc(sizeof(*obj), bridge_blob_dtor);
if (!obj) {
return NULL;
@@ -958,6 +970,10 @@ void ast_bridge_publish_attended_transfer_fail(int is_external, enum ast_transfe
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_attended_transfer_type()) {
return;
}
transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
@@ -980,6 +996,10 @@ void ast_bridge_publish_attended_transfer_bridge_merge(int is_external, enum ast
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_attended_transfer_type()) {
return;
}
transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
@@ -1004,6 +1024,10 @@ void ast_bridge_publish_attended_transfer_threeway(int is_external, enum ast_tra
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_attended_transfer_type()) {
return;
}
transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
@@ -1037,6 +1061,10 @@ void ast_bridge_publish_attended_transfer_app(int is_external, enum ast_transfer
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!ast_attended_transfer_type()) {
return;
}
transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
@@ -1061,6 +1089,10 @@ void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfe
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
int i;
if (!ast_attended_transfer_type()) {
return;
}
transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;