summaryrefslogtreecommitdiff
path: root/main/ccss.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/ccss.c')
-rw-r--r--main/ccss.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/main/ccss.c b/main/ccss.c
index fa569aaa0..9cf16e34d 100644
--- a/main/ccss.c
+++ b/main/ccss.c
@@ -4615,7 +4615,7 @@ static struct ast_cli_entry cc_cli[] = {
AST_CLI_DEFINE(handle_cc_kill, "Kill a CC transaction"),
};
-static void cc_shutdown(void)
+static int unload_module(void)
{
ast_devstate_prov_del("ccss");
ast_cc_agent_unregister(&generic_agent_callbacks);
@@ -4641,30 +4641,32 @@ static void cc_shutdown(void)
ao2_t_ref(generic_monitors, -1, "Unref generic_monitor container in cc_shutdown");
generic_monitors = NULL;
}
+
+ return 0;
}
-int ast_cc_init(void)
+static int load_module(void)
{
int res;
if (!(cc_core_instances = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS,
cc_core_instance_hash_fn, cc_core_instance_cmp_fn,
"Create core instance container"))) {
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
if (!(generic_monitors = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS,
generic_monitor_instance_list_hash_fn, generic_monitor_instance_list_cmp_fn,
"Create generic monitor container"))) {
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
if (!(cc_core_taskprocessor = ast_taskprocessor_get("CCSS_core", TPS_REF_DEFAULT))) {
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
if (!(cc_sched_context = ast_sched_context_create())) {
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
if (ast_sched_start_thread(cc_sched_context)) {
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
res = ast_register_application2(ccreq_app, ccreq_exec, NULL, NULL, NULL);
res |= ast_register_application2(cccancel_app, cccancel_exec, NULL, NULL, NULL);
@@ -4680,7 +4682,12 @@ int ast_cc_init(void)
initialize_cc_devstate_map();
res |= ast_devstate_prov_add("ccss", ccss_device_state);
- ast_register_cleanup(cc_shutdown);
-
- return res;
+ return res ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS;
}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Call Completion Supplementary Services",
+ .support_level = AST_MODULE_SUPPORT_CORE,
+ .load = load_module,
+ .unload = unload_module,
+ .load_pri = AST_MODPRI_CORE,
+);