]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 17 May 2006 00:58:21 +0000 (00:58 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 17 May 2006 00:58:21 +0000 (00:58 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1476 d0543943-73ff-0310-b7d9-9358b9ac24b2

17 files changed:
src/include/switch_xml.h
src/mod/applications/mod_ivrtest/mod_ivrtest.c
src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_exosip/mod_exosip.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/mod/endpoints/mod_woomera/mod_woomera.c
src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
src/mod/loggers/mod_console/mod_console.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
src/switch_loadable_module.c
src/switch_xml.c

index 23bf972a576563dc2e4cae4f0f6ea3c531647b68..82f305da8407e12d8e3f257e7eaa6cb6cc02d75f 100644 (file)
@@ -172,6 +172,12 @@ switch_xml_t switch_xml_idx(switch_xml_t xml, int idx);
 ///\return the value
 SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr);
 
+///\brief returns the value of the requested tag attribute, or "" if not found
+///\param xml the xml node
+///\param attr the attribute
+///\return the value
+SWITCH_DECLARE(const char *) switch_xml_attr_soft(switch_xml_t xml, const char *attr);
+
 ///\brief Traverses the switch_xml sturcture to retrieve a specific subtag. Takes a
 ///\ variable length list of tag names and indexes. The argument list must be
 ///\ terminated by either an index of -1 or an empty string tag name. Example: 
index 52930f1f9cb018aeee9aeb9796745c153d056be1..9ad8971d3ef6fefc7df80b78199f209cdfabe976 100644 (file)
@@ -63,7 +63,7 @@ static void xml_function(switch_core_session_t *session, char *data)
        const char *teamname;
 
        for (team = switch_xml_child(f1, "team"); team; team = team->next) {
-               teamname = switch_xml_attr(team, "name");
+               teamname = switch_xml_attr_soft(team, "name");
                for (driver = switch_xml_child(team, "driver"); driver; driver = driver->next) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
                                                          "%s, %s: %s\n", switch_xml_child(driver, "name")->txt, teamname,
index 3dcb8d1ee6ffa494c74df95b2409519538779188..1a4d516e0227df397f350d15c9088b7668ffe75a 100644 (file)
@@ -64,8 +64,8 @@ static void load_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "directory-name") && val) {
                                set_global_directory_name(val);
index f8ede626ceb98a436baf785240181e9e924f385c..5fb2d3a9bccfe0d9025703a5dcb82a11aec36b2f 100644 (file)
@@ -161,11 +161,11 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
        
        for (xexten = switch_xml_child(xcontext, "extension"); xexten; xexten = xexten->next) {
                int proceed = 0;
-               char *cont = (char *) switch_xml_attr(xexten, "continue");
+               char *cont = (char *) switch_xml_attr_soft(xexten, "continue");
 
                for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) {
-                       char *field = (char *) switch_xml_attr(xcond, "field");
-                       char *expression = (char *) switch_xml_attr(xcond, "expression");
+                       char *field = (char *) switch_xml_attr_soft(xcond, "field");
+                       char *expression = (char *) switch_xml_attr_soft(xcond, "expression");
                        char *field_data = switch_caller_get_field_by_name(caller_profile, field);
                        pcre *re = NULL;
                        int ovector[30];
@@ -179,8 +179,8 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
                        assert(re != NULL);
 
                        for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
-                               char *application = (char*) switch_xml_attr(xaction, "application");
-                               char *data = (char *) switch_xml_attr(xaction, "data");
+                               char *application = (char*) switch_xml_attr_soft(xaction, "application");
+                               char *data = (char *) switch_xml_attr_soft(xaction, "data");
                                char substituted[1024] = "";
                                char *app_data = NULL;
                                
index 1cd1d9bc7bf9d4c3be5a276d4842950346b3272b..968efedc63c7dd72185144de716cd389f9bce54e 100644 (file)
@@ -1305,8 +1305,8 @@ static switch_status_t load_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcasecmp(var, "debug")) {
                                globals.debug = atoi(val);
@@ -1324,8 +1324,8 @@ static switch_status_t load_config(void)
        
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!globals.init) {
                                ldl_global_init(globals.debug);
index 5833f0d6da3ff6c468d5c6a4ed83544408173edc..b177a7794bbf3e49db62ab4d4ca24a4c726a5e0f 100644 (file)
@@ -1880,8 +1880,8 @@ static int config_exosip(int reload)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "debug")) {
                                globals.debug = atoi(val);
index 54b6013c068afba61aba7c5a348a7f2cb193aaea..81e521c92da904799d1de3b5ef2795555b558ef5 100644 (file)
@@ -829,8 +829,8 @@ static switch_status_t load_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "debug")) {
                                globals.debug = atoi(val);
index 368526f56771dba7b424891d44dd2db0b8110b1f..7bf50981c53194aeb5e7389d6816389fb755d5a5 100644 (file)
@@ -578,8 +578,8 @@ static switch_status_t load_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "debug")) {
                                globals.debug = atoi(val);
index afef75e4f54352e6b3f01cf548f1404f19031d8a..80aac0926cb1bad24c6233df1c16e375ed391452 100644 (file)
@@ -1302,8 +1302,8 @@ static switch_status_t config_wanpipe(int reload)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "debug")) {
                                globals.debug = atoi(val);
@@ -1322,8 +1322,8 @@ static switch_status_t config_wanpipe(int reload)
        
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "span")) {
                                current_span = atoi(val);
index c97933c2281d893f80bade0179ace9252362354f..2b4ac64f82fcd8180e4bae6cad6ae5894bbc4da4 100644 (file)
@@ -1317,8 +1317,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "noload") && atoi(val)) {
                                return SWITCH_STATUS_TERM;
@@ -1331,8 +1331,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
                        if (!strcmp(var, "audio_ip")) {
                                strncpy(profile->audio_ip, val, sizeof(profile->audio_ip) - 1);
                        } else if (!strcmp(var, "host")) {
index 655c1b5d60c963b038483b64ca4acc6d42123f82..c041a1c30b3990eda482b8aaa9b24b22ff16af50 100644 (file)
@@ -66,8 +66,8 @@ static switch_status_t load_config(void)
        
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcasecmp(var, "address")) {
                                set_global_address(val);
index a2b2b530e0789067e8eeac793d2ea6460a92edc8..f89d341d8ae2736bf1e69befbb2a0f2508f1b482 100644 (file)
@@ -111,8 +111,8 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcmp(var, "jid")) {
                                set_global_jid(val);
index 05234cbca96bf7e952a7f1cb07cecc41b9ae2b51..0bb3fe12a4a583072afb7e8f7945bee7f3b5e057 100644 (file)
@@ -206,8 +206,8 @@ static switch_status_t load_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
                        
                        if (!strcmp(var, "browse")) {
                                if ((oid = switch_core_alloc(module_pool, sizeof(*oid))) != 0) {
index 4598265bd0c93f2a75f9308516ad55aa99c37c03..2145a5231fbcf89aef00a30842e83268950f326e 100644 (file)
@@ -93,8 +93,8 @@ static switch_status_t config_logger(void)
        
        if ((settings = switch_xml_child(cfg, "mappings"))) {
                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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        add_mapping(var, val);
                }
index 5a3c73ead67c5b9c8fc1b4394a947540c4f0f64b..ca67b60dc9f904bd073976cd4512c7065ada9599 100644 (file)
@@ -146,11 +146,11 @@ static switch_status_t do_config(void)
 
        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");
+                       char *var = (char *) switch_xml_attr_soft(param, "name");
+                       char *val = (char *) switch_xml_attr_soft(param, "value");
 
                        if (!strcasecmp(var, "gateway-url")) {
-                               char *bindings = (char *) switch_xml_attr(param, "bindings");
+                               char *bindings = (char *) switch_xml_attr_soft(param, "bindings");
                                set_global_bindings(bindings);
                                set_global_url(val);
                        } else if (!strcasecmp(var, "http-port")) {
index 9a48f4ca9baa2977da5bab949114751ae4a0a124..d1d27897011e576cd6db34ad09bc6eed11694931 100644 (file)
@@ -476,7 +476,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
 
                if ((mods = switch_xml_child(cfg, "modules"))) {
                        for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
-                               const char *val = switch_xml_attr(ld, "module");
+                               const char *val = switch_xml_attr_soft(ld, "module");
                                if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
                                        continue;
@@ -496,7 +496,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
 
                if ((mods = switch_xml_child(cfg, "modules"))) {
                        for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
-                               const char *val = switch_xml_attr(ld, "module");
+                               const char *val = switch_xml_attr_soft(ld, "module");
                                if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
                                        continue;
index a3adf0440ee7a14b88ff50ee843071a7f9a2e02d..34607728d808c7549a33ee23515195598bd21778 100644 (file)
@@ -192,6 +192,14 @@ switch_xml_t switch_xml_idx(switch_xml_t xml, int idx)
     return xml;
 }
 
+// returns the value of the requested tag attribute or "" if not found
+SWITCH_DECLARE(const char *) switch_xml_attr_soft(switch_xml_t xml, const char *attr)
+{
+       const char *ret = switch_xml_attr(xml, attr);
+
+       return ret ? ret : "";
+}
+
 // returns the value of the requested tag attribute or NULL if not found
 SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr)
 {