diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 4897775cc41dca6dc0d451e29878354a1ffdb6f5..6b7420198df7f8d5c3d7b7983547b2b732183f6c 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -819,7 +819,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
 		} else {
 			int swap = 0;
 #if __BYTE_ORDER == __BIG_ENDIAN
-			if (frame->subclass.codec == AST_FORMAT_SLINEAR)
+			if (frame->subclass.format.id == AST_FORMAT_SLINEAR)
 				swap = 1; /* Swap big-endian samples to little-endian as we copy */
 #endif
 			res = phone_write_buf(p, pos, expected, maxfr, swap);