[commit] r4156 - in freeswitch/trunk: conf src/mod/endpoints/mod_wanpipe
Author: anthm Date: Wed Feb 7 18:43:04 2007 New Revision: 4156 Modified: freeswitch/trunk/conf/wanpipe.conf.xml freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Log: wanpipe update Modified: freeswitch/trunk/conf/wanpipe.conf.xml ============================================================================== --- freeswitch/trunk/conf/wanpipe.conf.xml (original) +++ freeswitch/trunk/conf/wanpipe.conf.xml Wed Feb 7 18:43:04 2007 @@ -1,17 +1,17 @@ <configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint"> <settings> - <param name="debug" value="1"/> + <param name="debug" value="0"/> <param name="dialplan" value="XML"/> <param name="mtu" value="320"/> <param name="dtmf-on" value="800"/> <param name="dtmf-off" value="100"/> <param name="supress-dtmf-tone" value="yes"/> </settings> - <span> - <param name="span" value="1"/> + <!-- may be any single digit or a range of digits separated by a '-' e.g "1-4" --> + <span id="1"> <param name="node" value="cpe"/> - <!-- <param name="switch" value="ni2"/> --> - <param name="switch" value="dms100"/> + <param name="switch" value="ni2"/> + <!--<param name="switch" value="dms100"/>--> <!-- <param name="switch" value="lucent5e"/> --> <!-- <param name="switch" value="att4ess"/> --> <!-- <param name="switch" value="euroisdn"/> --> Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Wed Feb 7 18:43:04 2007 @@ -1414,7 +1414,7 @@ static switch_status_t config_wanpipe(int reload) { 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; globals.mtu = DEFAULT_MTU; @@ -1450,31 +1450,52 @@ for (span = switch_xml_child(cfg, "span"); span; span = span->next) { - 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"); + char *id = switch_xml_attr(span, "id"); + int32_t i = 0; - if (!strcmp(var, "span")) { - 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; - } - + current_span = 0; + + if (id) { + char *p; + + min_span = atoi(id); + if ((p = strchr(id, '-'))) { + p++; + max_span = atoi(p); } else { - if (!current_span) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid option %s when no span defined.\n", var); - continue; + max_span = min_span; + } + 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")) { SPANS[current_span]->dchan = atoi(val); } else if (!strcmp(var, "bchan")) {
participants (1)
-
Freeswitch SVN