diff options
-rw-r--r-- | include/asterisk/channel.h | 1 | ||||
-rw-r--r-- | main/channel.c | 8 |
2 files changed, 3 insertions, 6 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 8e556d092..6c5376b15 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -181,6 +181,7 @@ typedef unsigned long long ast_group_t; struct ast_generator { void *(*alloc)(struct ast_channel *chan, void *params); void (*release)(struct ast_channel *chan, void *data); + /*! This function gets called with the channel locked */ int (*generate)(struct ast_channel *chan, void *data, int len, int samples); /*! This gets called when DTMF_END frames are read from the channel */ void (*digit)(struct ast_channel *chan, char digit); diff --git a/main/channel.c b/main/channel.c index 9e209714c..063fc8100 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2210,17 +2210,13 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } else if (blah == ZT_EVENT_TIMER_EXPIRED) { ioctl(chan->timingfd, ZT_TIMERACK, &blah); if (chan->timingfunc) { - /* save a copy of func/data before unlocking the channel */ - int (*func)(const void *) = chan->timingfunc; - void *data = chan->timingdata; - ast_channel_unlock(chan); - func(data); + chan->timingfunc(chan->timingdata); } else { blah = 0; ioctl(chan->timingfd, ZT_TIMERCONFIG, &blah); chan->timingdata = NULL; - ast_channel_unlock(chan); } + ast_channel_unlock(chan); /* cannot 'goto done' because the channel is already unlocked */ return &ast_null_frame; } else |