]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a few more issues with the agent logoff CLI command. (issue #9123 reported by...
authorJoshua Colp <jcolp@digium.com>
Wed, 28 Feb 2007 18:55:45 +0000 (18:55 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 28 Feb 2007 18:55:45 +0000 (18:55 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@57092 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 2c84b8f105f0fa8aa24f6d42b40e59c0a5c2267c..9084cb09a3c16f05bf7c7af8b3cb7838006ba57e 100644 (file)
@@ -793,6 +793,8 @@ static int agent_hangup(struct ast_channel *ast)
                        } else if (!p->loginstart) {
                                p->loginchan[0] = '\0';
                                p->logincallerid[0] = '\0';
+                               if (persistent_agents)
+                                       dump_agents();
                        }
                } else if (p->dead) {
                        ast_mutex_lock(&p->chan->lock);
@@ -805,9 +807,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_mutex_lock(&agentlock);