[Freeswitch-branches] [commit] r10268 - in freeswitch/branches/gmaruzz: src/mod/endpoints/mod_skypiax stuff
Freeswitch SVN
gmaruzz at freeswitch.org
Fri Nov 7 11:40:54 PST 2008
Author: gmaruzz
Date: Thu Nov 6 08:40:41 2008
New Revision: 10268
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 08:40:41 2008
@@ -2271,6 +2271,7 @@
typedef struct private_object private_t;
struct skypiax_config {
+ char name[80];
char dialplan[80];
char context[80];
char dial_regex[256];
@@ -2774,7 +2775,6 @@
if (!name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "span missing param 'name', not nice, but works\n");
- //continue;
}
if (!tonegroup) {
@@ -2798,57 +2798,34 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d\n", span_id);
}
- if(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);
+ if (name) {
+ switch_set_string(SKYPIAX_CONFIGS[span_id].name, name);
+ } else {
+ switch_set_string(SKYPIAX_CONFIGS[span_id].name, "N/A");
+ }
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].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);
- }
-//FIXME
- /*
- if (zstatus != ZAP_SUCCESS) {
- zap_log(ZAP_LOG_ERROR, "Error finding Skypiax span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name));
- continue;
- }
-
- if (!span_id) {
- span_id = span->span_id;
- }
- if (zap_configure_span("analog", span, on_analog_signal,
- "tonemap", tonegroup,
- "digit_timeout", &to,
- "max_dialstr", &max,
- "hotline", hotline,
- "enable_callerid", enable_callerid,
- TAG_END) != ZAP_SUCCESS) {
- zap_log(ZAP_LOG_ERROR, "Error starting Skypiax span %d\n", span_id);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n", span_id, SKYPIAX_MAX_INTERFACES);
continue;
}
- SPAN_CONFIG[span->span_id].span = span;
- switch_set_string(SPAN_CONFIG[span->span_id].context, context);
- switch_set_string(SPAN_CONFIG[span->span_id].dialplan, dialplan);
-
- if (dial_regex) {
- switch_set_string(SPAN_CONFIG[span->span_id].dial_regex, dial_regex);
- }
-
- if (fail_dial_regex) {
- switch_set_string(SPAN_CONFIG[span->span_id].fail_dial_regex, fail_dial_regex);
- }
+ 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);
+ }
- if (hold_music) {
- switch_set_string(SPAN_CONFIG[span->span_id].hold_music, hold_music);
}
- switch_copy_string(SPAN_CONFIG[span->span_id].type, "analog", sizeof(SPAN_CONFIG[span->span_id].type));
- zap_span_start(span);
- */
}
}
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 08:40:41 2008
@@ -22,6 +22,7 @@
<param name="dial-regex" value="9996"/>
<param name="dial-regex-fail" value="9996"/>
</span>
+ <!-- following has no id, error! -->
<span name="ciapalo">
<param name="hold-music" value="$${moh_uri}"/>
<param name="tonegroup" value="us"/>
@@ -33,6 +34,7 @@
<param name="dial-regex" value="9996"/>
<param name="dial-regex-fail" value="9996"/>
</span>
+ <!-- following has no id, error! -->
<span>
<param name="hold-music" value="$${moh_uri}"/>
<param name="tonegroup" value="us"/>
@@ -44,5 +46,28 @@
<param name="dial-regex" value="9996"/>
<param name="dial-regex-fail" value="9996"/>
</span>
+ <span id="2" 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="3">
+ <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>
+
</analog_spans>
</configuration>
More information about the Freeswitch-branches
mailing list