diff --git a/frame.c b/frame.c
index c3f0d94c9fbde5cc921e0550d09a3964d2f3cf3b..2b116fb03e5d3c53f22ca33543ccbdb2d754a7ff 100755
--- a/frame.c
+++ b/frame.c
@@ -974,7 +974,7 @@ void ast_parse_allow_deny(struct ast_codec_pref *pref, int *mask, char *list, in
 				if (allowing)
 					(*mask) |= format_i;
 				else
-					(*mask) &= format_i;
+					(*mask) &= ~format_i;
 			}
 			/* can't consider 'all' a prefered codec*/
 			if(pref && strcasecmp(last_format, "all")) {