[asterisk-commits] qwell: trunk r78312 - /trunk/channels/chan_agent.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 6 18:00:35 CDT 2007


Author: qwell
Date: Mon Aug  6 18:00:35 2007
New Revision: 78312

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78312
Log:
Add a TalkingToChan to the response of the "agents" manager action.
This is similar to the existing "talking to" that you see what using the "agent show" CLI command.

Closes issue #10102

Modified:
    trunk/channels/chan_agent.c

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=78312&r1=78311&r2=78312
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Mon Aug  6 18:00:35 2007
@@ -1350,6 +1350,7 @@
 	struct agent_pvt *p;
 	char *username = NULL;
 	char *loginChan = NULL;
+	char *talkingto = NULL;
 	char *talkingtoChan = NULL;
 	char *status = NULL;
 
@@ -1373,6 +1374,7 @@
 
 		if (!ast_strlen_zero(p->loginchan) && !p->chan) {
 			loginChan = p->loginchan;
+			talkingto = "n/a";
 			talkingtoChan = "n/a";
 			status = "AGENT_IDLE";
 			if (p->acknowledged) {
@@ -1382,14 +1384,20 @@
 		} else if (p->chan) {
 			loginChan = ast_strdupa(p->chan->name);
 			if (p->owner && p->owner->_bridge) {
-        			talkingtoChan = p->chan->cid.cid_num;
+				talkingto = p->chan->cid.cid_num;
+				if (ast_bridged_channel(p->owner))
+					talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name);
+				else
+					talkingtoChan = "n/a";
         			status = "AGENT_ONCALL";
 			} else {
-        			talkingtoChan = "n/a";
+				talkingto = "n/a";
+				talkingtoChan = "n/a";
         			status = "AGENT_IDLE";
 			}
 		} else {
 			loginChan = "n/a";
+			talkingto = "n/a";
 			talkingtoChan = "n/a";
 			status = "AGENT_LOGGEDOFF";
 		}
@@ -1401,9 +1409,10 @@
 			"LoggedInChan: %s\r\n"
 			"LoggedInTime: %d\r\n"
 			"TalkingTo: %s\r\n"
+			"TalkingToChan: %s\r\n"
 			"%s"
 			"\r\n",
-			p->agent, username, status, loginChan, (int)p->loginstart, talkingtoChan, idText);
+			p->agent, username, status, loginChan, (int)p->loginstart, talkingto, talkingtoChan, idText);
 		ast_mutex_unlock(&p->lock);
 	}
 	AST_LIST_UNLOCK(&agents);




More information about the asterisk-commits mailing list