[Asterisk-cvs] asterisk/channels chan_agent.c,1.90,1.91

markster at lists.digium.com markster at lists.digium.com
Sat Nov 13 17:43:39 CST 2004


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

Modified Files:
	chan_agent.c 
Log Message:
Big agent / queue fixes


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- chan_agent.c	12 Nov 2004 03:50:19 -0000	1.90
+++ chan_agent.c	13 Nov 2004 22:44:32 -0000	1.91
@@ -591,6 +591,7 @@
 				snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
 				ast_queue_log("NONE", ast->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "Autologoff");
 				p->loginchan[0] = '\0';
+			    ast_device_state_changed("Agent/%s", p->agent);
 			}
 		} else if (p->dead) {
 			ast_mutex_lock(&p->chan->lock);
@@ -1479,6 +1480,7 @@
 								ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGIN", "%s", p->loginchan);
 								if (option_verbose > 2)
 									ast_verbose(VERBOSE_PREFIX_3 "Callback Agent '%s' logged in on %s\n", p->agent, p->loginchan);
+							    ast_device_state_changed("Agent/%s", p->agent);
 							} else {
 								logintime = time(NULL) - p->loginstart;
 								p->loginstart = 0;
@@ -1491,6 +1493,7 @@
 								ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|", last_loginchan, logintime);
 								if (option_verbose > 2)
 									ast_verbose(VERBOSE_PREFIX_3 "Callback Agent '%s' logged out\n", p->agent);
+							    ast_device_state_changed("Agent/%s", p->agent);
 							}
 							ast_mutex_unlock(&agentlock);
 							if (!res)
@@ -1525,6 +1528,7 @@
 								check_availability(p, 0);
 							ast_mutex_unlock(&p->lock);
 							ast_mutex_unlock(&agentlock);
+						    ast_device_state_changed("Agent/%s", p->agent);
 							while (res >= 0) {
 								ast_mutex_lock(&p->lock);
 								if (p->chan != chan)
@@ -1591,6 +1595,7 @@
 							if (option_verbose > 2)
 								ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged out\n", p->agent);
 							/* If there is no owner, go ahead and kill it now */
+						    ast_device_state_changed("Agent/%s", p->agent);
 							if (p->dead && !p->owner) {
 								ast_mutex_destroy(&p->lock);
 								ast_mutex_destroy(&p->app_lock);
@@ -1745,7 +1750,6 @@
 	while(p) {
 		ast_mutex_lock(&p->lock);
 		if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
-				res = AST_DEVICE_UNKNOWN;
 			if (p->owner) {
 				if (res != AST_DEVICE_INUSE)
 					res = AST_DEVICE_BUSY;




More information about the svn-commits mailing list