[asterisk-commits] kpfleming: trunk r50571 - in /trunk:
include/asterisk/ main/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jan 12 08:01:48 MST 2007
Author: kpfleming
Date: Fri Jan 12 09:01:46 2007
New Revision: 50571
URL: http://svn.digium.com/view/asterisk?view=rev&rev=50571
Log:
make the automatic post-answer delay happen only when the answer is 'automatic' (not done by the Answer() dialplan application)
Modified:
trunk/include/asterisk/channel.h
trunk/main/channel.c
trunk/main/pbx.c
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=50571&r1=50570&r2=50571
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Fri Jan 12 09:01:46 2007
@@ -758,13 +758,14 @@
*/
void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset);
-/*! \brief Answer a ringing call
+/*! \brief Answer a channel
* \param chan channel to answer
* This function answers a channel and handles all necessary call
* setup functions.
- * \return Returns 0 on success, -1 on failure
+ * \return Returns 0 on success, non-zero on failure
*/
int ast_answer(struct ast_channel *chan);
+int __ast_answer(struct ast_channel *chan, unsigned int delay);
/*! \brief Make a call
* \param chan which channel to make the call on
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=50571&r1=50570&r2=50571
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Jan 12 09:01:46 2007
@@ -1612,7 +1612,7 @@
return res;
}
-int ast_answer(struct ast_channel *chan)
+int __ast_answer(struct ast_channel *chan, unsigned int delay)
{
int res = 0;
@@ -1637,7 +1637,8 @@
res = chan->tech->answer(chan);
ast_setstate(chan, AST_STATE_UP);
ast_cdr_answer(chan->cdr);
- ast_safe_sleep(chan, 500);
+ if (delay)
+ ast_safe_sleep(chan, delay);
break;
case AST_STATE_UP:
ast_cdr_answer(chan->cdr);
@@ -1649,6 +1650,11 @@
ast_channel_unlock(chan);
return res;
+}
+
+int ast_answer(struct ast_channel *chan)
+{
+ return __ast_answer(chan, 500);
}
void ast_deactivate_generator(struct ast_channel *chan)
Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=50571&r1=50570&r2=50571
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Jan 12 09:01:46 2007
@@ -5326,21 +5326,11 @@
static int pbx_builtin_answer(struct ast_channel *chan, void *data)
{
int delay = 0;
- int res;
-
- if (chan->_state == AST_STATE_UP)
- delay = 0;
- else if (!ast_strlen_zero(data))
+
+ if ((chan->_state != AST_STATE_UP) && !ast_strlen_zero(data))
delay = atoi(data);
- res = ast_answer(chan);
- if (res)
- return res;
-
- if (delay)
- res = ast_safe_sleep(chan, delay);
-
- return res;
+ return __ast_answer(chan, delay);
}
AST_APP_OPTIONS(resetcdr_opts, {
More information about the asterisk-commits
mailing list