XMLification (wave 1)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1401 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-05-10 03:23:05 +00:00
1 parent d9e8100737
commit 93666f6dd7
36 files changed
+1025 -1093

No files matched your search

+26 -18
View File
@@ -1173,7 +1173,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
break;
}
}
ldl_global_destroy();
if (globals.init) {
ldl_global_destroy();
}
}
return SWITCH_STATUS_SUCCESS;
}
@@ -1286,24 +1288,26 @@ static switch_status_t dl_login(char *arg, char *out, size_t outlen)
static switch_status_t load_config(void)
{
switch_config_t cfg;
char *var, *val;
char *cf = "dingaling.conf";
struct mdl_profile *profile = NULL;
int lastcat = -1;
switch_xml_t cfg, xml, settings, param, xmlint;
memset(&globals, 0, sizeof(globals));
globals.running = 1;
switch_core_hash_init(&globals.profile_hash, module_pool);
if (!switch_config_open_file(&cfg, cf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcasecmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcasecmp(var, "codec_prefs")) {
@@ -1315,27 +1319,30 @@ static switch_status_t load_config(void)
globals.codec_rates_last =
switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
}
} else if (!strcasecmp(cfg.category, "interface")) {
}
}
for (xmlint = switch_xml_child(cfg, "interface"); xmlint; xmlint = xmlint->next) {
for (param = switch_xml_child(xmlint, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!globals.init) {
ldl_global_init(globals.debug);
ldl_global_set_logger(dl_logger);
globals.init = 1;
}
if (cfg.catno != lastcat) {
if (profile) {
init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0);
profile = NULL;
}
lastcat = cfg.catno;
}
if(!profile) {
profile = switch_core_alloc(module_pool, sizeof(*profile));
}
set_profile_val(profile, var, val);
}
if (profile) {
init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0);
profile = NULL;
}
}
if (profile) {
@@ -1354,7 +1361,8 @@ static switch_status_t load_config(void)
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
+10 -9
View File
@@ -652,6 +652,7 @@ static switch_status_t exosip_read_frame(switch_core_session_t *session, switch_
}
switch_clear_flag(tech_pvt, TFLAG_READING);
if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
@@ -1603,22 +1604,23 @@ static void log_event(eXosip_event_t * je)
static int config_exosip(int reload)
{
switch_config_t cfg;
char *var, *val;
char *cf = "exosip.conf";
switch_xml_t cfg, xml, settings, param;
globals.bytes_per_frame = DEFAULT_BYTES_PER_FRAME;
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
globals.dtmf_duration = 100;
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "port")) {
@@ -1663,6 +1665,7 @@ static int config_exosip(int reload)
}
}
}
if (!globals.rtpip) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting ip to 'guess'\n");
@@ -1677,9 +1680,7 @@ static int config_exosip(int reload)
globals.port = 5060;
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
if (!globals.dialplan) {
set_global_dialplan("default");
+9 -6
View File
@@ -817,19 +817,21 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
static switch_status_t load_config(void)
{
switch_config_t cfg;
char *var, *val;
char *cf = "iax.conf";
switch_xml_t cfg, xml, settings, param;
memset(&globals, 0, sizeof(globals));
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "port")) {
@@ -857,11 +859,12 @@ static switch_status_t load_config(void)
if (!globals.dialplan) {
set_global_dialplan("default");
}
if (!globals.port) {
globals.port = 4569;
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
+6 -6
View File
@@ -348,20 +348,20 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface **interface, char *filename)
{
switch_config cfg;
char *var, *val;
char *cf = "opal.conf";
memset(&globals, 0, sizeof(globals));
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "port")) {
@@ -370,7 +370,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
@@ -566,19 +566,20 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
static switch_status_t load_config(void)
{
switch_config_t cfg;
char *var, *val;
char *cf = "portaudio.conf";
memset(&globals, 0, sizeof(globals));
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "sample_rate")) {
@@ -613,7 +614,7 @@ static switch_status_t load_config(void)
globals.sample_rate = 8000;
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
+18 -7
View File
@@ -1284,23 +1284,26 @@ static void pri_thread_launch(struct sangoma_pri *spri)
static switch_status_t config_wanpipe(int reload)
{
switch_config_t cfg;
char *var, *val;
char *cf = "wanpipe.conf";
int current_span = 0;
switch_xml_t cfg, xml, settings, param, span;
globals.mtu = DEFAULT_MTU;
globals.dtmf_on = 150;
globals.dtmf_off = 50;
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "mtu")) {
@@ -1312,7 +1315,15 @@ static switch_status_t config_wanpipe(int reload)
} else if (!strcmp(var, "supress_dtmf_tone")) {
globals.supress_dtmf_tone = switch_true(val);
}
} else if (!strcasecmp(cfg.category, "span")) {
}
}
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(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "span")) {
current_span = atoi(val);
if (current_span <= 0 || current_span > MAX_SPANS) {
@@ -1382,7 +1393,7 @@ static switch_status_t config_wanpipe(int reload)
}
}
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
if (!globals.dialplan) {
set_global_dialplan("default");
+15 -7
View File
@@ -1301,15 +1301,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
switch_config_t cfg;
char *var, *val;
struct woomera_profile *profile = &default_profile;
char *cf = "woomera.conf";
switch_xml_t cfg, xml, settings, param, xmlp;
memset(&globals, 0, sizeof(globals));
globals.next_woomera_port = WOOMERA_MIN_PORT;
if (!switch_config_open_file(&cfg, cf)) {
if (!(xml = switch_xml_open_cfg(cf, &cfg))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
@@ -1318,15 +1317,24 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
profile->name = "main";
strncpy(profile->dialplan, "default", sizeof(profile->dialplan) - 1);
while (switch_config_next_pair(&cfg, &var, &val)) {
if (!strcasecmp(cfg.category, "settings")) {
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "noload") && atoi(val)) {
return SWITCH_STATUS_TERM;
}
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
}
} else if (!strcasecmp(cfg.category, "profile")) {
}
}
for (xmlp = switch_xml_child(cfg, "interface"); xmlp; xmlp = xmlp->next) {
for (param = switch_xml_child(xmlp, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr(param, "name");
char *val = (char *) switch_xml_attr(param, "value");
if (!strcmp(var, "audio_ip")) {
strncpy(profile->audio_ip, val, sizeof(profile->audio_ip) - 1);
} else if (!strcmp(var, "host")) {
@@ -1351,7 +1359,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
}
switch_config_close_file(&cfg);
switch_xml_free(xml);
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {