summaryrefslogtreecommitdiff
path: root/res/res_ari_sounds.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_ari_sounds.c')
-rw-r--r--res/res_ari_sounds.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/res/res_ari_sounds.c b/res/res_ari_sounds.c
index fe0692f16..fded7fbce 100644
--- a/res/res_ari_sounds.c
+++ b/res/res_ari_sounds.c
@@ -209,19 +209,24 @@ static struct stasis_rest_handlers sounds = {
.children = { &sounds_soundId, }
};
+static int unload_module(void)
+{
+ ast_ari_remove_handler(&sounds);
+ stasis_app_unref();
+ return 0;
+}
+
static int load_module(void)
{
int res = 0;
stasis_app_ref();
res |= ast_ari_add_handler(&sounds);
- return res;
-}
+ if (res) {
+ unload_module();
+ return AST_MODULE_LOAD_DECLINE;
+ }
-static int unload_module(void)
-{
- ast_ari_remove_handler(&sounds);
- stasis_app_unref();
- return 0;
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Sound resources",