diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-27 15:59:43 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-27 15:59:43 +0000 |
commit | ec26c5471f92bbfc906ef1753f9c4c8846f4fe72 (patch) | |
tree | b6994511a8eaa0df1ed773e6f928fda723dbf4d9 /channels | |
parent | 3709276974363ff6659ea35c5b52560a1e4476bc (diff) |
We have to release app_lock even if there is no channel logged in anymore
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1442 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_agent.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 403dd2667..1534f58c5 100755 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -264,6 +264,8 @@ static struct ast_frame *agent_read(struct ast_channel *ast) if (!f) { /* If there's a channel, hang it up (if it's on a callback) make it NULL */ if (p->chan) { + /* Note that we don't hangup if it's not a callback because Asterisk will do it + for us when the PBX instance that called login finishes */ if (strlen(p->loginchan)) ast_hangup(p->chan); p->chan = NULL; @@ -500,12 +502,14 @@ static int agent_hangup(struct ast_channel *ast) p->abouttograb = 0; } else if (p->dead) { free(p); - } else if (p->chan) { - /* Not dead -- check availability now */ - ast_mutex_lock(&p->lock); - /* Store last disconnect time */ - gettimeofday(&p->lastdisc, NULL); - ast_mutex_unlock(&p->lock); + } else { + if (p->chan) { + /* Not dead -- check availability now */ + ast_mutex_lock(&p->lock); + /* Store last disconnect time */ + gettimeofday(&p->lastdisc, NULL); + ast_mutex_unlock(&p->lock); + } /* Release ownership of the agent to other threads (presumably running the login app). */ ast_mutex_unlock(&p->app_lock); } |