mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
ARI: Creating log channels
An http request can be sent to create a log channel in Asterisk. The command "curl -v -u user:pass -X POST 'http://localhost:088/ari/asterisk/logging/mylog? configuration=notice,warning'" can be run in the terminal to access the newly implemented functionality for ARI. * Ability to create log channels using ARI ASTERISK-25252 Change-Id: I9a20e5c75716dfbb6b62fd3474faf55be20bd782
This commit is contained in:
@@ -628,6 +628,33 @@ void ast_ari_asterisk_reload_module(struct ast_variable *headers,
|
||||
ast_ari_response_no_content(response);
|
||||
}
|
||||
|
||||
void ast_ari_asterisk_add_log(struct ast_variable *headers,
|
||||
struct ast_ari_asterisk_add_log_args *args,
|
||||
struct ast_ari_response *response)
|
||||
{
|
||||
int res;
|
||||
|
||||
ast_assert(response != NULL);
|
||||
|
||||
res = ast_logger_create_channel(args->log_channel_name, args->configuration);
|
||||
|
||||
if (res == AST_LOGGER_DECLINE) {
|
||||
ast_ari_response_error(response, 400, "Bad Request",
|
||||
"Configuration levels are required");
|
||||
return;
|
||||
} else if (res == AST_LOGGER_FAILURE) {
|
||||
ast_ari_response_error(response, 409, "Conflict",
|
||||
"Log channel already exists");
|
||||
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_rotate_log(struct ast_variable *headers,
|
||||
struct ast_ari_asterisk_rotate_log_args *args,
|
||||
struct ast_ari_response *response)
|
||||
|
Reference in New Issue
Block a user