mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Merged revisions 55669 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r55669 | file | 2007-02-20 17:39:14 -0500 (Tue, 20 Feb 2007) | 2 lines 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.4@55670 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -179,6 +179,7 @@ struct agent_pvt {
|
||||
int abouttograb; /*!< About to grab */
|
||||
int autologoff; /*!< Auto timeout time */
|
||||
int ackcall; /*!< ackcall */
|
||||
int deferlogoff; /*!< Defer logoff to hangup */
|
||||
time_t loginstart; /*!< When agent first logged in (0 when logged off) */
|
||||
time_t start; /*!< When call started */
|
||||
struct timeval lastdisc; /*!< When last disconnected */
|
||||
@@ -770,10 +771,12 @@ static int agent_hangup(struct ast_channel *ast)
|
||||
p->chan = NULL;
|
||||
}
|
||||
ast_log(LOG_DEBUG, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff);
|
||||
if (howlong && p->autologoff && (howlong > p->autologoff)) {
|
||||
if ((p->deferlogoff) || (howlong && p->autologoff && (howlong > p->autologoff))) {
|
||||
long logintime = time(NULL) - p->loginstart;
|
||||
p->loginstart = 0;
|
||||
ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
|
||||
if (!p->deferlogoff)
|
||||
ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
|
||||
p->deferlogoff = 0;
|
||||
agent_logoff_maintenance(p, p->loginchan, logintime, ast->uniqueid, "Autologoff");
|
||||
}
|
||||
} else if (p->dead) {
|
||||
@@ -1513,16 +1516,20 @@ static int agent_logoff(const char *agent, int soft)
|
||||
|
||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||
if (!strcasecmp(p->agent, agent)) {
|
||||
if (!soft) {
|
||||
if (p->owner)
|
||||
ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
|
||||
if (p->chan)
|
||||
ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
|
||||
ret = 0;
|
||||
if (p->owner || p->chan) {
|
||||
p->deferlogoff = 1;
|
||||
if (!soft) {
|
||||
if (p->owner)
|
||||
ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
|
||||
if (p->chan)
|
||||
ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
|
||||
}
|
||||
} else {
|
||||
logintime = time(NULL) - p->loginstart;
|
||||
p->loginstart = 0;
|
||||
agent_logoff_maintenance(p, p->loginchan, logintime, NULL, "CommandLogoff");
|
||||
}
|
||||
ret = 0; /* found an agent => return 0 */
|
||||
logintime = time(NULL) - p->loginstart;
|
||||
p->loginstart = 0;
|
||||
agent_logoff_maintenance(p, p->loginchan, logintime, NULL, "CommandLogoff");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user