diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-07-14 12:27:18 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-07-14 12:27:18 -0500 |
commit | 3ebe5cd7666f1f7de3c73b51c0cb610d61f23917 (patch) | |
tree | 0ce95b2e5b1cd205844a73dfe291719f90aad2bd /res/ari/resource_asterisk.c | |
parent | f35998e0ef2f3fb5b7511d01f57aac62f797a48e (diff) | |
parent | f64f1c2772909779758cb8cf7f3a328e0ec5ffd1 (diff) |
Merge "ARI: Added new functionality to unload a single module."
Diffstat (limited to 'res/ari/resource_asterisk.c')
-rw-r--r-- | res/ari/resource_asterisk.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/res/ari/resource_asterisk.c b/res/ari/resource_asterisk.c index 768f7711d..13f459eec 100644 --- a/res/ari/resource_asterisk.c +++ b/res/ari/resource_asterisk.c @@ -295,6 +295,34 @@ void ast_ari_asterisk_load_module(struct ast_variable *headers, ast_ari_response_no_content(response); } +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_FIRM; + + 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_global_var(struct ast_variable *headers, struct ast_ari_asterisk_get_global_var_args *args, struct ast_ari_response *response) |