aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-12 15:01:46 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-12 15:01:46 +0000
commit1fe1dccf33eab66d2e9469f6c3a6fe75515bfee8 (patch)
tree30eeacf29de117fe01d8c351cc463d6662b40061 /main
parent809525b045c4c30f2c724e638e6ca0526f7ec887 (diff)
make the automatic post-answer delay happen only when the answer is 'automatic' (not done by the Answer() dialplan application)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@50571 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c10
-rw-r--r--main/pbx.c14
2 files changed, 10 insertions, 14 deletions
diff --git a/main/channel.c b/main/channel.c
index 42bca18bd..dcdecdfdc 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1612,7 +1612,7 @@ int ast_hangup(struct ast_channel *chan)
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 @@ int ast_answer(struct ast_channel *chan)
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);
@@ -1651,6 +1652,11 @@ int ast_answer(struct ast_channel *chan)
return res;
}
+int ast_answer(struct ast_channel *chan)
+{
+ return __ast_answer(chan, 500);
+}
+
void ast_deactivate_generator(struct ast_channel *chan)
{
ast_channel_lock(chan);
diff --git a/main/pbx.c b/main/pbx.c
index 10c9911ad..1f656adea 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5326,21 +5326,11 @@ static int pbx_builtin_congestion(struct ast_channel *chan, void *data)
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, {