void ast_ari_asterisk_unload_module(struct ast_variable *headers, struct ast_ari_asterisk_unload_module_args *args, struct ast_ari_response *response) { int unload_result; enum ast_module_unload_mode unload_mode = AST_FORCE_SOFT; ast_assert(response != NULL); if (!ast_module_check(args->module_name)) { ast_ari_response_error( response, 404, "Not Found", "Module not found in running modules"); return; } unload_result = ast_unload_resource(args->module_name, unload_mode); if (unload_result != 0) { ast_ari_response_error( response, 409, "Conflict", "Module could not be unloaded"); return; } ast_ari_response_no_content(response); }
void ast_ari_asterisk_get_module(struct ast_variable *headers, struct ast_ari_asterisk_get_module_args *args, struct ast_ari_response *response) { struct ast_json *json; int module_retrieved = 0; ast_assert(response != NULL); if (!ast_module_check(args->module_name)) { ast_ari_response_error( response, 404, "Not Found", "Module could not be found in running modules"); return; } json = ast_json_object_create(); if (!json) { ast_ari_response_alloc_failed(response); return; } module_retrieved = ast_update_module_list_condition(&identify_module, NULL, json, args->module_name); if (!module_retrieved) { ast_ari_response_error( response, 409, "Conflict", "Module information could not be retrieved"); return; } ast_ari_response_ok(response, json); }
static int unload_module(void) { int res = 0; /* If the dependent modules are still in memory, forbid unload */ if (ast_module_check("func_curl.so")) { ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n"); return -1; } if (ast_module_check("res_config_curl.so")) { ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n"); return -1; } curl_global_cleanup(); return res; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) { ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n"); return AST_MODULE_LOAD_DECLINE; } ast_sip_register_service(&logging_module); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { if (!ast_module_check("res_curl.so")) { if (ast_load_resource("res_curl.so") != AST_MODULE_LOAD_SUCCESS) { ast_log(LOG_ERROR, "Cannot load res_curl, so res_config_curl cannot be loaded\n"); return AST_MODULE_LOAD_DECLINE; } } if (!ast_module_check("func_curl.so")) { if (ast_load_resource("func_curl.so") != AST_MODULE_LOAD_SUCCESS) { ast_log(LOG_ERROR, "Cannot load func_curl, so res_config_curl cannot be loaded\n"); return AST_MODULE_LOAD_DECLINE; } } reload_module(); ast_config_engine_register(&curl_engine); return 0; }
void ast_ari_asterisk_reload_module(struct ast_variable *headers, struct ast_ari_asterisk_reload_module_args *args, struct ast_ari_response *response) { enum ast_module_reload_result reload_result; ast_assert(response != NULL); if (!ast_module_check(args->module_name)) { ast_ari_response_error( response, 404, "Not Found", "Module not found in running modules"); return; } reload_result = ast_module_reload(args->module_name); if (reload_result == AST_MODULE_RELOAD_NOT_FOUND) { ast_ari_response_error( response, 404, "Not Found", "Module could not be found"); return; } else if (reload_result == AST_MODULE_RELOAD_ERROR) { ast_ari_response_error( response, 409, "Conflict", "An unknown error occurred while reloading the module"); return; } else if (reload_result == AST_MODULE_RELOAD_IN_PROGRESS) { ast_ari_response_error( response, 409, "Conflict", "Another reload is currently in progress"); return; } else if (reload_result == AST_MODULE_RELOAD_UNINITIALIZED) { ast_ari_response_error( response, 409, "Conflict", "Module has not been initialized"); return; } else if (reload_result == AST_MODULE_RELOAD_NOT_IMPLEMENTED) { ast_ari_response_error( response, 409, "Conflict", "Module does not support reloading"); return; } else if (reload_result == AST_MODULE_RELOAD_QUEUED) { ast_ari_response_accepted(response); return; } ast_ari_response_no_content(response); }
static int load_module(void) { if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) { ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n"); return AST_MODULE_LOAD_DECLINE; } stasis_rtp_subscription = stasis_subscribe(ast_rtp_topic(), rtp_topic_handler, NULL); if (!stasis_rtp_subscription) { return AST_MODULE_LOAD_DECLINE; } return AST_MODULE_LOAD_SUCCESS; }
static int ifmodule_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { char *ret = "0"; *buf = '\0'; if (data) if (ast_module_check(data)) ret = "1"; ast_copy_string(buf, ret, len); return 0; }
static int unload_module(void) { int res = 0; size_t i; /* If the dependent modules are still in memory, forbid unload */ for (i = 0; i < ARRAY_LEN(dependents); i++) { if (ast_module_check(dependents[i])) { ast_log(LOG_ERROR, "%s (dependent module) is still loaded. Cannot unload res_curl.so\n", dependents[i]); res = -1; } } if (res) return -1; curl_global_cleanup(); return res; }
void ast_ari_asterisk_load_module(struct ast_variable *headers, struct ast_ari_asterisk_load_module_args *args, struct ast_ari_response *response) { enum ast_module_load_result load_result; ast_assert(response != NULL); if (ast_module_check(args->module_name)) { ast_ari_response_error( response, 409, "Conflict", "Module is already loaded"); return; } load_result = ast_load_resource(args->module_name); if (load_result == AST_MODULE_LOAD_DECLINE) { ast_ari_response_error( response, 409, "Conflict", "Module load declined"); return; } else if (load_result == AST_MODULE_LOAD_SKIP) { ast_ari_response_error( response, 409, "Conflict", "Module was skipped"); return; } else if (load_result == AST_MODULE_LOAD_FAILURE) { ast_ari_response_error( response, 409, "Conflict", "Module could not be loaded properly"); return; } ast_ari_response_no_content(response); }