diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 63454895f5fa2d5e7d37b2a4b933bc6bfa5ea0c3..910e72cb1ed5a5186852d95cd80c68ea001e72b0 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -280,6 +280,7 @@ static void *mixmonitor_thread(void *obj)
 	struct ast_filestream **fs = NULL;
 	unsigned int oflags;
 	char *ext;
+	char *last_slash;
 	int errflag = 0;
 	struct ast_format format_slin;
 
@@ -313,7 +314,8 @@ static void *mixmonitor_thread(void *obj)
 				oflags = O_CREAT | O_WRONLY;
 				oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
 
-				if ((ext = strrchr(mixmonitor->filename, '.')))
+				last_slash = strrchr(mixmonitor->filename, '/');
+				if ((ext = strrchr(mixmonitor->filename, '.')) && (ext > last_slash))
 					*(ext++) = '\0';
 				else
 					ext = "raw";