Asterisk - The Open Source Telephony Project
18.5.0
|
Implementation for ARI stubs. More...
#include "asterisk.h"
#include "asterisk/ast_version.h"
#include "asterisk/buildinfo.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/paths.h"
#include "asterisk/pbx.h"
#include "asterisk/sorcery.h"
#include "resource_asterisk.h"
Go to the source code of this file.
Functions | |
void | ast_ari_asterisk_add_log (struct ast_variable *headers, struct ast_ari_asterisk_add_log_args *args, struct ast_ari_response *response) |
Adds a log channel. More... | |
void | ast_ari_asterisk_delete_log (struct ast_variable *headers, struct ast_ari_asterisk_delete_log_args *args, struct ast_ari_response *response) |
Deletes a log channel. More... | |
void | ast_ari_asterisk_delete_object (struct ast_variable *headers, struct ast_ari_asterisk_delete_object_args *args, struct ast_ari_response *response) |
Delete a dynamic configuration object. More... | |
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) |
Get the value of a global variable. More... | |
void | ast_ari_asterisk_get_info (struct ast_variable *headers, struct ast_ari_asterisk_get_info_args *args, struct ast_ari_response *response) |
Gets Asterisk system information. More... | |
void | ast_ari_asterisk_get_module (struct ast_variable *headers, struct ast_ari_asterisk_get_module_args *args, struct ast_ari_response *response) |
Get Asterisk module information. More... | |
void | ast_ari_asterisk_get_object (struct ast_variable *headers, struct ast_ari_asterisk_get_object_args *args, struct ast_ari_response *response) |
Retrieve a dynamic configuration object. More... | |
void | ast_ari_asterisk_list_log_channels (struct ast_variable *headers, struct ast_ari_asterisk_list_log_channels_args *args, struct ast_ari_response *response) |
Gets Asterisk log channel information. More... | |
void | ast_ari_asterisk_list_modules (struct ast_variable *headers, struct ast_ari_asterisk_list_modules_args *args, struct ast_ari_response *response) |
List Asterisk modules. More... | |
void | ast_ari_asterisk_load_module (struct ast_variable *headers, struct ast_ari_asterisk_load_module_args *args, struct ast_ari_response *response) |
Load an Asterisk module. More... | |
void | ast_ari_asterisk_ping (struct ast_variable *headers, struct ast_ari_asterisk_ping_args *args, struct ast_ari_response *response) |
Response pong message. More... | |
void | ast_ari_asterisk_reload_module (struct ast_variable *headers, struct ast_ari_asterisk_reload_module_args *args, struct ast_ari_response *response) |
Reload an Asterisk module. More... | |
void | ast_ari_asterisk_rotate_log (struct ast_variable *headers, struct ast_ari_asterisk_rotate_log_args *args, struct ast_ari_response *response) |
Rotates a log channel. More... | |
void | ast_ari_asterisk_set_global_var (struct ast_variable *headers, struct ast_ari_asterisk_set_global_var_args *args, struct ast_ari_response *response) |
Set the value of a global variable. More... | |
void | ast_ari_asterisk_unload_module (struct ast_variable *headers, struct ast_ari_asterisk_unload_module_args *args, struct ast_ari_response *response) |
Unload an Asterisk module. More... | |
void | ast_ari_asterisk_update_object (struct ast_variable *headers, struct ast_ari_asterisk_update_object_args *args, struct ast_ari_response *response) |
Create or update a dynamic configuration object. More... | |
static int | identify_module (const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *data, const char *condition) |
Identify module by name and process resource information. More... | |
static int | process_log_list (const char *channel, const char *type, const char *status, const char *configuration, void *log_data_list) |
Process logger information and append to a json array. More... | |
static int | process_module_list (const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *module_data_list) |
Process module information and append to a json array. More... | |
static void | return_sorcery_object (struct ast_sorcery *sorcery, void *sorcery_obj, struct ast_ari_response *response) |
Implementation for ARI stubs.
Definition in file resource_asterisk.c.
void ast_ari_asterisk_add_log | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_add_log_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Adds a log channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 705 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, AST_LOGGER_ALLOC_ERROR, ast_logger_create_channel(), AST_LOGGER_DECLINE, AST_LOGGER_FAILURE, ast_ari_asterisk_add_log_args::configuration, ast_ari_asterisk_add_log_args::log_channel_name, and NULL.
Referenced by ast_ari_asterisk_add_log_cb().
void ast_ari_asterisk_delete_log | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_delete_log_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Deletes a log channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 757 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, AST_LOGGER_ALLOC_ERROR, AST_LOGGER_FAILURE, ast_logger_remove_channel(), ast_ari_asterisk_delete_log_args::log_channel_name, and NULL.
Referenced by ast_ari_asterisk_delete_log_cb().
void ast_ari_asterisk_delete_object | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_delete_object_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Delete a dynamic configuration object.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 247 of file resource_asterisk.c.
References ao2_cleanup, ast_ari_response_error(), ast_ari_response_no_content(), ast_sorcery_delete(), ast_sorcery_get_object_type(), ast_sorcery_retrieve_by_id(), ast_sorcery_retrieve_by_module_name(), ast_sorcery_unref, ast_ari_asterisk_delete_object_args::config_class, ast_ari_asterisk_delete_object_args::id, NULL, ast_ari_asterisk_delete_object_args::object_type, RAII_VAR, and sorcery.
Referenced by ast_ari_asterisk_delete_object_cb().
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 | ||
) |
Get the value of a global variable.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 780 of file resource_asterisk.c.
References ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_assert, ast_free, ast_json_pack(), ast_json_ref(), ast_json_unref(), ast_str_create, ast_str_retrieve_variable(), ast_strlen_zero, NULL, RAII_VAR, S_OR, tmp(), value, and ast_ari_asterisk_get_global_var_args::variable.
Referenced by ast_ari_asterisk_get_global_var_cb().
void ast_ari_asterisk_get_info | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_get_info_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Gets Asterisk system information.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 294 of file resource_asterisk.c.
References ast_ari_response_alloc_failed(), ast_ari_response_ok(), ast_build_date, ast_build_kernel, ast_build_machine, ast_build_os, ast_build_user, AST_BUILDOPTS, ast_config_AST_RUN_GROUP, ast_config_AST_RUN_USER, ast_config_AST_SYSTEM_NAME, ast_defaultlanguage, ast_eid_default, ast_eid_to_str(), ast_get_version(), ast_json_integer_create(), ast_json_object_create(), ast_json_object_set(), ast_json_pack(), ast_json_real_create(), ast_json_ref(), ast_json_timeval(), ast_json_unref(), ast_lastreloadtime, ast_log, ast_option_maxcalls, ast_option_maxfiles, ast_option_maxload, ast_startuptime, config, LOG_WARNING, NULL, ast_ari_asterisk_get_info_args::only, ast_ari_asterisk_get_info_args::only_count, and RAII_VAR.
Referenced by ast_ari_asterisk_get_info_cb().
void ast_ari_asterisk_get_module | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_get_module_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Get Asterisk module information.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 484 of file resource_asterisk.c.
References ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_assert, ast_json_object_create(), ast_json_unref(), ast_module_check(), ast_update_module_list_condition(), identify_module(), ast_ari_asterisk_get_module_args::module_name, and NULL.
Referenced by ast_ari_asterisk_get_module_cb().
void ast_ari_asterisk_get_object | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_get_object_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Retrieve a dynamic configuration object.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 89 of file resource_asterisk.c.
References ao2_cleanup, ast_ari_response_error(), ast_sorcery_get_object_type(), ast_sorcery_retrieve_by_id(), ast_sorcery_retrieve_by_module_name(), ast_sorcery_unref, ast_ari_asterisk_get_object_args::config_class, ast_ari_asterisk_get_object_args::id, NULL, ast_ari_asterisk_get_object_args::object_type, RAII_VAR, return_sorcery_object(), and sorcery.
Referenced by ast_ari_asterisk_get_object_cb().
void ast_ari_asterisk_list_log_channels | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_list_log_channels_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Gets Asterisk log channel information.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 680 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_ok(), ast_json_array_create(), ast_json_unref(), AST_LOGGER_ALLOC_ERROR, AST_LOGGER_FAILURE, ast_logger_get_channels(), and process_log_list().
Referenced by ast_ari_asterisk_list_log_channels_cb().
void ast_ari_asterisk_list_modules | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_list_modules_args * | args, | ||
struct ast_ari_response * | response | ||
) |
List Asterisk modules.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 429 of file resource_asterisk.c.
References ast_ari_response_alloc_failed(), ast_ari_response_ok(), ast_json_array_create(), ast_update_module_list_data(), NULL, and process_module_list().
Referenced by ast_ari_asterisk_list_modules_cb().
void ast_ari_asterisk_load_module | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_load_module_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Load an Asterisk module.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 519 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, ast_load_resource(), ast_module_check(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SKIP, ast_ari_asterisk_load_module_args::module_name, and NULL.
Referenced by ast_ari_asterisk_load_module_cb().
void ast_ari_asterisk_ping | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_ping_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Response pong message.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 634 of file resource_asterisk.c.
References ast_ari_response_ok(), ast_assert, ast_eid_default, ast_eid_to_str(), ast_json_pack(), ast_json_timeval(), ast_tvnow(), and NULL.
Referenced by ast_ari_asterisk_ping_cb().
void ast_ari_asterisk_reload_module | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_reload_module_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Reload an Asterisk module.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 584 of file resource_asterisk.c.
References ast_ari_response_accepted(), ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, ast_module_check(), ast_module_reload(), AST_MODULE_RELOAD_ERROR, AST_MODULE_RELOAD_IN_PROGRESS, AST_MODULE_RELOAD_NOT_FOUND, AST_MODULE_RELOAD_NOT_IMPLEMENTED, AST_MODULE_RELOAD_QUEUED, AST_MODULE_RELOAD_UNINITIALIZED, ast_ari_asterisk_reload_module_args::module_name, and NULL.
Referenced by ast_ari_asterisk_reload_module_cb().
void ast_ari_asterisk_rotate_log | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_rotate_log_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Rotates a log channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 732 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, AST_LOGGER_ALLOC_ERROR, AST_LOGGER_FAILURE, ast_logger_rotate_channel(), ast_ari_asterisk_rotate_log_args::log_channel_name, and NULL.
Referenced by ast_ari_asterisk_rotate_log_cb().
void ast_ari_asterisk_set_global_var | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_set_global_var_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Set the value of a global variable.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 814 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, ast_strlen_zero, NULL, pbx_builtin_setvar_helper(), ast_ari_asterisk_set_global_var_args::value, and ast_ari_asterisk_set_global_var_args::variable.
Referenced by ast_ari_asterisk_set_global_var_cb().
void ast_ari_asterisk_unload_module | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_unload_module_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Unload an Asterisk module.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 556 of file resource_asterisk.c.
References ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, AST_FORCE_SOFT, ast_module_check(), ast_unload_resource(), ast_ari_asterisk_unload_module_args::module_name, and NULL.
Referenced by ast_ari_asterisk_unload_module_cb().
void ast_ari_asterisk_update_object | ( | struct ast_variable * | headers, |
struct ast_ari_asterisk_update_object_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Create or update a dynamic configuration object.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 128 of file resource_asterisk.c.
References ao2_cleanup, ao2_ref, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_debug, ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_string_get(), ast_sorcery_alloc(), ast_sorcery_copy(), ast_sorcery_create(), ast_sorcery_get_object_type(), ast_sorcery_objectset_apply(), ast_sorcery_retrieve_by_id(), ast_sorcery_retrieve_by_module_name(), ast_sorcery_unref, ast_sorcery_update(), ast_variable_list_append, ast_variable_new, ast_variables_destroy(), ast_ari_asterisk_update_object_args::config_class, copy(), ast_ari_asterisk_update_object_args::fields, ast_ari_asterisk_update_object_args::id, NULL, ast_ari_asterisk_update_object_args::object_type, RAII_VAR, return_sorcery_object(), and sorcery.
Referenced by ast_ari_asterisk_update_object_cb().
|
static |
Identify module by name and process resource information.
module | Resource name |
description | Resource description |
usecnt | Resource use count |
status | Resource running status |
like | |
support_level | Resource support level |
data | JSON body for resource |
condition | Name to match resource to |
0 | if no resource exists |
1 | if resource exists |
Definition at line 459 of file resource_asterisk.c.
References ast_json_integer_create(), ast_json_object_set(), ast_json_string_create(), and ast_module_support_level_to_string().
Referenced by ast_ari_asterisk_get_module().
|
static |
Process logger information and append to a json array.
channel | Resource logger channel name path |
type | Resource log type |
status | Resource log status |
configuration | Resource logger levels |
log_data_list | Resource array |
-1 | if no resource exists |
0 | if resource exists |
Definition at line 663 of file resource_asterisk.c.
References ast_json_array_append(), ast_json_pack(), AST_LOGGER_FAILURE, and AST_LOGGER_SUCCESS.
Referenced by ast_ari_asterisk_list_log_channels().
|
static |
Process module information and append to a json array.
module | Resource name |
description | Resource description |
usecnt | Resource use count |
status | Resource running status |
like | |
support_level | Resource support level |
module_data_list | Resource array |
0 | if no resource exists |
1 | if resource exists |
Definition at line 410 of file resource_asterisk.c.
References ast_json_array_append(), ast_json_pack(), and ast_module_support_level_to_string().
Referenced by ast_ari_asterisk_list_modules().
|
static |
Definition at line 41 of file resource_asterisk.c.
References ast_ari_response_alloc_failed(), ast_ari_response_ok(), ast_json_array_append(), ast_json_array_create(), ast_json_pack(), ast_json_ref(), ast_json_unref(), ast_sorcery_objectset_create, ast_variables_destroy(), ast_variable::name, ast_variable::next, NULL, RAII_VAR, and ast_variable::value.
Referenced by ast_ari_asterisk_get_object(), and ast_ari_asterisk_update_object().