aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_dundi.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-11-06 21:33:01 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-11-06 21:33:01 +0000
commitbf6699ffaa0bd600fc9ec757bb71f95bbdb85ec8 (patch)
treea5f42628f0ff2ce1270ac8d345ee3b0d2dd37d6f /pbx/pbx_dundi.c
parent77e6c046554ed00cf54f9cc6b9f9eaabc756dabe (diff)
Add features (incomplete, highly experimental), fix DundiLookup app, debug improvements (bug #2800)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4167 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_dundi.c')
-rwxr-xr-xpbx/pbx_dundi.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 0c8b86555..7aa4efb2c 100755
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -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;
}