mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-11 09:57:16 +00:00
FS-6032 --resolve
This commit is contained in:
parent
03e59c3efa
commit
c9585b1e8d
@ -1108,7 +1108,7 @@ SWITCH_STANDARD_API(in_group_function)
|
|||||||
|
|
||||||
SWITCH_STANDARD_API(user_data_function)
|
SWITCH_STANDARD_API(user_data_function)
|
||||||
{
|
{
|
||||||
switch_xml_t x_domain, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params;
|
switch_xml_t x_user = NULL, x_param, x_params;
|
||||||
int argc;
|
int argc;
|
||||||
char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain, *dup_domain = NULL;
|
char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain, *dup_domain = NULL;
|
||||||
char delim = ' ';
|
char delim = ' ';
|
||||||
@ -1143,7 +1143,7 @@ SWITCH_STANDARD_API(user_data_function)
|
|||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain);
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain);
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "type", type);
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "type", type);
|
||||||
|
|
||||||
if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, &x_group, params) == SWITCH_STATUS_SUCCESS) {
|
if (key && type && switch_xml_locate_user_merged("id:number-alias", user, domain, NULL, &x_user, params) == SWITCH_STATUS_SUCCESS) {
|
||||||
if (!strcmp(type, "attr")) {
|
if (!strcmp(type, "attr")) {
|
||||||
const char *attr = switch_xml_attr_soft(x_user, key);
|
const char *attr = switch_xml_attr_soft(x_user, key);
|
||||||
result = attr;
|
result = attr;
|
||||||
@ -1155,29 +1155,6 @@ SWITCH_STANDARD_API(user_data_function)
|
|||||||
elem = "variable";
|
elem = "variable";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x_params = switch_xml_child(x_domain, container))) {
|
|
||||||
for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) {
|
|
||||||
const char *var = switch_xml_attr(x_param, "name");
|
|
||||||
const char *val = switch_xml_attr(x_param, "value");
|
|
||||||
|
|
||||||
if (var && val && !strcasecmp(var, key)) {
|
|
||||||
result = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x_group && (x_params = switch_xml_child(x_group, container))) {
|
|
||||||
for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) {
|
|
||||||
const char *var = switch_xml_attr(x_param, "name");
|
|
||||||
const char *val = switch_xml_attr(x_param, "value");
|
|
||||||
|
|
||||||
if (var && val && !strcasecmp(var, key)) {
|
|
||||||
result = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((x_params = switch_xml_child(x_user, container))) {
|
if ((x_params = switch_xml_child(x_user, container))) {
|
||||||
for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) {
|
for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) {
|
||||||
const char *var = switch_xml_attr(x_param, "name");
|
const char *var = switch_xml_attr(x_param, "name");
|
||||||
@ -1194,7 +1171,7 @@ SWITCH_STANDARD_API(user_data_function)
|
|||||||
if (result) {
|
if (result) {
|
||||||
stream->write_function(stream, "%s", result);
|
stream->write_function(stream, "%s", result);
|
||||||
}
|
}
|
||||||
switch_xml_free(xml);
|
switch_xml_free(x_user);
|
||||||
switch_safe_free(mydata);
|
switch_safe_free(mydata);
|
||||||
switch_safe_free(dup_domain);
|
switch_safe_free(dup_domain);
|
||||||
switch_event_destroy(¶ms);
|
switch_event_destroy(¶ms);
|
||||||
@ -1204,7 +1181,7 @@ SWITCH_STANDARD_API(user_data_function)
|
|||||||
|
|
||||||
static switch_status_t _find_user(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream, switch_bool_t tf)
|
static switch_status_t _find_user(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream, switch_bool_t tf)
|
||||||
{
|
{
|
||||||
switch_xml_t x_domain = NULL, x_user = NULL, xml = NULL;
|
switch_xml_t x_user = NULL;
|
||||||
int argc;
|
int argc;
|
||||||
char *mydata = NULL, *argv[3];
|
char *mydata = NULL, *argv[3];
|
||||||
char *key, *user, *domain;
|
char *key, *user, *domain;
|
||||||
@ -1244,7 +1221,7 @@ static switch_status_t _find_user(const char *cmd, switch_core_session_t *sessio
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_xml_locate_user(key, user, domain, NULL, &xml, &x_domain, &x_user, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
if (switch_xml_locate_user_merged(key, user, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
err = "can't find user";
|
err = "can't find user";
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -1274,7 +1251,7 @@ static switch_status_t _find_user(const char *cmd, switch_core_session_t *sessio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_xml_free(xml);
|
switch_xml_free(x_user);
|
||||||
switch_safe_free(mydata);
|
switch_safe_free(mydata);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user