aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_enum.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-21 05:54:04 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-21 05:54:04 +0000
commit8cbd10e0545ff4479bdf29c1e106be353fd9c70a (patch)
tree1def0f840e20030894caa62117d33b4371f05288 /funcs/func_enum.c
parenta991aeeac69e289a0a43b2cee8c67ed6a7ede310 (diff)
Bug 6699 - Fix for ENUMLOOKUP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13710 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_enum.c')
-rw-r--r--funcs/func_enum.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index 7cd73c750..5f1b01d56 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -64,7 +64,7 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data,
);
int res = 0;
char tech[80];
- char dest[256] = "";
+ char dest[256] = "", tmp[2] = "", num[AST_MAX_EXTENSION] = "";
struct localuser *u;
char *s, *p;
@@ -82,6 +82,8 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data,
return -1;
}
+ LOCAL_USER_ADD(u);
+
ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech));
if (!args.zone)
@@ -92,24 +94,24 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data,
/* strip any '-' signs from number */
for (s = p = args.number; *s; s++) {
- if (*s != '-')
- *p++ = *s;
- }
- *p = '\0';
+ if (*s != '-') {
+ snprintf(tmp, sizeof(tmp), "%c", *s);
+ strncat(num, tmp, sizeof(num));
+ }
- LOCAL_USER_ADD(u);
+ }
- res = ast_get_enum(chan, p, dest, sizeof(dest), tech, sizeof(tech), args.zone,
+ res = ast_get_enum(chan, num, dest, sizeof(dest), tech, sizeof(tech), args.zone,
args.options);
- LOCAL_USER_REMOVE(u);
-
p = strchr(dest, ':');
if (p && strcasecmp(tech, "ALL"))
ast_copy_string(buf, p + 1, len);
else
ast_copy_string(buf, dest, len);
+ LOCAL_USER_REMOVE(u);
+
return 0;
}