Merged revisions 57093 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Wed, 28 Feb 2007 19:00:24 +0000 (19:00 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 28 Feb 2007 19:00:24 +0000 (19:00 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r57093 | file | 2007-02-28 13:57:52 -0500 (Wed, 28 Feb 2007) | 10 lines

Merged revisions 57092 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r57092 | file | 2007-02-28 13:55:45 -0500 (Wed, 28 Feb 2007) | 2 lines

Fix a few more issues with the agent logoff CLI command. (issue #9123 reported by arbrandes)

........

................

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@57094 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 453e8a4..26f8ca5 100644 (file)
@@ -773,6 +773,8 @@ static int agent_hangup(struct ast_channel *ast)
                                        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");
+                               if (persistent_agents)
+                                       dump_agents();
                        }
                } else if (p->dead) {
                        ast_channel_lock(p->chan);
@@ -787,9 +789,16 @@ static int agent_hangup(struct ast_channel *ast)
                }
        }
        ast_mutex_unlock(&p->lock);
+
        /* Only register a device state change if the agent is still logged in */
-       if (p->loginstart)
+       if (!p->loginstart) {
+               p->loginchan[0] = '\0';
+               p->logincallerid[0] = '\0';
+               if (persistent_agents)
+                       dump_agents();
+       } else {
                ast_device_state_changed("Agent/%s", p->agent);
+       }
 
        if (p->pending) {
                AST_LIST_LOCK(&agents);