diff --git a/main/format_cap.c b/main/format_cap.c
index d3e87fafd0af301542bddfad0dfec23a50e7f11c..2b3e6cd5f87646b7a4f4f905aeb1204ee9405283 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -342,7 +342,7 @@ int ast_format_cap_update_by_allow_disallow(struct ast_format_cap *cap, const ch
 	}
 
 
-	while ((this = strsep(&parse, ",|"))) {
+	while ((this = ast_strip(strsep(&parse, ",|")))) {
 		int framems = 0;
 		struct ast_format *format = NULL;