mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 03:08:45 +00:00
We have to release app_lock even if there is no channel logged in anymore
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1442 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -264,6 +264,8 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
|||||||
if (!f) {
|
if (!f) {
|
||||||
/* If there's a channel, hang it up (if it's on a callback) make it NULL */
|
/* If there's a channel, hang it up (if it's on a callback) make it NULL */
|
||||||
if (p->chan) {
|
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))
|
if (strlen(p->loginchan))
|
||||||
ast_hangup(p->chan);
|
ast_hangup(p->chan);
|
||||||
p->chan = NULL;
|
p->chan = NULL;
|
||||||
@@ -500,12 +502,14 @@ static int agent_hangup(struct ast_channel *ast)
|
|||||||
p->abouttograb = 0;
|
p->abouttograb = 0;
|
||||||
} else if (p->dead) {
|
} else if (p->dead) {
|
||||||
free(p);
|
free(p);
|
||||||
} else if (p->chan) {
|
} else {
|
||||||
/* Not dead -- check availability now */
|
if (p->chan) {
|
||||||
ast_mutex_lock(&p->lock);
|
/* Not dead -- check availability now */
|
||||||
/* Store last disconnect time */
|
ast_mutex_lock(&p->lock);
|
||||||
gettimeofday(&p->lastdisc, NULL);
|
/* Store last disconnect time */
|
||||||
ast_mutex_unlock(&p->lock);
|
gettimeofday(&p->lastdisc, NULL);
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
|
}
|
||||||
/* Release ownership of the agent to other threads (presumably running the login app). */
|
/* Release ownership of the agent to other threads (presumably running the login app). */
|
||||||
ast_mutex_unlock(&p->app_lock);
|
ast_mutex_unlock(&p->app_lock);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user