ao2_global_obj_replace_unref(cel_linkedids, container);
ao2_cleanup(container);
if (!container) {
- cel_engine_cleanup();
return -1;
}
ao2_global_obj_replace_unref(cel_dialstatus_store, container);
ao2_cleanup(container);
if (!container) {
- cel_engine_cleanup();
return -1;
}
if (STASIS_MESSAGE_TYPE_INIT(cel_generic_type)) {
- cel_engine_cleanup();
return -1;
}
if (ast_cli_register(&cli_status)) {
- cel_engine_cleanup();
return -1;
}
ao2_global_obj_replace_unref(cel_backends, container);
ao2_cleanup(container);
if (!container) {
- cel_engine_cleanup();
return -1;
}
if (aco_info_init(&cel_cfg_info)) {
- cel_engine_cleanup();
return -1;
}
struct cel_config *cel_cfg = cel_config_alloc();
if (!cel_cfg) {
- cel_engine_cleanup();
return -1;
}
}
if (create_subscriptions()) {
- cel_engine_cleanup();
return -1;
}
if (ast_cel_check_enabled() && create_routes()) {
- cel_engine_cleanup();
return -1;
}
int ast_local_init(void)
{
-
if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_begin_type)) {
return -1;
}
locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb);
if (!locals) {
- ao2_cleanup(local_tech.capabilities);
- local_tech.capabilities = NULL;
return -1;
}
/* Make sure we can register our channel type */
if (ast_channel_register(&local_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
- ao2_ref(locals, -1);
- ao2_cleanup(local_tech.capabilities);
- local_tech.capabilities = NULL;
+
return -1;
}
ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local));
}
device_state_topic_all = stasis_topic_create("ast_device_state_topic");
if (!device_state_topic_all) {
- devstate_cleanup();
return -1;
}
device_state_topic_pool = stasis_topic_pool_create(ast_device_state_topic_all());
if (!device_state_topic_pool) {
- devstate_cleanup();
return -1;
}
device_state_cache = stasis_cache_create_full(device_state_get_id,
device_state_aggregate_calc, device_state_aggregate_publish);
if (!device_state_cache) {
- devstate_cleanup();
return -1;
}
device_state_topic_cached = stasis_caching_topic_create(ast_device_state_topic_all(),
device_state_cache);
if (!device_state_topic_cached) {
- devstate_cleanup();
return -1;
}
devstate_change_cb, NULL);
if (!devstate_message_sub) {
ast_log(LOG_ERROR, "Failed to create subscription creating uncached device state aggregate events.\n");
- devstate_cleanup();
return -1;
}
int ast_dsp_init(void)
{
- int res = _dsp_init(0);
+ if (_dsp_init(0)) {
+ return -1;
+ }
#ifdef TEST_FRAMEWORK
- if (!res) {
- AST_TEST_REGISTER(test_dsp_fax_detect);
- AST_TEST_REGISTER(test_dsp_dtmf_detect);
+ AST_TEST_REGISTER(test_dsp_fax_detect);
+ AST_TEST_REGISTER(test_dsp_dtmf_detect);
- ast_register_cleanup(test_dsp_shutdown);
- }
+ ast_register_cleanup(test_dsp_shutdown);
#endif
- return res;
+
+ return 0;
}
int ast_dsp_reload(void)
int res;
res = ast_features_config_init();
- if (res) {
- return res;
- }
res |= ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL);
res |= ast_manager_register_xml_core("Bridge", EVENT_FLAG_CALL, action_bridge);
- if (res) {
- features_shutdown();
- } else {
- ast_register_cleanup(features_shutdown);
- }
+ ast_register_cleanup(features_shutdown);
return res;
}
res |= __ast_custom_function_register(&featuremap_function, NULL);
res |= ast_cli_register_multiple(cli_features_config, ARRAY_LEN(cli_features_config));
- if (res) {
- ast_features_config_shutdown();
- }
-
return res;
}
/*! \brief Load indications module */
int ast_indications_init(void)
{
- if (!(ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,
- ast_tone_zone_hash, ast_tone_zone_cmp))) {
+ ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,
+ ast_tone_zone_hash, ast_tone_zone_cmp);
+ if (!ast_tone_zones) {
return -1;
}
if (load_indications(0)) {
- indications_shutdown();
return -1;
}
for (x = 0; x < ARRAY_LEN(builtins); x++) {
if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) {
ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
- unload_pbx_builtins();
return -1;
}
}
wizards = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, WIZARD_BUCKETS,
ast_sorcery_internal_wizard_hash_fn, NULL, ast_sorcery_internal_wizard_cmp_fn);
if (!wizards) {
- sorcery_cleanup();
return -1;
}
observers = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, NULL, NULL);
if (!observers) {
- sorcery_cleanup();
return -1;
}
instances = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, INSTANCE_BUCKETS,
ast_sorcery_hash_fn, NULL, ast_sorcery_cmp_fn);
if (!instances) {
- sorcery_cleanup();
return -1;
}