Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 119295) +++ channels/chan_agent.c (working copy) @@ -460,8 +460,18 @@ /* 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 (!ast_strlen_zero(p->loginchan)) { - if (p->chan) + if (p->owner->_state != AST_STATE_UP) { + int howlong = time(NULL) - p->start; ast_log(LOG_DEBUG, "Bridge on '%s' being cleared (2)\n", p->chan->name); + if (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); + agent_logoff_maintenance(p, p->loginchan, logintime, ast->uniqueid, "Autologoff"); + if (persistent_agents) + dump_agents(); + } + } status = pbx_builtin_getvar_helper(p->chan, "CHANLOCALSTATUS"); if (autologoffunavail && status && !strcasecmp(status, "CHANUNAVAIL")) { @@ -799,6 +809,7 @@ else p->start = 0; if (p->chan) { + ast_log(LOG_NOTICE, "There is a channel...and howlong is %d\n", howlong); p->chan->_bridge = NULL; /* If they're dead, go ahead and hang up on the agent now */ if (!ast_strlen_zero(p->loginchan)) {