diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 31928cc49576ee8c069d066e32b44c3549147563..42ef554a41c46cba8c6a57df183a2306c30afa3e 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1751,6 +1751,8 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
 	return x - 1;
 }
 
+#endif
+
 static int vm_delete(char *file)
 {
 	char *txt;
@@ -1769,8 +1771,6 @@ static int vm_delete(char *file)
 	return ast_filedelete(file, NULL);
 }
 
-
-#endif
 static int inbuf(struct baseio *bio, FILE *fi)
 {
 	int l;