wanpipe update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4156 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-02-07 23:43:04 +00:00
parent 96f207585d
commit f1ef145bcf
2 changed files with 49 additions and 28 deletions

View File

@ -1,17 +1,17 @@
<configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint"> <configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint">
<settings> <settings>
<param name="debug" value="1"/> <param name="debug" value="0"/>
<param name="dialplan" value="XML"/> <param name="dialplan" value="XML"/>
<param name="mtu" value="320"/> <param name="mtu" value="320"/>
<param name="dtmf-on" value="800"/> <param name="dtmf-on" value="800"/>
<param name="dtmf-off" value="100"/> <param name="dtmf-off" value="100"/>
<param name="supress-dtmf-tone" value="yes"/> <param name="supress-dtmf-tone" value="yes"/>
</settings> </settings>
<span> <!-- may be any single digit or a range of digits separated by a '-' e.g "1-4" -->
<param name="span" value="1"/> <span id="1">
<param name="node" value="cpe"/> <param name="node" value="cpe"/>
<!-- <param name="switch" value="ni2"/> --> <param name="switch" value="ni2"/>
<param name="switch" value="dms100"/> <!--<param name="switch" value="dms100"/>-->
<!-- <param name="switch" value="lucent5e"/> --> <!-- <param name="switch" value="lucent5e"/> -->
<!-- <param name="switch" value="att4ess"/> --> <!-- <param name="switch" value="att4ess"/> -->
<!-- <param name="switch" value="euroisdn"/> --> <!-- <param name="switch" value="euroisdn"/> -->

View File

@ -1414,7 +1414,7 @@ static void pri_thread_launch(struct sangoma_pri *spri)
static switch_status_t config_wanpipe(int reload) static switch_status_t config_wanpipe(int reload)
{ {
char *cf = "wanpipe.conf"; char *cf = "wanpipe.conf";
int current_span = 0; int current_span = 0, min_span = 0, max_span = 0;
switch_xml_t cfg, xml, settings, param, span; switch_xml_t cfg, xml, settings, param, span;
globals.mtu = DEFAULT_MTU; globals.mtu = DEFAULT_MTU;
@ -1450,30 +1450,51 @@ static switch_status_t config_wanpipe(int reload)
for (span = switch_xml_child(cfg, "span"); span; span = span->next) { for (span = switch_xml_child(cfg, "span"); span; span = span->next) {
for (param = switch_xml_child(span, "param"); param; param = param->next) { char *id = switch_xml_attr(span, "id");
char *var = (char *) switch_xml_attr_soft(param, "name"); int32_t i = 0;
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcmp(var, "span")) { current_span = 0;
current_span = atoi(val);
if (current_span <= 0 || current_span > MAX_SPANS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN!\n");
current_span = 0;
continue;
}
if (!SPANS[current_span]) {
if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
break;;
}
SPANS[current_span]->span = current_span;
}
if (id) {
char *p;
min_span = atoi(id);
if ((p = strchr(id, '-'))) {
p++;
max_span = atoi(p);
} else { } else {
if (!current_span) { max_span = min_span;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid option %s when no span defined.\n", var); }
continue; if (min_span < 1 || max_span < min_span) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Span Config! [%s]\n", id);
continue;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
continue;
}
for (i = min_span; i <= max_span; i++) {
current_span = i;
if (current_span <= 0 || current_span > MAX_SPANS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
current_span = 0;
continue;
}
if (!SPANS[current_span]) {
if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
break;
} }
SPANS[current_span]->span = current_span;
}
for (param = switch_xml_child(span, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcmp(var, "dchan")) { if (!strcmp(var, "dchan")) {
SPANS[current_span]->dchan = atoi(val); SPANS[current_span]->dchan = atoi(val);