diff options
Diffstat (limited to 'res/res_ari_endpoints.c')
-rw-r--r-- | res/res_ari_endpoints.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/res/res_ari_endpoints.c b/res/res_ari_endpoints.c index 944146fcb..d96de0877 100644 --- a/res/res_ari_endpoints.c +++ b/res/res_ari_endpoints.c @@ -445,19 +445,24 @@ static struct stasis_rest_handlers endpoints = { .children = { &endpoints_sendMessage,&endpoints_tech, } }; +static int unload_module(void) +{ + ast_ari_remove_handler(&endpoints); + stasis_app_unref(); + return 0; +} + static int load_module(void) { int res = 0; stasis_app_ref(); res |= ast_ari_add_handler(&endpoints); - return res; -} + if (res) { + unload_module(); + return AST_MODULE_LOAD_DECLINE; + } -static int unload_module(void) -{ - ast_ari_remove_handler(&endpoints); - stasis_app_unref(); - return 0; + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Endpoint resources", |