[asterisk-commits] trunk r13710 - /trunk/funcs/func_enum.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 20 22:54:05 MST 2006


Author: tilghman
Date: Mon Mar 20 23:54:04 2006
New Revision: 13710

URL: http://svn.digium.com/view/asterisk?rev=13710&view=rev
Log:
Bug 6699 - Fix for ENUMLOOKUP

Modified:
    trunk/funcs/func_enum.c

Modified: trunk/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_enum.c?rev=13710&r1=13709&r2=13710&view=diff
==============================================================================
--- trunk/funcs/func_enum.c (original)
+++ trunk/funcs/func_enum.c Mon Mar 20 23:54:04 2006
@@ -64,7 +64,7 @@
 	);
 	int res = 0;
 	char tech[80];
-	char dest[256] = "";
+	char dest[256] = "", tmp[2] = "", num[AST_MAX_EXTENSION] = "";
 	struct localuser *u;
 	char *s, *p;
 
@@ -82,6 +82,8 @@
 		return -1;
 	}
 
+	LOCAL_USER_ADD(u);
+
 	ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech));
 
 	if (!args.zone)
@@ -92,23 +94,23 @@
 
 	/* strip any '-' signs from number */
 	for (s = p = args.number; *s; s++) {
-		if (*s != '-')
-			*p++ = *s;
-	}
-	*p = '\0';
-
-	LOCAL_USER_ADD(u);
-
-	res = ast_get_enum(chan, p, dest, sizeof(dest), tech, sizeof(tech), args.zone,
+		if (*s != '-') {
+			snprintf(tmp, sizeof(tmp), "%c", *s);
+			strncat(num, tmp, sizeof(num));
+		}
+
+	}
+
+	res = ast_get_enum(chan, num, dest, sizeof(dest), tech, sizeof(tech), args.zone,
 			   args.options);
-
-	LOCAL_USER_REMOVE(u);
 
 	p = strchr(dest, ':');
 	if (p && strcasecmp(tech, "ALL"))
 		ast_copy_string(buf, p + 1, len);
 	else
 		ast_copy_string(buf, dest, len);
+
+	LOCAL_USER_REMOVE(u);
 
 	return 0;
 }



More information about the asterisk-commits mailing list