ARI: Deleting log channels

An http request can be sent to delete a log channel
in Asterisk.

The command "curl -v -u user:pass -X DELETE 'http://localhost:8088
/ari/asterisk/logging/mylog'" can be run in the terminal
to access the newly implemented functionally for ARI.

* Able to delete log channels using ARI

ASTERISK-25252

Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6
This commit is contained in:
Scott Emidy
2015-08-06 15:18:04 -05:00
parent ca84a4b235
commit f19c4930c2
8 changed files with 218 additions and 12 deletions

View File

@@ -653,6 +653,29 @@ void ast_ari_asterisk_rotate_log(struct ast_variable *headers,
ast_ari_response_no_content(response);
}
void ast_ari_asterisk_delete_log(struct ast_variable *headers,
struct ast_ari_asterisk_delete_log_args *args,
struct ast_ari_response *response)
{
int res;
ast_assert(response != NULL);
res = ast_logger_remove_channel(args->log_channel_name);
if (res == AST_LOGGER_FAILURE) {
ast_ari_response_error(response, 404, "Not Found",
"Log channel does not exist");
return;
} else if (res == AST_LOGGER_ALLOC_ERROR) {
ast_ari_response_error(response, 500, "Internal Server Error",
"Allocation failed");
return;
}
ast_ari_response_no_content(response);
}
void ast_ari_asterisk_get_global_var(struct ast_variable *headers,
struct ast_ari_asterisk_get_global_var_args *args,
struct ast_ari_response *response)