diff --git a/rtp.c b/rtp.c
index 44680683e7f46697927ffaccead9fae5cbaacf44..07c022e23dd67a12bcccd9fda64edfbb1fbc05f8 100755
--- a/rtp.c
+++ b/rtp.c
@@ -449,7 +449,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
 	if (ext) {
 		/* RTP Extension present */
 		hdrlen += 4;
-		hdrlen += (rtpheader[3] & 0xffff) << 2;
+		hdrlen += (ntohl(rtpheader[3]) & 0xffff) << 2;
 	}
 
 	if (res < hdrlen) {