diff --git a/main/file.c b/main/file.c
index 9315f225b0b741f02b370e6cd55e72c805ca0b82..c259d5a32375fe5d77ec131e02c69c791d4c2c70 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1021,6 +1021,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
 				if (context) {
 					const char exten[2] = { fr->subclass, '\0' };
 					if (ast_exists_extension(c, context, exten, 1, c->cid.cid_num)) {
+						res = fr->subclass;
 						ast_frfree(fr);
 						return res;
 					}