Add features (incomplete, highly experimental), fix DundiLookup app, debug improvements (bug #2800)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-11-06 21:33:01 +00:00
parent 0f11b3b189
commit 6cb38ac23a
7 changed files with 598 additions and 23 deletions

View File

@@ -3824,10 +3824,14 @@ int dundi_query_eid(struct dundi_entity_info *dei, const char *dcontext, dundi_e
static int dundi_lookup_exec(struct ast_channel *chan, void *data)
{
char *tmp;
char *context;
char *context = NULL;
char *opts;
int res = -1;
int res = 0;
int results = 0;
int x;
int bypass = 0;
struct localuser *u;
struct dundi_result dr[MAX_RESULTS];
if (!data || !strlen(data)) {
ast_log(LOG_WARNING, "DUNDiLookup requires an argument (number)\n");
@@ -3853,6 +3857,20 @@ static int dundi_lookup_exec(struct ast_channel *chan, void *data)
opts = "";
}
results = dundi_lookup(dr, MAX_RESULTS, NULL, context, tmp, bypass);
if (results > 0) {
sort_results(dr, results);
for (x=0;x<results;x++) {
if (dr[x].flags & DUNDI_FLAG_EXISTS) {
pbx_builtin_setvar_helper(chan, "DUNDTECH", dr[x].tech);
pbx_builtin_setvar_helper(chan, "DUNDDEST", dr[x].dest);
break;
}
}
} else {
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
}
LOCAL_USER_REMOVE(u);
return res;
}