Index: main/file.c =================================================================== --- main/file.c (revision 178445) +++ main/file.c (working copy) @@ -125,6 +125,10 @@ /* Stop a running stream if there is one */ if (tmp->stream) { +#ifdef HAVE_DAHDI + /* If the stream is used for timing, make sure we don't reference it after deallocation */ + ast_settimeout(f->owner, 0, NULL, NULL); +#endif ast_closestream(tmp->stream); tmp->stream = NULL; if (tmp->oldwriteformat && ast_set_write_format(tmp, tmp->oldwriteformat)) Index: formats/format_pcm.c =================================================================== --- formats/format_pcm.c (revision 178445) +++ formats/format_pcm.c (working copy) @@ -73,7 +73,7 @@ } #endif -static struct ast_frame *pcm_read(struct ast_filestream *s, int *whennext) +static struct ast_frame *pcm711_read(struct ast_filestream *s, int *whennext) { int res; @@ -421,7 +421,7 @@ .seek = pcm_seek, .trunc = pcm_trunc, .tell = pcm_tell, - .read = pcm_read, + .read = pcm711_read, .buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET, #ifdef REALTIME_WRITE .open = pcma_open, @@ -438,7 +438,7 @@ .seek = pcm_seek, .trunc = pcm_trunc, .tell = pcm_tell, - .read = pcm_read, + .read = pcm711_read, .buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET, }; @@ -450,7 +450,7 @@ .seek = pcm_seek, .trunc = pcm_trunc, .tell = pcm_tell, - .read = pcm_read, + .read = pcm711_read, .buf_size = (BUF_SIZE * 2) + AST_FRIENDLY_OFFSET, }; @@ -464,7 +464,7 @@ .seek = au_seek, .trunc = au_trunc, .tell = au_tell, - .read = pcm_read, + .read = pcm711_read, .buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET, /* this many shorts */ };