dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 55670 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r55670 | file | 2007-02-20 17:47:00 -0500 (Tue, 20 Feb 2007) | 10 lines

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: http://svn.digium.com/svn/asterisk/trunk@55671 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
file 2007-02-20 22:49:53 +00:00
parent 8ee3bcf4cf
commit 25b1655368
1 changed files with 18 additions and 11 deletions

View File

@ -169,6 +169,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 */
@ -765,10 +766,12 @@ static int agent_hangup(struct ast_channel *ast)
}
if (option_debug)
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) {
@ -1507,16 +1510,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;
}
}