[asterisk-commits] mmichelson: branch 1.6.0 r127156 - in /branches/1.6.0: ./ main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 1 16:13:33 CDT 2008
Author: mmichelson
Date: Tue Jul 1 16:13:32 2008
New Revision: 127156
URL: http://svn.digium.com/view/asterisk?view=rev&rev=127156
Log:
Merging Revision 127113 from trunk
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/channel.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/channel.c?view=diff&rev=127156&r1=127155&r2=127156
==============================================================================
--- branches/1.6.0/main/channel.c (original)
+++ branches/1.6.0/main/channel.c Tue Jul 1 16:13:32 2008
@@ -1679,15 +1679,31 @@
switch (chan->_state) {
case AST_STATE_RINGING:
case AST_STATE_RING:
- if (chan->tech->answer)
- res = chan->tech->answer(chan);
- ast_setstate(chan, AST_STATE_UP);
- ast_cdr_answer(chan->cdr);
- ast_channel_unlock(chan);
- if (delay)
+ if (delay) {
+ int needanswer = (chan->tech->answer != NULL);
+
+ ast_setstate(chan, AST_STATE_UP);
+ ast_cdr_answer(chan->cdr);
+ ast_channel_unlock(chan);
ast_safe_sleep(chan, delay);
+ /* don't tell the channel it has been answered until *after* the delay,
+ so that the media path will be in place and usable when it wants to
+ send media
+ */
+ if (needanswer) {
+ ast_channel_lock(chan);
+ res = chan->tech->answer(chan);
+ ast_channel_unlock(chan);
+ }
+ } else {
+ if (chan->tech->answer) {
+ res = chan->tech->answer(chan);
+ }
+ ast_setstate(chan, AST_STATE_UP);
+ ast_cdr_answer(chan->cdr);
+ ast_channel_unlock(chan);
+ }
return res;
- break;
case AST_STATE_UP:
ast_cdr_answer(chan->cdr);
break;
More information about the asterisk-commits
mailing list