diff --git a/libs/freetdm/src/include/openzap.h b/libs/freetdm/src/include/openzap.h index 7052d8e17b..4024b40d31 100644 --- a/libs/freetdm/src/include/openzap.h +++ b/libs/freetdm/src/include/openzap.h @@ -720,6 +720,7 @@ OZ_DECLARE(zap_status_t) zap_channel_add_var(zap_channel_t *zchan, const char *v OZ_DECLARE(const char *) zap_channel_get_var(zap_channel_t *zchan, const char *var_name); OZ_DECLARE(zap_status_t) zap_channel_clear_vars(zap_channel_t *zchan); OZ_DECLARE(zap_status_t) zap_global_init(void); +OZ_DECLARE(zap_status_t) zap_global_configuration(void); OZ_DECLARE(zap_status_t) zap_global_destroy(void); OZ_DECLARE(zap_status_t) zap_global_set_memory_handler(zap_memory_handler_t *handler); OZ_DECLARE(void) zap_global_set_crash_policy(zap_crash_policy_t policy); diff --git a/libs/freetdm/src/zap_io.c b/libs/freetdm/src/zap_io.c index 3a623f3db7..fba9453e2c 100644 --- a/libs/freetdm/src/zap_io.c +++ b/libs/freetdm/src/zap_io.c @@ -2818,8 +2818,6 @@ OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span) OZ_DECLARE(zap_status_t) zap_global_init(void) { - int modcount; - memset(&globals, 0, sizeof(globals)); time_init(); @@ -2830,20 +2828,22 @@ OZ_DECLARE(zap_status_t) zap_global_init(void) globals.interface_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys); globals.module_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys); globals.span_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys); - modcount = 0; zap_mutex_create(&globals.mutex); zap_mutex_create(&globals.span_mutex); - - modcount = zap_load_modules(); + return ZAP_FAIL; +} + +OZ_DECLARE(zap_status_t) zap_global_configuration(void) +{ + int modcount = zap_load_modules(); zap_log(ZAP_LOG_NOTICE, "Modules configured: %d \n", modcount); - if (load_config() == ZAP_SUCCESS) { - globals.running = 1; - return ZAP_SUCCESS; + if (load_config() != ZAP_SUCCESS) { + globals.running = 0; + zap_log(ZAP_LOG_ERROR, "OpenZap global configuration failed!\n"); + return ZAP_FAIL; } - - zap_log(ZAP_LOG_ERROR, "No modules configured!\n"); - return ZAP_FAIL; + return ZAP_SUCCESS; } OZ_DECLARE(uint32_t) zap_running(void)