diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index ea360991ba3cd4c78e91a1b33727fe15fc2b934f..ab67fb22bd8240e7480ded8c865aeb92664a176b 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -132,6 +132,13 @@ char *ast_category_browse(struct ast_config *config, const char *prev);
  */
 struct ast_variable *ast_variable_browse(const struct ast_config *config, const char *category);
 
+/*!
+ * \brief given a pointer to a category, return the root variable.
+ * This is equivalent to ast_variable_browse(), but more efficient if we
+ * already have the struct ast_category * (e.g. from ast_category_get())
+ */
+struct ast_variable *ast_category_first(struct ast_category *cat);
+
 /*! 
  * \brief Gets a variable 
  * \param config which (opened) config to use
diff --git a/main/config.c b/main/config.c
index 134add80a3d53b175de2318180b4f2c0348e78e2..27c34ec154a5acaa4bf4f446226243c82196093a 100644
--- a/main/config.c
+++ b/main/config.c
@@ -587,6 +587,12 @@ static struct ast_category *next_available_category(struct ast_category *cat)
 	return cat;
 }
 
+/*! return the first var of a category */
+struct ast_variable *ast_category_first(struct ast_category *cat)
+{
+	return (cat) ? cat->root : NULL;
+}
+
 struct ast_variable *ast_category_root(struct ast_config *config, char *cat)
 {
 	struct ast_category *category = ast_category_get(config, cat);