Index: funcs/func_timeout.c =================================================================== --- funcs/func_timeout.c (revision 166053) +++ funcs/func_timeout.c (working copy) @@ -83,11 +83,12 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data, const char *value) { - double x; - long sec; + double x = 0.0; + long sec = 0L; char timestr[64]; struct ast_tm myt; - struct timeval when; + struct timeval when = {0,}; + int res; if (!chan) return -1; @@ -100,10 +101,14 @@ if (!value) return -1; - if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0) + res = sscanf(value, "%ld%lf", &sec, &x); + if (res == 0 || sec < 0) { when.tv_sec = 0; - else { + when.tv_usec = 0; + } else if (res == 1) { when.tv_sec = sec; + } else if (res == 2) { + when.tv_sec = sec; when.tv_usec = x * 1000000; } Index: main/file.c =================================================================== --- main/file.c (revision 166053) +++ main/file.c (working copy) @@ -714,6 +714,10 @@ goto return_failure; fr = s->fmt->read(s, &whennext); + if (fr) { + ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM); + ao2_ref(s, +1); + } if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) { if (fr) ast_log(LOG_WARNING, "Failed to write frame\n"); @@ -764,6 +768,10 @@ while (!whennext) { struct ast_frame *fr = s->fmt->read(s, &whennext); + if (fr) { + ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM); + ao2_ref(s, +1); + } if (!fr || ast_write(s->owner, fr)) { /* no stream or error, as above */ if (fr) ast_log(LOG_WARNING, "Failed to write frame\n");