diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index c60916a902e91afd6d7eb210d4fb866999b50299..ebc71fb8a91789b71565c5e1f106c2a0df415eff 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -289,15 +289,18 @@ enum ast_parse_flags {
 	/* numeric types, with optional default value and bound checks.
 	 * Additional arguments are passed by value.
 	 */
-	PARSE_INT16	= 	0x0001,
-	PARSE_INT32	= 	0x0002,
-	PARSE_UINT16	= 	0x0003,
-	PARSE_UINT32	= 	0x0004,
+	PARSE_INT32	= 	0x0001,
+	PARSE_UINT32	= 	0x0002,
+	PARSE_DOUBLE	= 	0x0003,
+#if 0	/* not supported yet */
+	PARSE_INT16	= 	0x0004,
+	PARSE_UINT16	= 	0x0005,
+#endif
 	/* Returns a struct sockaddr_in, with optional default value
 	 * (passed by reference) and port handling (accept, ignore,
 	 * require, forbid). The format is 'host.name[:port]'
 	 */
-	PARSE_INADDR	= 	0x0005,
+	PARSE_INADDR	= 	0x000f,
 
 	/* Other data types can be added as needed */
 
diff --git a/main/config.c b/main/config.c
index 0ad813d8a678e36c698722baf3709eb30a264227..4359bcf880c883e2f2a08a3ab17e25995210784a 100644
--- a/main/config.c
+++ b/main/config.c
@@ -35,6 +35,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <time.h>
 #include <sys/stat.h>
 
+#include <math.h>	/* HUGE_VAL */
+
 #define AST_INCLUDE_GLOB 1
 
 #ifdef AST_INCLUDE_GLOB
@@ -2149,6 +2151,32 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
 		break;
 	    }
 
+	case PARSE_DOUBLE:
+	    {
+		double *result = p_result;
+		double x, def = result ? *result : 0,
+			low = -HUGE_VAL, high = HUGE_VAL;
+
+		/* optional argument: first default value, then range */
+		if (flags & PARSE_DEFAULT)
+			def = va_arg(ap, double);
+		if (flags & (PARSE_IN_RANGE|PARSE_OUT_RANGE)) {
+			/* range requested, update bounds */
+			low = va_arg(ap, double);
+			high = va_arg(ap, double);
+		}
+		x = strtod(arg, NULL);
+		error = (x < low) || (x > high);
+		if (flags & PARSE_OUT_RANGE)
+			error = !error;
+		if (result)
+			*result  = error ? def : x;
+		ast_debug(3,
+			"extract double from [%s] in [%f, %f] gives [%f](%d)\n",
+			arg, low, high,
+			result ? *result : x, error);
+		break;
+	    }
 	case PARSE_INADDR:
 	    {
 		char *port, *buf;