[Asterisk-cvs] asterisk/channels chan_agent.c,1.143,1.144

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Jul 15 12:13:56 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv10899/channels

Modified Files:
	chan_agent.c 
Log Message:
make 'Agents' manager action conform to protocol (bug #4723)


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- chan_agent.c	8 Jul 2005 21:14:34 -0000	1.143
+++ chan_agent.c	15 Jul 2005 16:21:41 -0000	1.144
@@ -1326,14 +1326,20 @@
 /*--- action_agents: Manager routine for listing channels */
 static int action_agents(struct mansession *s, struct message *m)
 {
+	char *id = astman_get_header(m,"ActionID");
+	char idText[256] = "";
 	struct agent_pvt *p;
 	char *username = NULL;
 	char *loginChan = NULL;
 	char *talkingtoChan = NULL;
 	char *status = NULL;
 
+	if (id && !ast_strlen_zero(id))
+		snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
+	astman_send_ack(s, m, "Agents will follow");
 	ast_mutex_lock(&agentlock);
 	p = agents;
+	ast_mutex_lock(&s->lock);
 	while(p) {
         	ast_mutex_lock(&p->lock);
 
@@ -1381,12 +1387,18 @@
 				"LoggedInChan: %s\r\n"
 				"LoggedInTime: %ld\r\n"
 				"TalkingTo: %s\r\n"
+				"%s"
 				"\r\n",
-				p->agent,p->name,status,loginChan,p->loginstart,talkingtoChan);
+				p->agent,p->name,status,loginChan,p->loginstart,talkingtoChan,idText);
 		ast_mutex_unlock(&p->lock);
 		p = p->next;
 	}
 	ast_mutex_unlock(&agentlock);
+	ast_cli(s->fd, "Event: AgentsComplete\r\n"
+			"%s"
+			"\r\n",idText);
+	ast_mutex_unlock(&s->lock);
+
 	return 0;
 }
 




More information about the svn-commits mailing list