mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
- Fix a typo in a timing API call
- Convert the last part of channel.c over to use the timing API. This would not have made a difference when using the dahdi timing module. I noticed it when trying to use another timing source. Oops. :) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -161,7 +161,7 @@ int ast_timer_enable_continuous(int handle);
|
|||||||
* \retval -1 failure, with errno set
|
* \retval -1 failure, with errno set
|
||||||
* \retval 0 success
|
* \retval 0 success
|
||||||
*/
|
*/
|
||||||
int ast_timer_disable_continous(int handle);
|
int ast_timer_disable_continuous(int handle);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Determine timing event
|
* \brief Determine timing event
|
||||||
|
|||||||
@@ -2407,26 +2407,17 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
|
|||||||
read(chan->alertpipe[0], &blah, sizeof(blah));
|
read(chan->alertpipe[0], &blah, sizeof(blah));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DAHDI
|
if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD) {
|
||||||
if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD && ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
|
enum ast_timing_event res;
|
||||||
int res;
|
|
||||||
|
|
||||||
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
|
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
|
||||||
blah = -1;
|
|
||||||
/* IF we can't get event, assume it's an expired as-per the old interface */
|
|
||||||
res = ioctl(chan->timingfd, DAHDI_GETEVENT, &blah);
|
|
||||||
if (res)
|
|
||||||
blah = DAHDI_EVENT_TIMER_EXPIRED;
|
|
||||||
|
|
||||||
if (blah == DAHDI_EVENT_TIMER_PING) {
|
res = ast_timer_get_event(chan->timingfd);
|
||||||
if (AST_LIST_EMPTY(&chan->readq) || !AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
|
|
||||||
/* Acknowledge PONG unless we need it again */
|
switch (res) {
|
||||||
if (ioctl(chan->timingfd, DAHDI_TIMERPONG, &blah)) {
|
case AST_TIMING_EVENT_EXPIRED:
|
||||||
ast_log(LOG_WARNING, "Failed to pong timer on '%s': %s\n", chan->name, strerror(errno));
|
ast_timer_ack(chan->timingfd, 1);
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (blah == DAHDI_EVENT_TIMER_EXPIRED) {
|
|
||||||
ioctl(chan->timingfd, DAHDI_TIMERACK, &blah);
|
|
||||||
if (chan->timingfunc) {
|
if (chan->timingfunc) {
|
||||||
/* save a copy of func/data before unlocking the channel */
|
/* save a copy of func/data before unlocking the channel */
|
||||||
int (*func)(const void *) = chan->timingfunc;
|
int (*func)(const void *) = chan->timingfunc;
|
||||||
@@ -2434,18 +2425,22 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
|
|||||||
ast_channel_unlock(chan);
|
ast_channel_unlock(chan);
|
||||||
func(data);
|
func(data);
|
||||||
} else {
|
} else {
|
||||||
blah = 0;
|
ast_timer_set_rate(chan->timingfd, 0);
|
||||||
ioctl(chan->timingfd, DAHDI_TIMERCONFIG, &blah);
|
|
||||||
chan->timingdata = NULL;
|
|
||||||
ast_channel_unlock(chan);
|
ast_channel_unlock(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cannot 'goto done' because the channel is already unlocked */
|
/* cannot 'goto done' because the channel is already unlocked */
|
||||||
return &ast_null_frame;
|
return &ast_null_frame;
|
||||||
} else
|
|
||||||
ast_log(LOG_NOTICE, "No/unknown event '%d' on timer for '%s'?\n", blah, chan->name);
|
case AST_TIMING_EVENT_CONTINUOUS:
|
||||||
} else
|
if (AST_LIST_EMPTY(&chan->readq) ||
|
||||||
#endif
|
!AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
|
||||||
if (chan->fds[AST_GENERATOR_FD] > -1 && chan->fdno == AST_GENERATOR_FD) {
|
ast_timer_disable_continuous(chan->timingfd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (chan->fds[AST_GENERATOR_FD] > -1 && chan->fdno == AST_GENERATOR_FD) {
|
||||||
/* if the AST_GENERATOR_FD is set, call the generator with args
|
/* if the AST_GENERATOR_FD is set, call the generator with args
|
||||||
* set to -1 so it can do whatever it needs to.
|
* set to -1 so it can do whatever it needs to.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ int ast_timer_enable_continuous(int handle)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_timer_disable_continous(int handle)
|
int ast_timer_disable_continuous(int handle)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user