[Asterisk-Dev] AgentsStatus (chan_agent.c) patch
Ben Merrills
ben at griffin.com
Fri Oct 22 02:57:39 MST 2004
I've not done any C for about 4 years, and I wasn't any good then
either, so I was wondering if someone could look over the following and
say if it would work or not as a patch for chan_Agent.c to show the
status of all agents (i.e. if they're logged in or not, and what channel
they're logged in on).
Cheers,
------------------
static int manager_queues_status( struct mansession *s, struct message
*m ) {
struct agent_pvt *p;
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
if (!ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
char loginState[10] = "";
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
if(p->chan) {
loginState = "Logged In";
}else{
loginState = "Logged Out";
}
ast_mutex_lock(&p->lock);
ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Event: AgentStatus\r\n"
"Channel: %s\r\n"
"Status: %s\r\n"
"%s"
"\r\n",
p->chan,loginState,idText);
ast_mutex_unlock(&s->lock);
ast_mutex_unlock(&q->lock);
}
ast_mutex_unlock($agentlock);
}
-----------------------
Griffin Internet
T: 0870 8040862
F: 0870 8040805
W: www.griffin.com
More information about the asterisk-dev
mailing list