c->timingfunc = func;
ast_channel_timingdata_set(c, data);
+ if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) {
+ /* Clearing the timing func and setting the rate to 0
+ * means that we don't want to be reading from the timingfd
+ * any more. Setting c->fdno to -1 means we won't have any
+ * errant reads from the timingfd, meaning we won't potentially
+ * miss any important frames.
+ */
+ ast_channel_fdno_set(c, -1);
+ }
+
ast_channel_unlock(c);
return res;
prestate = ast_channel_state(chan);
- /* Read and ignore anything on the alertpipe, but read only
- one sizeof(blah) per frame that we send from it */
- if (ast_channel_internal_alert_read(chan) == AST_ALERT_READ_FATAL) {
- f = &ast_null_frame;
- goto done;
- }
-
if (ast_channel_timingfd(chan) > -1 && ast_channel_fdno(chan) == AST_TIMING_FD) {
enum ast_timer_event res;
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
}
+ /* Read and ignore anything on the alertpipe, but read only
+ one sizeof(blah) per frame that we send from it */
+ if (ast_channel_internal_alert_read(chan) == AST_ALERT_READ_FATAL) {
+ f = &ast_null_frame;
+ goto done;
+ }
+
/* Check for pending read queue */
if (!AST_LIST_EMPTY(ast_channel_readq(chan))) {
int skip_dtmf = should_skip_dtmf(chan);