diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-09 21:14:45 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-09 21:14:45 +0000 |
commit | dad4d776e3d70d64f9b5803a3cdbb3792104a5c8 (patch) | |
tree | dbc01634461d561a77889c448e4157884ca0511a /apps/app_enumlookup.c | |
parent | d1733b5867e3af3b352a7a6c4ef8d0cd035380d3 (diff) |
Fix enum lookup (bug 5674)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7045 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_enumlookup.c')
-rwxr-xr-x | apps/app_enumlookup.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/apps/app_enumlookup.c b/apps/app_enumlookup.c index 435ff61e1..bd209c47b 100755 --- a/apps/app_enumlookup.c +++ b/apps/app_enumlookup.c @@ -43,6 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/enum.h" #include "asterisk/utils.h" +#include "asterisk/app.h" #include "asterisk/options.h" static char *tdesc = "ENUM Lookup"; @@ -80,9 +81,14 @@ static int enumlookup_exec(struct ast_channel *chan, void *data) char tech[80]; char dest[80]; char tmp[256]; - char *c,*t,*d,*o = NULL; + char *c,*t = NULL; static int dep_warning=0; struct localuser *u; + char *parse; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(d); + AST_APP_ARG(o); + ); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "EnumLookup requires an argument (extension)\n"); @@ -96,20 +102,24 @@ static int enumlookup_exec(struct ast_channel *chan, void *data) LOCAL_USER_ADD(u); + parse = ast_strdupa(data); + if (!parse) { + ast_log(LOG_ERROR, "Out of memory!\n"); + LOCAL_USER_REMOVE(u); + return -1; + } + + AST_STANDARD_APP_ARGS(args, parse); + tech[0] = '\0'; + dest[0] = '\0'; - if (strchr(data, '|')) { - d = strsep(data, "|"); - o = strsep(data, "\0"); - } else - d = strsep(data, "\0"); - - if (o) { - if (strchr(o, 'j')) + if (args.o) { + if (strchr(args.o, 'j')) priority_jump = 1; } - res = ast_get_enum(chan, d, dest, sizeof(dest), tech, sizeof(tech), NULL, NULL); + res = ast_get_enum(chan, args.d, dest, sizeof(dest), tech, sizeof(tech), NULL, NULL); if (!res) { /* Failed to do a lookup */ if (priority_jump || option_priority_jumping) { |