[Asterisk-cvs] asterisk/pbx pbx_dundi.c,1.17,1.18

markster at lists.digium.com markster at lists.digium.com
Sat Nov 6 16:31:11 CST 2004


Update of /usr/cvsroot/asterisk/pbx
In directory mongoose.digium.com:/tmp/cvs-serv23841/pbx

Modified Files:
	pbx_dundi.c 
Log Message:
Add features (incomplete, highly experimental), fix DundiLookup app, debug improvements (bug #2800)


Index: pbx_dundi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_dundi.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- pbx_dundi.c	3 Nov 2004 22:04:40 -0000	1.17
+++ pbx_dundi.c	6 Nov 2004 21:33:01 -0000	1.18
@@ -3824,10 +3824,14 @@
 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 @@
 			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;
 }




More information about the svn-commits mailing list