[asterisk-commits] tilghman: branch 1.6.1 r213977 - in /branches/1.6.1: ./ pbx/pbx_dundi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 25 01:53:11 CDT 2009


Author: tilghman
Date: Tue Aug 25 01:53:09 2009
New Revision: 213977

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213977
Log:
Merged revisions 213975 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r213975 | tilghman | 2009-08-25 01:51:12 -0500 (Tue, 25 Aug 2009) | 6 lines
  
  DUNDILOOKUP function in 1.6 should use comma delimiters.
  (closes issue #15322)
   Reported by: chappell
   Patches: 
         dundilookup-0015322.patch uploaded by chappell (license 8)
........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/pbx/pbx_dundi.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/pbx/pbx_dundi.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/pbx/pbx_dundi.c?view=diff&rev=213977&r1=213976&r2=213977
==============================================================================
--- branches/1.6.1/pbx/pbx_dundi.c (original)
+++ branches/1.6.1/pbx/pbx_dundi.c Tue Aug 25 01:53:09 2009
@@ -3854,15 +3854,27 @@
 	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)
 {
-	char *context;
-	char *opts;
 	int results;
 	int x;
-	int bypass = 0;
 	struct ast_module_user *u;
 	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';
 
@@ -3873,21 +3885,18 @@
 
 	u = ast_module_user_add(chan);
 
-	context = strchr(num, '|');
-	if (context) {
-		*context++ = '\0';
-		opts = strchr(context, '|');
-		if (opts) {
-			*opts++ = '\0';
-			if (strchr(opts, 'b'))
-				bypass = 1;
-		}
-	}
-
-	if (ast_strlen_zero(context))
-		context = "e164";
-	
-	results = dundi_lookup(dr, MAX_RESULTS, NULL, context, num, bypass);
+	parse = ast_strdupa(num);
+
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if (!ast_strlen_zero(args.options)) {
+		ast_app_parse_options(dundi_query_opts, &opts, NULL, args.options);
+	}
+	if (ast_strlen_zero(args.context)) {
+		args.context = "e164";
+	}
+
+	results = dundi_lookup(dr, MAX_RESULTS, NULL, args.context, args.number, ast_test_flag(&opts, OPT_BYPASS_CACHE));
 	if (results > 0) {
 		sort_results(dr, results);
 		for (x = 0; x < results; x++) {
@@ -3910,7 +3919,7 @@
 static struct ast_custom_function dundi_function = {
 	.name = "DUNDILOOKUP",
 	.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"
 	"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"
@@ -3919,14 +3928,6 @@
 	"be bypassed.\n",
 	.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 );
 
 unsigned int dundi_result_id;
 




More information about the asterisk-commits mailing list