]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5731 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Aug 2013 15:25:14 +0000 (20:25 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Aug 2013 15:25:14 +0000 (20:25 +0500)
13 files changed:
src/include/switch_core.h
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_httapi/mod_httapi.c
src/mod/applications/mod_valet_parking/mod_valet_parking.c
src/mod/applications/mod_voicemail/mod_voicemail.c
src/mod/endpoints/mod_rtmp/rtmp_sig.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
src/switch_core.c

index 880cf9b893e0706430a7616a9215957196fbf120..1a12da7129a9db2d30808fb950d106ef0dcc97bf 100644 (file)
@@ -878,6 +878,8 @@ SWITCH_DECLARE(char *) switch_core_get_variable_pdup(_In_z_ const char *varname,
 SWITCH_DECLARE(const char *) switch_core_get_hostname(void);
 SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
 
+SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup);
+
 /*! 
   \brief Add a global variable to the core
   \param varname the name of the variable
index abc0aace9a7d5ce4b3f25c083770c64ee9b50a8c..2b7804dd315af7d4610b827a75accaef200539d3 100644 (file)
@@ -467,7 +467,7 @@ SWITCH_STANDARD_API(reg_url_function)
        }
 
        if (zstr(domain)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                domain = dup_domain;
        }
 
@@ -886,7 +886,7 @@ SWITCH_STANDARD_API(group_call_function)
        if (domain) {
                *domain++ = '\0';
        } else {
-               if ((dup_domain = switch_core_get_variable_dup("domain"))) {
+               if ((dup_domain = switch_core_get_domain(SWITCH_TRUE))) {
                        domain = dup_domain;
                }
        }
@@ -1076,7 +1076,7 @@ SWITCH_STANDARD_API(in_group_function)
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
-               if ((dup_domain = switch_core_get_variable_dup("domain"))) {
+               if ((dup_domain = switch_core_get_domain(SWITCH_TRUE))) {
                        domain = dup_domain;
                }
        }
@@ -1131,7 +1131,7 @@ SWITCH_STANDARD_API(user_data_function)
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
-               if ((dup_domain = switch_core_get_variable_dup("domain"))) {
+               if ((dup_domain = switch_core_get_domain(SWITCH_TRUE))) {
                        domain = dup_domain;
                } else {
                        domain = "cluecon.com";
index 19cb8602679ea20124824e5f6915e8126b3335be..398491eb13adedd530a28a129488c87ce8326a8e 100644 (file)
@@ -643,7 +643,7 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even
 
        if (!event || !(domain = switch_event_get_header(event, "conference-domain"))) {
                if (!(domain = conference->domain)) {
-                       dup_domain = switch_core_get_variable_dup("domain");
+                       dup_domain = switch_core_get_domain(SWITCH_TRUE);
                        if (!(domain = dup_domain)) {
                                domain = "cluecon.com";
                        }
@@ -1338,7 +1338,7 @@ static void send_rfc_event(conference_obj_t *conference)
        }
 
        if (!(domain = conference->domain)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                if (!(domain = dup_domain)) {
                        domain = "cluecon.com";
                }
@@ -1377,7 +1377,7 @@ static void send_conference_notify(conference_obj_t *conference, const char *sta
        }
 
        if (!(domain = conference->domain)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                if (!(domain = dup_domain)) {
                        domain = "cluecon.com";
                }
index 1f910c70ab605d0c6f9d5cb4916345c2289c7a8a..a05f880a4a17e8fe3400a5c190fafcb8ae4499ce 100755 (executable)
@@ -3288,7 +3288,7 @@ static void pickup_send_presence(const char *key_name)
        }
        
        if (zstr(domain_name)) {
-               dup_domain_name = switch_core_get_variable_dup("domain");
+               dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
                domain_name = dup_domain_name;
        }
        
@@ -3363,7 +3363,7 @@ static void pickup_pres_event_handler(switch_event_t *event)
        if ((domain_name = strchr(key_name, '@'))) {
                *domain_name++ = '\0';
        } else {
-               dup_domain_name = switch_core_get_variable_dup("domain");
+               dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
                domain_name = dup_domain_name;
        }
 
@@ -3422,7 +3422,7 @@ static void pickup_add_session(switch_core_session_t *session, const char *key)
        char *dup_key = NULL;
 
        if (!strchr(key, '@')) {
-               dup_key = switch_mprintf("%s@%s", key, switch_core_get_variable("domain"));
+               dup_key = switch_mprintf("%s@%s", key, switch_core_get_domain(SWITCH_FALSE));
                key = dup_key;
        }
 
@@ -3456,7 +3456,7 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
        char *dup_key = NULL;
 
        if (!strchr(key, '@')) {
-               dup_key = switch_mprintf("%s@%s", key, switch_core_get_variable("domain"));
+               dup_key = switch_mprintf("%s@%s", key, switch_core_get_domain(SWITCH_FALSE));
                key = dup_key;
        }
 
@@ -3781,7 +3781,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session
        if ((domain = strchr(group, '@'))) {
                *domain++ = '\0';
        } else {
-               domain = switch_core_get_variable_dup("domain");
+               domain = switch_core_get_domain(SWITCH_TRUE);
                dup_domain = domain;
        }
 
@@ -3904,7 +3904,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
-               domain = switch_core_get_variable_dup("domain");
+               domain = switch_core_get_domain(SWITCH_TRUE);
                dup_domain = domain;
        }
 
index 05652d2c23e18b114bfe36c1040bb9ad9aa63ced..d2cefcfea4f697a42f2e9878a21742cca945dc2a 100644 (file)
@@ -863,7 +863,7 @@ static fifo_node_t *create_node(const char *name, uint32_t importance, switch_mu
        node->name = switch_core_strdup(node->pool, name);
 
        if (!strchr(name, '@')) {
-               domain_name = switch_core_get_variable_dup("domain");
+               domain_name = switch_core_get_domain(SWITCH_TRUE);
                node->domain_name = switch_core_strdup(node->pool, domain_name);
        }
 
index 52e4a21a6bf2c5d84aa11a68dd52b49863c63abd..e5bfac12aeee457ac1265ac023b1798e77c40ad2 100644 (file)
@@ -263,7 +263,7 @@ static switch_status_t parse_voicemail(const char *tag_name, client_t *client, s
        if (zstr(profile)) profile = "default";
 
        if (zstr(domain)) {
-               if ((ddom = switch_core_get_variable_dup("domain"))) {
+               if ((ddom = switch_core_get_domain(SWITCH_TRUE))) {
                        domain = ddom;
                }
        }
index a428f82684f675b71ab28206591a274d67f2d9d4..f14c81c3bf087958ed9dff73a2cff1212674b0a6 100644 (file)
@@ -287,7 +287,7 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
        }
        
        if (zstr(domain_name)) {
-               dup_domain_name = switch_core_get_variable_dup("domain");
+               dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
                domain_name = dup_domain_name;
        }
        
index e7d4da79ca9061585306f2bb66553e84084e3b4f..bf355d043b19d342d7de4741fbe27d02cd5a3706 100644 (file)
@@ -3167,7 +3167,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
        }
 
        if (zstr(domain)) {
-               if ((dup_domain = switch_core_get_variable_dup("domain"))) {
+               if ((dup_domain = switch_core_get_domain(SWITCH_TRUE))) {
                        domain = dup_domain;
                }
                profile_name = domain;
index fb82b180ea4eb69d17942123bf8dbecfd07218c0..a3160eee5b3e209ce87d3ffbfe96216295fa2349 100644 (file)
@@ -376,7 +376,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_login)
        }
        
        if (zstr(domain)) {
-               ddomain = switch_core_get_variable_dup("domain");
+               ddomain = switch_core_get_domain(SWITCH_TRUE);
                domain = ddomain;
        }
 
index 7c146f41ba2edba1dbd707bc8eaa2c9263ce1a17..e3ffae4778d50c8d7e2a62d3cc4a3ff23fb92a3d 100644 (file)
@@ -3538,7 +3538,7 @@ SWITCH_STANDARD_API(sofia_contact_function)
        }
 
        if (zstr(domain)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                domain = dup_domain;
        }
 
@@ -3728,7 +3728,7 @@ SWITCH_STANDARD_API(sofia_presence_data_function)
        }
 
        if (zstr(domain)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                domain = dup_domain;
        }
 
index 6f3ba5c8a46c19788f1a81d2af430f2ecebfc17e..465455568be199db59273480ff31703303b16e78 100644 (file)
@@ -1037,7 +1037,7 @@ static void conference_data_event_handler(switch_event_t *event)
        sofia_profile_t *profile = NULL;
 
        if (zstr(host)) {
-               dup_domain = switch_core_get_variable_dup("domain");
+               dup_domain = switch_core_get_domain(SWITCH_TRUE);
                host = dup_domain;
        }
 
index 3db20be69be0ee497109f2e897461de0faafe8c4..9d9e3fbb141dc5d3479d3c252d43b4eb5ca37d91 100644 (file)
@@ -428,7 +428,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                                                if (globals.default_domain) {
                                                        domain_name = globals.default_domain;
                                                } else {
-                                                       if ((dup_domain = switch_core_get_variable_dup("domain"))) {
+                                                       if ((dup_domain = switch_core_get_domain(SWITCH_TRUE))) {
                                                                domain_name = dup_domain;
                                                        }
                                                }
index b2dc5dc2ab2456b0944267bd79c77ba970fb9e56..652916668616aac9905b520c62f0ec10cfae616d 100644 (file)
@@ -311,6 +311,24 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void)
        return runtime.hostname;
 }
 
+SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup)
+{
+       char *domain;
+       const char *var;
+
+       switch_thread_rwlock_rdlock(runtime.global_var_rwlock);  
+       if (!(var = switch_core_get_variable("domain"))) {
+               var = "freeswitch.local";
+       }
+       if (dup) {
+               domain = strdup(var);
+       } else {
+               domain = (char *) var;
+       }
+       switch_thread_rwlock_unlock(runtime.global_var_rwlock);
+
+       return domain;
+}
 
 SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event)
 {