aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-09 01:49:25 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-09 01:49:25 +0000
commit006818935c2d1d5276c616c338258986b69c216c (patch)
treea47707f6616ed4e47c40d993136e216507d069c8 /main
parent7a8ac51891e655410ed26e09ce442bb085710f0d (diff)
Merged revisions 141949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r141949 | russell | 2008-09-08 20:47:56 -0500 (Mon, 08 Sep 2008) | 9 lines Modify ast_answer() to not hold the channel lock while calling ast_safe_sleep() or when calling ast_waitfor(). These are inappropriate times to hold the channel lock. This is what has caused "could not get the channel lock" messages from chan_sip and has likely caused a negative impact on performance results of SIP in Asterisk 1.6. Thanks to file for pointing out this section of code. (closes issue #13287) (closes issue #13115) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@141950 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c
index f096b9a1c..fbd417012 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1689,16 +1689,21 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
return -1;
}
+ ast_channel_unlock(chan);
+
switch (chan->_state) {
case AST_STATE_RINGING:
case AST_STATE_RING:
- if (chan->tech->answer)
+ ast_channel_lock(chan);
+ if (chan->tech->answer) {
res = chan->tech->answer(chan);
+ }
ast_setstate(chan, AST_STATE_UP);
ast_cdr_answer(chan->cdr);
- if (delay)
+ ast_channel_unlock(chan);
+ if (delay) {
ast_safe_sleep(chan, delay);
- else {
+ } else {
struct ast_frame *f;
int ms = ANSWER_WAIT_MS;
while (1) {
@@ -1734,8 +1739,8 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
default:
break;
}
+
chan->visible_indication = 0;
- ast_channel_unlock(chan);
return res;
}