[Freeswitch-svn] [commit] r10388 - freeswitch/trunk/src/mod/applications/mod_commands
FreeSWITCH SVN
anthm at freeswitch.org
Thu Nov 13 14:42:49 PST 2008
Author: anthm
Date: Thu Nov 13 17:42:49 2008
New Revision: 10388
Log:
add attr lookup to user_data
Modified:
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Nov 13 17:42:49 2008
@@ -112,6 +112,12 @@
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "key", key);
if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
+ if (!strcmp(type, "attr")) {
+ const char *attr = switch_xml_attr_soft(x_user, key);
+ stream->write_function(stream, "%s", attr);
+ goto end;
+ }
+
if (!strcmp(type, "var")) {
container = "variables";
elem = "variable";
@@ -3080,7 +3086,7 @@
SWITCH_ADD_API(commands_api_interface, "find_user_xml", "find a user", find_user_function, "<key> <user> <domain>");
SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user> <domain>");
SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
- SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param] <name>");
+ SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param|attr] <name>");
SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>");
SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>");
SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>");
More information about the Freeswitch-svn
mailing list