forked from Mirrors/freeswitch
FS-5731 --resolve
This commit is contained in:
parent
863e6cfa3f
commit
7d6d688e53
@ -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
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user