DUNDILOOKUP function in 1.6 should use comma delimiters.

(closes issue #15322)
 Reported by: chappell
 Patches: 
       dundilookup-0015322.patch uploaded by chappell (license 8)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-08-25 06:51:12 +00:00
parent c1b4f0c4c9
commit 9c653c4431

View File

@@ -3802,15 +3802,27 @@ int dundi_query_eid(struct dundi_entity_info *dei, const char *dcontext, dundi_e
return dundi_query_eid_internal(dei, dcontext, &eid, &hmd, dundi_ttl, 0, avoid); return dundi_query_eid_internal(dei, dcontext, &eid, &hmd, dundi_ttl, 0, avoid);
} }
enum {
OPT_BYPASS_CACHE = (1 << 0),
};
AST_APP_OPTIONS(dundi_query_opts, BEGIN_OPTIONS
AST_APP_OPTION('b', OPT_BYPASS_CACHE),
END_OPTIONS );
static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num, char *buf, size_t len) static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num, char *buf, size_t len)
{ {
char *context;
char *opts;
int results; int results;
int x; int x;
int bypass = 0;
struct ast_module_user *u; struct ast_module_user *u;
struct dundi_result dr[MAX_RESULTS]; struct dundi_result dr[MAX_RESULTS];
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(number);
AST_APP_ARG(context);
AST_APP_ARG(options);
);
char *parse;
struct ast_flags opts = { 0, };
buf[0] = '\0'; buf[0] = '\0';
@@ -3821,21 +3833,18 @@ static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num,
u = ast_module_user_add(chan); u = ast_module_user_add(chan);
context = strchr(num, '|'); parse = ast_strdupa(num);
if (context) {
*context++ = '\0'; AST_STANDARD_APP_ARGS(args, parse);
opts = strchr(context, '|');
if (opts) { if (!ast_strlen_zero(args.options)) {
*opts++ = '\0'; ast_app_parse_options(dundi_query_opts, &opts, NULL, args.options);
if (strchr(opts, 'b')) }
bypass = 1; if (ast_strlen_zero(args.context)) {
} args.context = "e164";
} }
if (ast_strlen_zero(context)) results = dundi_lookup(dr, MAX_RESULTS, NULL, args.context, args.number, ast_test_flag(&opts, OPT_BYPASS_CACHE));
context = "e164";
results = dundi_lookup(dr, MAX_RESULTS, NULL, context, num, bypass);
if (results > 0) { if (results > 0) {
sort_results(dr, results); sort_results(dr, results);
for (x = 0; x < results; x++) { for (x = 0; x < results; x++) {
@@ -3858,7 +3867,7 @@ static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num,
static struct ast_custom_function dundi_function = { static struct ast_custom_function dundi_function = {
.name = "DUNDILOOKUP", .name = "DUNDILOOKUP",
.synopsis = "Do a DUNDi lookup of a phone number.", .synopsis = "Do a DUNDi lookup of a phone number.",
.syntax = "DUNDILOOKUP(number[|context[|options]])", .syntax = "DUNDILOOKUP(number[,context[,options]])",
.desc = "This will do a DUNDi lookup of the given phone number.\n" .desc = "This will do a DUNDi lookup of the given phone number.\n"
"If no context is given, the default will be e164. The result of\n" "If no context is given, the default will be e164. The result of\n"
"this function will return the Technology/Resource found in the first result\n" "this function will return the Technology/Resource found in the first result\n"
@@ -3868,14 +3877,6 @@ static struct ast_custom_function dundi_function = {
.read = dundifunc_read, .read = dundifunc_read,
}; };
enum {
OPT_BYPASS_CACHE = (1 << 0),
};
AST_APP_OPTIONS(dundi_query_opts, BEGIN_OPTIONS
AST_APP_OPTION('b', OPT_BYPASS_CACHE),
END_OPTIONS );
static unsigned int dundi_result_id; static unsigned int dundi_result_id;
struct dundi_result_datastore { struct dundi_result_datastore {