mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Defer clearing callback information if channels are up until they are hung up. This ensures the hangup process goes smoothly and no channels get hung in limbo. (issue #8088 reported by kebl0155)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@55669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -790,6 +790,9 @@ static int agent_hangup(struct ast_channel *ast)
|
||||
p->logincallerid[0] = '\0';
|
||||
if (persistent_agents)
|
||||
dump_agents();
|
||||
} else if (!p->loginstart) {
|
||||
p->loginchan[0] = '\0';
|
||||
p->logincallerid[0] = '\0';
|
||||
}
|
||||
} else if (p->dead) {
|
||||
ast_mutex_lock(&p->chan->lock);
|
||||
@@ -1473,14 +1476,17 @@ static int agent_logoff(char *agent, int soft)
|
||||
struct agent_pvt *p;
|
||||
long logintime;
|
||||
int ret = -1; /* Return -1 if no agent if found */
|
||||
int defer = 0;
|
||||
|
||||
for (p=agents; p; p=p->next) {
|
||||
if (!strcasecmp(p->agent, agent)) {
|
||||
if (!soft) {
|
||||
if (p->owner) {
|
||||
defer = 1;
|
||||
ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
|
||||
}
|
||||
if (p->chan) {
|
||||
defer = 1;
|
||||
ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
|
||||
}
|
||||
}
|
||||
@@ -1495,8 +1501,10 @@ static int agent_logoff(char *agent, int soft)
|
||||
p->agent, p->loginchan, logintime);
|
||||
ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "CommandLogoff");
|
||||
set_agentbycallerid(p->logincallerid, NULL);
|
||||
if (!defer) {
|
||||
p->loginchan[0] = '\0';
|
||||
p->logincallerid[0] = '\0';
|
||||
}
|
||||
ast_device_state_changed("Agent/%s", p->agent);
|
||||
if (persistent_agents)
|
||||
dump_agents();
|
||||
|
Reference in New Issue
Block a user