mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 07:01:09 +00:00
Fix enum lookup (bug 5674)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -43,6 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/enum.h"
|
#include "asterisk/enum.h"
|
||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
|
#include "asterisk/app.h"
|
||||||
#include "asterisk/options.h"
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
static char *tdesc = "ENUM Lookup";
|
static char *tdesc = "ENUM Lookup";
|
||||||
@@ -80,9 +81,14 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
|
|||||||
char tech[80];
|
char tech[80];
|
||||||
char dest[80];
|
char dest[80];
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
char *c,*t,*d,*o = NULL;
|
char *c,*t = NULL;
|
||||||
static int dep_warning=0;
|
static int dep_warning=0;
|
||||||
struct localuser *u;
|
struct localuser *u;
|
||||||
|
char *parse;
|
||||||
|
AST_DECLARE_APP_ARGS(args,
|
||||||
|
AST_APP_ARG(d);
|
||||||
|
AST_APP_ARG(o);
|
||||||
|
);
|
||||||
|
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_WARNING, "EnumLookup requires an argument (extension)\n");
|
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);
|
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';
|
tech[0] = '\0';
|
||||||
|
dest[0] = '\0';
|
||||||
|
|
||||||
if (strchr(data, '|')) {
|
if (args.o) {
|
||||||
d = strsep(data, "|");
|
if (strchr(args.o, 'j'))
|
||||||
o = strsep(data, "\0");
|
|
||||||
} else
|
|
||||||
d = strsep(data, "\0");
|
|
||||||
|
|
||||||
if (o) {
|
|
||||||
if (strchr(o, 'j'))
|
|
||||||
priority_jump = 1;
|
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 (!res) { /* Failed to do a lookup */
|
||||||
if (priority_jump || option_priority_jumping) {
|
if (priority_jump || option_priority_jumping) {
|
||||||
|
Reference in New Issue
Block a user