mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 17:41:53 +00:00
freetdm: fix config to allow both sangoma pri and bri spans to be configured
This commit is contained in:
parent
42c307253b
commit
e7fecd0ff9
@ -2371,46 +2371,10 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c
|
|||||||
return paramindex;
|
return paramindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static switch_status_t load_config(void)
|
static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans)
|
||||||
{
|
{
|
||||||
const char *cf = "freetdm.conf";
|
switch_xml_t myspan, param;
|
||||||
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;
|
|
||||||
unsigned int chancount = 0;
|
|
||||||
|
|
||||||
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))) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
|
||||||
return SWITCH_STATUS_TERM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
|
||||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
|
||||||
|
|
||||||
if (!strcasecmp(var, "debug")) {
|
|
||||||
globals.debug = atoi(val);
|
|
||||||
} else if (!strcasecmp(var, "hold-music")) {
|
|
||||||
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, "sip-headers")) {
|
|
||||||
globals.sip_headers = switch_true(val);
|
|
||||||
} else if (!strcasecmp(var, "enable-analog-option")) {
|
|
||||||
globals.analog_options = enable_analog_option(val, globals.analog_options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((spans = switch_xml_child(cfg, "sangoma_pri_spans")) || (spans = switch_xml_child(cfg, "sangoma_bri_spans"))) {
|
|
||||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||||
ftdm_status_t zstatus = FTDM_FAIL;
|
ftdm_status_t zstatus = FTDM_FAIL;
|
||||||
const char *context = "default";
|
const char *context = "default";
|
||||||
@ -2522,6 +2486,53 @@ static switch_status_t load_config(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
unsigned int chancount = 0;
|
||||||
|
|
||||||
|
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))) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||||
|
return SWITCH_STATUS_TERM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||||
|
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||||
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
|
|
||||||
|
if (!strcasecmp(var, "debug")) {
|
||||||
|
globals.debug = atoi(val);
|
||||||
|
} else if (!strcasecmp(var, "hold-music")) {
|
||||||
|
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, "sip-headers")) {
|
||||||
|
globals.sip_headers = switch_true(val);
|
||||||
|
} else if (!strcasecmp(var, "enable-analog-option")) {
|
||||||
|
globals.analog_options = enable_analog_option(val, globals.analog_options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((spans = switch_xml_child(cfg, "sangoma_pri_spans"))) {
|
||||||
|
parse_bri_pri_spans(cfg, spans);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((spans = switch_xml_child(cfg, "sangoma_bri_spans"))) {
|
||||||
|
parse_bri_pri_spans(cfg, spans);
|
||||||
|
}
|
||||||
|
|
||||||
switch_core_hash_init(&globals.ss7_configs, module_pool);
|
switch_core_hash_init(&globals.ss7_configs, module_pool);
|
||||||
if ((spans = switch_xml_child(cfg, "sangoma_ss7_spans"))) {
|
if ((spans = switch_xml_child(cfg, "sangoma_ss7_spans"))) {
|
||||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user