ARI event type filtering

Event type filtering is now enabled, and configurable per application. An app is
now able to specify which events are sent to the application by configuring an
allowed and/or disallowed list(s). This can be done by issuing the following:

PUT /applications/{applicationName}/eventFilter

And then enumerating the allowed/disallowed event types as a body parameter.

ASTERISK-28106

Change-Id: I9671ba1fcdb3b6c830b553d4c5365aed5d588d5b
This commit is contained in:
Kevin Harwell
2019-02-08 14:21:38 -06:00
committed by George Joseph
parent 4a871c4b79
commit 1c5def4b18
11 changed files with 402 additions and 5 deletions

View File

@@ -168,3 +168,23 @@ void ast_ari_applications_unsubscribe(struct ast_variable *headers,
"Error processing request");
}
}
void ast_ari_applications_filter(struct ast_variable *headers,
struct ast_ari_applications_filter_args *args,
struct ast_ari_response *response)
{
struct stasis_app *app = stasis_app_get_by_name(args->application_name);
if (!app) {
ast_ari_response_error(response, 404, "Not Found", "Application not found");
return;
}
if (stasis_app_event_filter_set(app, args->filter)) {
ast_ari_response_error(response, 400, "Bad Request", "Invalid format definition");
} else {
ast_ari_response_ok(response, stasis_app_object_to_json(app));
}
ao2_ref(app, -1);
}