diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2009-03-17 14:38:11 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2009-03-17 14:38:11 +0000 |
commit | d11b6386a5e69cb881a1fe251609c902212b495a (patch) | |
tree | 04bbe09684dca69e5d8e0c1568b233240fa3abd5 /include/asterisk/channel.h | |
parent | 9456bd1db520ce815871dd1d9f9b9bd5a373e8c5 (diff) |
Improve behavior of ast_answer() to not lose incoming frames
ast_answer(), when supplied a delay before returning to the caller, use ast_safe_sleep() to implement the delay. Unfortunately during this time any incoming frames are discarded, which is problematic for T.38 re-INVITES and other sorts of channel operations.
When a delay is not passed to ast_answer(), it still delays for up to 500 milliseconds, waiting for media to arrive. Again, though, it discards any control frames, or non-voice media frames.
This patch rectifies this situation, by storing all incoming frames during the delay period on a list, and then requeuing them onto the channel before returning to the caller.
http://reviewboard.digium.com/r/196/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/channel.h')
-rw-r--r-- | include/asterisk/channel.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 0f30ea1bc..eff55ca35 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -1008,12 +1008,61 @@ void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval off * This function answers a channel and handles all necessary call * setup functions. * - * \note The channel passed does not need to be locked. + * \note The channel passed does not need to be locked, but is locked + * by the function when needed. + * + * \note This function will wait up to 500 milliseconds for media to + * arrive on the channel before returning to the caller, so that the + * caller can properly assume the channel is 'ready' for media flow. * * \retval 0 on success * \retval non-zero on failure */ int ast_answer(struct ast_channel *chan); + +/*! + * \brief Answer a channel + * + * \param chan channel to answer + * \param cdr_answer flag to control whether any associated CDR should be marked as 'answered' + * + * This function answers a channel and handles all necessary call + * setup functions. + * + * \note The channel passed does not need to be locked, but is locked + * by the function when needed. + * + * \note Unlike ast_answer(), this function will not wait for media + * flow to begin. The caller should be careful before sending media + * to the channel before incoming media arrives, as the outgoing + * media may be lost. + * + * \retval 0 on success + * \retval non-zero on failure + */ +int ast_raw_answer(struct ast_channel *chan, int cdr_answer); + +/*! + * \brief Answer a channel, with a selectable delay before returning + * + * \param chan channel to answer + * \param delay maximum amount of time to wait for incoming media + * \param cdr_answer flag to control whether any associated CDR should be marked as 'answered' + * + * This function answers a channel and handles all necessary call + * setup functions. + * + * \note The channel passed does not need to be locked, but is locked + * by the function when needed. + * + * \note This function will wait up to 'delay' milliseconds for media to + * arrive on the channel before returning to the caller, so that the + * caller can properly assume the channel is 'ready' for media flow. If + * 'delay' is less than 500, the function will wait up to 500 milliseconds. + * + * \retval 0 on success + * \retval non-zero on failure + */ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer); /*! \brief Make a call |