Add logging of agent login/logoff

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 22 years ago
parent f49d75994e
commit 2a31c91136

@ -1117,8 +1117,10 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
struct agent_pvt *p; struct agent_pvt *p;
struct localuser *u; struct localuser *u;
struct timeval tv; struct timeval tv;
time_t start;
char user[AST_MAX_AGENT]; char user[AST_MAX_AGENT];
char pass[AST_MAX_AGENT]; char pass[AST_MAX_AGENT];
char agent[AST_MAX_AGENT] = "";
char xpass[AST_MAX_AGENT] = ""; char xpass[AST_MAX_AGENT] = "";
char *errmsg; char *errmsg;
char info[512]; char info[512];
@ -1291,6 +1293,9 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
"Agent: %s\r\n" "Agent: %s\r\n"
"Channel: %s\r\n", "Channel: %s\r\n",
p->agent, chan->name); p->agent, chan->name);
time(&start);
snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", chan->name);
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged in (format %s/%s)\n", p->agent, ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged in (format %s/%s)\n", p->agent,
ast_getformatname(chan->readformat), ast_getformatname(chan->writeformat)); ast_getformatname(chan->readformat), ast_getformatname(chan->writeformat));
@ -1360,6 +1365,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
ast_mutex_unlock(&p->lock); ast_mutex_unlock(&p->lock);
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged out\n", p->agent); ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged out\n", p->agent);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, (long)(time(NULL) - start));
manager_event(EVENT_FLAG_AGENT, "Agentlogoff", manager_event(EVENT_FLAG_AGENT, "Agentlogoff",
"Agent: %s\r\n", "Agent: %s\r\n",
p->agent); p->agent);

@ -19,6 +19,13 @@ queue at the time of disconnect.
AGENTDUMP AGENTDUMP
The agent dumped the caller while listening to the queue announcement. The agent dumped the caller while listening to the queue announcement.
AGENTLOGIN(channel)
The agent logged in. The channel is recorded.
AGENTLOGOFF(channel|logintime)
The agent logged off. The channel is recorded, along with the total time
the agent was logged in.
COMPLETEAGENT(holdtime|calltime|origposition) COMPLETEAGENT(holdtime|calltime|origposition)
The caller was connected to an agent, and the call was terminated normally The caller was connected to an agent, and the call was terminated normally
by the *agent*. The caller's hold time and the length of the call are both by the *agent*. The caller's hold time and the length of the call are both

Loading…
Cancel
Save