add name to spans

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@565 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale committed 2008-09-26 15:36:34 +00:00
1 parent 7c004d59ff
commit a3922ed7c8
3 files changed
+68 -6

No files matched your search

+22 -3
View File
@@ -1528,6 +1528,7 @@ static switch_status_t load_config(void)
if ((spans = switch_xml_child(cfg, "analog_spans"))) {
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
char *id = (char *) switch_xml_attr_soft(myspan, "id");
char *name = (char *) switch_xml_attr(myspan, "name");
char *context = "default";
char *dialplan = "XML";
char *tonegroup = NULL;
@@ -1539,7 +1540,8 @@ static switch_status_t load_config(void)
uint32_t span_id = 0, to = 0, max = 0;
zap_span_t *span = NULL;
analog_option_t analog_options = ANALOG_OPTION_NONE;
zap_status_t zstatus = ZAP_FAIL;
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");
@@ -1570,7 +1572,7 @@ static switch_status_t load_config(void)
continue;
}
span_id = atoi(id);
if (!tonegroup) {
tonegroup = "us";
@@ -1584,10 +1586,27 @@ static switch_status_t load_config(void)
max = atoi(max_digits);
}
if (zap_span_find(span_id, &span) != ZAP_SUCCESS) {
if (name) {
zstatus = zap_span_find_by_name(name, &span);
} else {
if (switch_is_number(id)) {
span_id = atoi(id);
zstatus = zap_span_find(span_id, &span);
}
if (zstatus != ZAP_SUCCESS) {
zstatus = zap_span_find_by_name(id, &span);
}
}
if (zstatus != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "Error finding OpenZAP span %d\n", span_id);
continue;
}
if (!span_id) {
span_id = span->span_id;
}
if (zap_configure_span("analog", span, on_analog_signal,
"tonemap", tonegroup,