From 3fa2fce3f3e3b66151259874d9885fbaeca94d97 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 1 Jun 2011 15:24:09 -0400 Subject: [PATCH] freetdm: added fail-on-error global configuration to refuse to load the module if there is any error Conflicts: libs/freetdm/mod_freetdm/mod_freetdm.c --- libs/freetdm/conf/freetdm.conf.xml | 5 + libs/freetdm/mod_freetdm/mod_freetdm.c | 194 +++++++------------------ 2 files changed, 60 insertions(+), 139 deletions(-) diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml index 7d5de5a189..29232d927b 100644 --- a/libs/freetdm/conf/freetdm.conf.xml +++ b/libs/freetdm/conf/freetdm.conf.xml @@ -18,6 +18,11 @@ with the signaling protocols that you can run on top of your I/O interfaces. --> + + diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 618f2501ff..a3cefce403 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -87,7 +87,9 @@ static struct { analog_option_t analog_options; switch_hash_t *ss7_configs; int sip_headers; - int crash_on_assert; + uint8_t crash_on_assert; + uint8_t fail_on_error; + uint8_t config_error; } globals; /* private data attached to each fs session */ @@ -2427,6 +2429,10 @@ static uint32_t enable_analog_option(const char *str, uint32_t current_options) } +#define CONFIG_ERROR(...) do { \ + ftdm_log(FTDM_LOG_ERROR, __VA_ARGS__); \ + globals.config_error = 1; \ + } while(0) /* create ftdm_conf_node_t tree based on a fixed pattern XML configuration list * last 2 args are for limited aka dumb recursivity * */ @@ -2619,7 +2625,7 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c profnode = switch_xml_child(cfg, "config_profiles"); if (!profnode) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot find profile '%s', there is no 'config_profiles' XML section\n", profname); + CONFIG_ERROR("cannot find profile '%s', there is no 'config_profiles' XML section\n", profname); return 0; } @@ -2635,7 +2641,7 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c } if (!profile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to find profile '%s'\n", profname); + CONFIG_ERROR("failed to find profile '%s'\n", profname); return 0; } @@ -2670,7 +2676,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) unsigned paramindex = 0; if (!name && !id) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); + CONFIG_ERROR("sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); continue; } @@ -2688,7 +2694,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) } if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); continue; } @@ -2716,7 +2722,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) char *val = (char *) switch_xml_attr_soft(param, "value"); if (ftdm_array_len(spanparameters) - 1 == paramindex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); + CONFIG_ERROR("Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -2746,10 +2752,10 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) int calls; int seconds; if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); + CONFIG_ERROR("Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); } else { if (calls < 1 || seconds < 1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, minimum call limit must be 1 per second\n", var); + CONFIG_ERROR("Invalid %s parameter value, minimum call limit must be 1 per second\n", var); } else { SPAN_CONFIG[span_id].limit_calls = calls; SPAN_CONFIG[span_id].limit_seconds = seconds; @@ -2759,7 +2765,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) if (!strcasecmp(val, "answer")) { SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, only accepted event is 'answer'\n", var); + CONFIG_ERROR("Invalid %s parameter value, only accepted event is 'answer'\n", var); } } else { spanparameters[paramindex].var = var; @@ -2772,7 +2778,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) "sangoma_isdn", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); + CONFIG_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); continue; } SPAN_CONFIG[span_id].span = span; @@ -2789,15 +2795,11 @@ static switch_status_t load_config(void) const char *cf = "freetdm.conf"; switch_xml_t cfg, xml, settings, param, spans, myspan; ftdm_conf_node_t *ss7confnode = NULL; - ftdm_span_t *boost_spans[FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN]; - ftdm_span_t *boost_span = NULL; - unsigned boosti = 0; unsigned int i = 0; ftdm_channel_t *fchan = NULL; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; - memset(boost_spans, 0, sizeof(boost_spans)); memset(&globals, 0, sizeof(globals)); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool); if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { @@ -2816,6 +2818,8 @@ static switch_status_t load_config(void) switch_set_string(globals.hold_music, val); } else if (!strcasecmp(var, "crash-on-assert")) { globals.crash_on_assert = switch_true(val); + } else if (!strcasecmp(var, "fail-on-error")) { + globals.fail_on_error = switch_true(val); } else if (!strcasecmp(var, "sip-headers")) { globals.sip_headers = switch_true(val); } else if (!strcasecmp(var, "enable-analog-option")) { @@ -2846,11 +2850,11 @@ static switch_status_t load_config(void) uint32_t span_id = 0; unsigned paramindex = 0; if (!name && !id) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ss7 span missing required attribute 'id' or 'name', skipping ...\n"); + CONFIG_ERROR("ss7 span missing required attribute 'id' or 'name', skipping ...\n"); continue; } if (!configname) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ss7 span missing required attribute, skipping ...\n"); + CONFIG_ERROR("ss7 span missing required attribute, skipping ...\n"); continue; } if (name) { @@ -2867,7 +2871,7 @@ static switch_status_t load_config(void) } if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); continue; } @@ -2877,7 +2881,7 @@ static switch_status_t load_config(void) ss7confnode = get_ss7_config_node(cfg, configname); if (!ss7confnode) { - ftdm_log(FTDM_LOG_ERROR, "Error finding ss7config '%s' for FreeTDM span id: %s\n", configname, switch_str_nil(id)); + CONFIG_ERROR("Error finding ss7config '%s' for FreeTDM span id: %s\n", configname, switch_str_nil(id)); continue; } @@ -2891,7 +2895,7 @@ static switch_status_t load_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (ftdm_array_len(spanparameters) - 1 == paramindex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); + CONFIG_ERROR("Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -2910,7 +2914,7 @@ static switch_status_t load_config(void) "sangoma_ss7", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring ss7 FreeTDM span %d\n", span_id); + CONFIG_ERROR("Error configuring ss7 FreeTDM span %d\n", span_id); continue; } SPAN_CONFIG[span_id].span = span; @@ -2961,7 +2965,7 @@ static switch_status_t load_config(void) } if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); continue; } @@ -2995,10 +2999,10 @@ static switch_status_t load_config(void) int calls; int seconds; if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); + CONFIG_ERROR("Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); } else { if (calls < 1 || seconds < 1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, minimum call limit must be 1 per second\n", var); + CONFIG_ERROR("Invalid %s parameter value, minimum call limit must be 1 per second\n", var); } else { SPAN_CONFIG[span_id].limit_calls = calls; SPAN_CONFIG[span_id].limit_seconds = seconds; @@ -3008,7 +3012,7 @@ static switch_status_t load_config(void) if (!strcasecmp(val, "answer")) { SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, only accepted event is 'answer'\n", var); + CONFIG_ERROR("Invalid %s parameter value, only accepted event is 'answer'\n", var); } } else if (!strcasecmp(var, "dial-regex")) { dial_regex = val; @@ -3036,7 +3040,7 @@ static switch_status_t load_config(void) } if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); + CONFIG_ERROR("span missing required param 'id'\n"); continue; } @@ -3066,7 +3070,7 @@ static switch_status_t load_config(void) } if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); continue; } @@ -3086,7 +3090,7 @@ static switch_status_t load_config(void) "callwaiting", &callwaiting, "wait_dialtone_timeout", &dialtone_timeout, FTDM_TAG_END) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM analog span %s\n", ftdm_span_get_name(span)); + CONFIG_ERROR("Error configuring FreeTDM analog span %s\n", ftdm_span_get_name(span)); continue; } @@ -3162,7 +3166,7 @@ static switch_status_t load_config(void) } if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); + CONFIG_ERROR("span missing required param 'id'\n"); continue; } @@ -3194,7 +3198,7 @@ static switch_status_t load_config(void) } if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); continue; } @@ -3208,7 +3212,7 @@ static switch_status_t load_config(void) "digit_timeout", &to, "max_dialstr", &max, FTDM_TAG_END) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM span %d\n", span_id); + CONFIG_ERROR("Error starting FreeTDM span %d\n", span_id); continue; } @@ -3245,7 +3249,7 @@ static switch_status_t load_config(void) uint32_t span_id = 0; if (!name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + CONFIG_ERROR("span missing required attribute 'name'\n"); continue; } @@ -3256,7 +3260,7 @@ static switch_status_t load_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (ftdm_array_len(spanparameters) - 1 == paramindex) { - ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); + CONFIG_ERROR("Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); break; } @@ -3278,13 +3282,13 @@ static switch_status_t load_config(void) zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); + CONFIG_ERROR("Error finding FreeTDM span %s\n", name); continue; } span_id = ftdm_span_get_id(span); if (ftdm_configure_span_signaling(span, "isdn", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); + CONFIG_ERROR("Error configuring FreeTDM span %s\n", name); continue; } @@ -3311,7 +3315,7 @@ static switch_status_t load_config(void) int span_id = 0; if (!name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + CONFIG_ERROR("span missing required attribute 'name'\n"); continue; } @@ -3322,7 +3326,7 @@ static switch_status_t load_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (ftdm_array_len(spanparameters) - 1 == paramindex) { - ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pritap span '%s', ignoring everything after '%s'\n", name, var); + CONFIG_ERROR("Too many parameters for pritap span '%s', ignoring everything after '%s'\n", name, var); break; } @@ -3339,13 +3343,13 @@ static switch_status_t load_config(void) zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); + CONFIG_ERROR("Error finding FreeTDM span %s\n", name); continue; } span_id = ftdm_span_get_id(span); if (ftdm_configure_span_signaling(span, "pritap", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); + CONFIG_ERROR("Error configuring FreeTDM span %s\n", name); continue; } @@ -3371,7 +3375,7 @@ static switch_status_t load_config(void) uint32_t span_id = 0; if (!name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + CONFIG_ERROR("span missing required attribute 'name'\n"); continue; } @@ -3382,7 +3386,7 @@ static switch_status_t load_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (ftdm_array_len(spanparameters) - 1 == paramindex) { - ftdm_log(FTDM_LOG_ERROR, "Too many parameters for libpri span, ignoring everything after '%s'\n", var); + CONFIG_ERROR("Too many parameters for libpri span, ignoring everything after '%s'\n", var); break; } @@ -3404,13 +3408,13 @@ static switch_status_t load_config(void) zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); + CONFIG_ERROR("Error finding FreeTDM span %s\n", name); continue; } span_id = ftdm_span_get_id(span); if (ftdm_configure_span_signaling(span, "libpri", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); + CONFIG_ERROR("Error configuring FreeTDM span %s\n", name); continue; } @@ -3423,86 +3427,6 @@ static switch_status_t load_config(void) } } - if ((spans = switch_xml_child(cfg, "boost_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - char *sigmod = (char *) switch_xml_attr(myspan, "sigmod"); - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - uint32_t span_id = 0; - ftdm_span_t *span = NULL; - ftdm_conf_parameter_t spanparameters[30]; - unsigned paramindex = 0; - - if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "boost span requires an id or name as attribute: \n"); - continue; - } - memset(spanparameters, 0, sizeof(spanparameters)); - if (sigmod) { - spanparameters[paramindex].var = "sigmod"; - spanparameters[paramindex].val = sigmod; - paramindex++; - } - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - if (ftdm_configure_span_signaling(span, "sangoma_boost", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM span %d error: %s\n", span_id, ftdm_span_get_last_error(span)); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - - switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (boost)", sizeof(SPAN_CONFIG[span_id].type)); - boost_spans[boosti++] = span; - } - } - if ((spans = switch_xml_child(cfg, "r2_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { char *name = (char *) switch_xml_attr(myspan, "name"); @@ -3521,7 +3445,7 @@ static switch_status_t load_config(void) unsigned paramindex = 0; if (!name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "'name' attribute required for R2 spans!\n"); + CONFIG_ERROR("'name' attribute required for R2 spans!\n"); continue; } @@ -3556,14 +3480,13 @@ static switch_status_t load_config(void) zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM R2 Span '%s'\n", name); + CONFIG_ERROR("Error finding FreeTDM R2 Span '%s'\n", name); continue; } span_id = ftdm_span_get_id(span); if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM R2 span %s, error: %s\n", - name, ftdm_span_get_last_error(span)); + CONFIG_ERROR("Error configuring FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); continue; } @@ -3581,24 +3504,12 @@ static switch_status_t load_config(void) switch_copy_string(SPAN_CONFIG[span_id].type, "R2", sizeof(SPAN_CONFIG[span_id].type)); if (ftdm_span_start(span) == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); + CONFIG_ERROR("Error starting FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); continue; } } } - /* start all boost spans now that we're done configuring. Unfortunately at this point boost modules have the limitation - * of needing all spans to be configured before starting them */ - for (i=0 ; i < boosti; i++) { - boost_span = boost_spans[i]; - ftdm_log(FTDM_LOG_DEBUG, "Starting boost span %d\n", ftdm_span_get_id(boost_span)); - if (ftdm_span_start(boost_span) == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Error starting boost FreeTDM span %d, error: %s\n", - ftdm_span_get_id(boost_span), ftdm_span_get_last_error(boost_span)); - continue; - } - } - if (globals.crash_on_assert) { ftdm_log(FTDM_LOG_WARNING, "Crash on assert enabled\n"); ftdm_global_set_crash_policy(FTDM_CRASH_ON_ASSERT); @@ -3606,6 +3517,11 @@ static switch_status_t load_config(void) switch_xml_free(xml); + if (globals.fail_on_error && globals.config_error) { + ftdm_log(FTDM_LOG_ERROR, "Refusing to load module with errors\n"); + return SWITCH_STATUS_TERM; + } + return SWITCH_STATUS_SUCCESS; }