[Asterisk-cvs] asterisk/channels chan_agent.c,1.157,1.158

kpfleming kpfleming
Thu Oct 13 18:04:48 CDT 2005


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

Modified Files:
	chan_agent.c 
Log Message:
properly display connected channel name in 'agents' manager action for non-callback agents (issue #5235)


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- chan_agent.c	13 Oct 2005 16:29:49 -0000	1.157
+++ chan_agent.c	13 Oct 2005 21:59:25 -0000	1.158
@@ -1399,16 +1399,7 @@
 		/* Set a default status. It 'should' get changed. */
 		status = "AGENT_UNKNOWN";
 
-		if(p->chan) {
-			loginChan = p->loginchan;
-			if(p->owner && p->owner->_bridge) {
-        			talkingtoChan = p->chan->cid.cid_num;
-        			status = "AGENT_ONCALL";
-			} else {
-        			talkingtoChan = "n/a";
-        			status = "AGENT_IDLE";
-			}
-		} else if(!ast_strlen_zero(p->loginchan)) {
+		if (!ast_strlen_zero(p->loginchan)) {
 			loginChan = p->loginchan;
 			talkingtoChan = "n/a";
 			status = "AGENT_IDLE";
@@ -1416,6 +1407,15 @@
 				snprintf(chanbuf, sizeof(chanbuf), " %s (Confirmed)", p->loginchan);
 				loginChan = chanbuf;
 			}
+		} else if (p->chan) {
+			loginChan = ast_strdupa(p->chan->name);
+			if (p->owner && p->owner->_bridge) {
+        			talkingtoChan = p->chan->cid.cid_num;
+        			status = "AGENT_ONCALL";
+			} else {
+        			talkingtoChan = "n/a";
+        			status = "AGENT_IDLE";
+			}
 		} else {
 			loginChan = "n/a";
 			talkingtoChan = "n/a";
@@ -2175,10 +2175,9 @@
 		}
 		ast_mutex_lock(&p->lock);
 		login_state = 1; /* Successful Login */
-		ast_copy_string(p->loginchan, exten, sizeof(p->loginchan));
 		
 		if (ast_strlen_zero(context))
-			snprintf(p->loginchan, sizeof(p->loginchan), "%s", exten);
+			ast_copy_string(p->loginchan, exten, sizeof(p->loginchan));
 		else
 			snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", exten, context);
 




More information about the svn-commits mailing list