[Freeswitch-svn] [commit] r10269 - in freeswitch/branches/gmaruzz: src/mod/endpoints/mod_skypiax stuff
Freeswitch SVN
gmaruzz at freeswitch.org
Fri Nov 7 11:40:59 PST 2008
Author: gmaruzz
Date: Thu Nov 6 09:04:02 2008
New Revision: 10269
Modified:
freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/stuff/skypiax.conf.xml
Log:
skypiax: continue to parse nested configuration, eg: multiple interfaces
Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c Thu Nov 6 09:04:02 2008
@@ -2271,6 +2271,7 @@
typedef struct private_object private_t;
struct skypiax_config {
+ char span_id[80];
char name[80];
char dialplan[80];
char context[80];
@@ -2723,6 +2724,8 @@
}
if ((spans = switch_xml_child(cfg, "analog_spans"))) {
+ int i=0;
+
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");
@@ -2771,6 +2774,13 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing REQUIRED param 'id'\n");
continue;
}
+ if (switch_is_number(id)) {
+ span_id = atoi(id);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d\n", span_id);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span param 'id' MUST be a number, now id='%s'\n", id);
+ continue;
+ }
if (!name) {
@@ -2793,17 +2803,13 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "name=%s\n", name);
}
- if (switch_is_number(id)) {
- span_id = atoi(id);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d\n", span_id);
- }
-
if(span_id && span_id < SKYPIAX_MAX_INTERFACES ) {
struct skypiax_config newconf;
//skypax_config_t newconf;
memset(&newconf, '\0', sizeof(newconf));
SKYPIAX_CONFIGS[span_id]=newconf;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CONFIGURING span_id=%d\n", span_id);
+ switch_set_string(SKYPIAX_CONFIGS[span_id].span_id, id);
if (name) {
switch_set_string(SKYPIAX_CONFIGS[span_id].name, name);
} else {
@@ -2811,6 +2817,7 @@
}
switch_set_string(SKYPIAX_CONFIGS[span_id].context, context);
switch_set_string(SKYPIAX_CONFIGS[span_id].dialplan, dialplan);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].name=%s\n", span_id, SKYPIAX_CONFIGS[span_id].name);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].context=%s\n", span_id, SKYPIAX_CONFIGS[span_id].context);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].dialplan=%s\n", span_id, SKYPIAX_CONFIGS[span_id].dialplan);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STARTING span_id=%d\n", span_id);
@@ -2819,17 +2826,18 @@
continue;
}
- for(span_id=0; span_id < SKYPIAX_MAX_INTERFACES; span_id++) {
- if(strlen(SKYPIAX_CONFIGS[span_id].name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].context=%s\n", span_id, SKYPIAX_CONFIGS[span_id].context);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].dialplan=%s\n", span_id, SKYPIAX_CONFIGS[span_id].dialplan);
- }
+ }
+ for(i=0; i < SKYPIAX_MAX_INTERFACES; i++) {
+ if(strlen(SKYPIAX_CONFIGS[i].name)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].span_id=%s\n", i, SKYPIAX_CONFIGS[i].span_id);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].name=%s\n", i, SKYPIAX_CONFIGS[i].name);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].context=%s\n", i, SKYPIAX_CONFIGS[i].context);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].dialplan=%s\n", i, SKYPIAX_CONFIGS[i].dialplan);
}
}
}
-
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/gmaruzz/stuff/skypiax.conf.xml
==============================================================================
--- freeswitch/branches/gmaruzz/stuff/skypiax.conf.xml (original)
+++ freeswitch/branches/gmaruzz/stuff/skypiax.conf.xml Thu Nov 6 09:04:02 2008
@@ -46,7 +46,29 @@
<param name="dial-regex" value="9996"/>
<param name="dial-regex-fail" value="9996"/>
</span>
- <span id="2" name="cucu">
+ <span id="55" name="cucu">
+ <param name="hold-music" value="$${moh_uri}"/>
+ <param name="tonegroup" value="us"/>
+ <param name="digit-timeout" value="2000"/>
+ <param name="max-digits" value="11"/>
+ <param name="dialplan" value="XML"/>
+ <param name="context" value="default"/>
+ <param name="enable-callerid" value="true"/>
+ <param name="dial-regex" value="9996"/>
+ <param name="dial-regex-fail" value="9996"/>
+ </span>
+ <span id="55c" name="cucu">
+ <param name="hold-music" value="$${moh_uri}"/>
+ <param name="tonegroup" value="us"/>
+ <param name="digit-timeout" value="2000"/>
+ <param name="max-digits" value="11"/>
+ <param name="dialplan" value="XML"/>
+ <param name="context" value="default"/>
+ <param name="enable-callerid" value="true"/>
+ <param name="dial-regex" value="9996"/>
+ <param name="dial-regex-fail" value="9996"/>
+ </span>
+ <span id="73">
<param name="hold-music" value="$${moh_uri}"/>
<param name="tonegroup" value="us"/>
<param name="digit-timeout" value="2000"/>
@@ -68,6 +90,5 @@
<param name="dial-regex" value="9996"/>
<param name="dial-regex-fail" value="9996"/>
</span>
-
</analog_spans>
</configuration>
More information about the Freeswitch-svn
mailing list