Add event for agentlogoff from CLI (bug #3611)
authorMark Spencer <markster@digium.com>
Fri, 18 Feb 2005 05:03:01 +0000 (05:03 +0000)
committerMark Spencer <markster@digium.com>
Fri, 18 Feb 2005 05:03:01 +0000 (05:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5047 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 842616f..481485c 100755 (executable)
@@ -1314,7 +1314,8 @@ static int agent_logoff_cmd(int fd, int argc, char **argv)
 {
        struct agent_pvt *p;
        char *agent = argv[2] + 6;
-
+       long logintime;
+       
        if (argc < 3 || argc > 4)
                return RESULT_SHOWUSAGE;
        if (argc == 4 && strcasecmp(argv[3], "soft"))
@@ -1330,6 +1331,15 @@ static int agent_logoff_cmd(int fd, int argc, char **argv)
                                        ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
                                }
                        }
+                       logintime = time(NULL) - p->loginstart;
+                       p->loginstart = 0;
+                       
+                       manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
+                               "Agent: %s\r\n"
+                               "Loginchan: %s\r\n"
+                               "Logintime: %ld\r\n",
+                               p->agent, p->loginchan, logintime);
+                       ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "CommandLogoff");
                        p->loginchan[0] = '\0';
                        ast_cli(fd, "Logging out %s\n", agent);
                        break;