[Asterisk-cvs] asterisk/apps app_enumlookup.c,1.29,1.30

markster markster
Wed Nov 9 16:23:51 CST 2005


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

Modified Files:
	app_enumlookup.c 
Log Message:
Fix enum lookup (bug 5674)


Index: app_enumlookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_enumlookup.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- app_enumlookup.c	8 Nov 2005 04:48:00 -0000	1.29
+++ app_enumlookup.c	9 Nov 2005 21:14:45 -0000	1.30
@@ -43,6 +43,7 @@
 #include "asterisk/module.h"
 #include "asterisk/enum.h"
 #include "asterisk/utils.h"
+#include "asterisk/app.h"
 #include "asterisk/options.h"
 
 static char *tdesc = "ENUM Lookup";
@@ -80,9 +81,14 @@
 	char tech[80];
 	char dest[80];
 	char tmp[256];
-	char *c,*t,*d,*o = NULL;
+	char *c,*t = NULL;
 	static int dep_warning=0;
 	struct localuser *u;
+	char *parse;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(d);
+		AST_APP_ARG(o);
+	);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "EnumLookup requires an argument (extension)\n");
@@ -96,20 +102,24 @@
 
 	LOCAL_USER_ADD(u);
 
+	parse = ast_strdupa(data);
+	if (!parse) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
+	AST_STANDARD_APP_ARGS(args, parse);
+
 	tech[0] = '\0';
+	dest[0] = '\0';
 
-	if (strchr(data, '|')) {
-		d = strsep(data, "|");
-		o = strsep(data, "\0");
-	} else
-		d = strsep(data, "\0");	
-		
-	if (o) {
-		if (strchr(o, 'j'))
+	if (args.o) {
+		if (strchr(args.o, 'j'))
 			priority_jump = 1;
 	}
 
-	res = ast_get_enum(chan, d, dest, sizeof(dest), tech, sizeof(tech), NULL, NULL);
+	res = ast_get_enum(chan, args.d, dest, sizeof(dest), tech, sizeof(tech), NULL, NULL);
 	
 	if (!res) {	/* Failed to do a lookup */
 		if (priority_jump || option_priority_jumping) {




More information about the svn-commits mailing list