[svn-commits] oej: branch oej/moremanager r61854 - in /team/oej/moremanager: ./ channels/ m...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Apr 25 13:22:10 MST 2007


Author: oej
Date: Wed Apr 25 15:22:09 2007
New Revision: 61854

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61854
Log:
Changes to ZapShowChannels - not compiled on a Zaptel system yet :-)

Modified:
    team/oej/moremanager/CHANGES.moremanager
    team/oej/moremanager/channels/chan_zap.c
    team/oej/moremanager/main/manager.c

Modified: team/oej/moremanager/CHANGES.moremanager
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/CHANGES.moremanager?view=diff&rev=61854&r1=61853&r2=61854
==============================================================================
--- team/oej/moremanager/CHANGES.moremanager (original)
+++ team/oej/moremanager/CHANGES.moremanager Wed Apr 25 15:22:09 2007
@@ -87,6 +87,17 @@
 
 - The MeetmeJoin now has caller ID name and Caller ID number fields (like MeetMeLeave)
 
+- Action ZapShowChannels
+	Header changes
+	- Channel:	-> ZapChannel
+	For active channels, the Channel: and Uniqueid: headers are added
+	You can now add a "ZapChannel: " argument to zapshowchannels actions
+	to only get information about one channel.
+
+- Event ZapShowChannelsComplete
+	New header
+	- (new)		-> Items: 	Reports number of channels reported
+
 * NEW EVENTS
 ------------
 

Modified: team/oej/moremanager/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_zap.c?view=diff&rev=61854&r1=61853&r2=61854
==============================================================================
--- team/oej/moremanager/channels/chan_zap.c (original)
+++ team/oej/moremanager/channels/chan_zap.c Wed Apr 25 15:22:09 2007
@@ -10226,7 +10226,13 @@
 {
 	struct zt_pvt *tmp = NULL;
 	const char *id = astman_get_header(m, "ActionID");
+	const char *zapchannel = astman_get_header(m, "ZapChannel");
 	char idText[256] = "";
+	int channels = 0;
+	int zapchanquery = -1;
+	if (!ast_strlen_zero(zapchannel)) {
+		zapchanquery = atoi(zapchannel);
+	}
 
 	astman_send_ack(s, m, "Zapata channel status will follow");
 	if (!ast_strlen_zero(id))
@@ -10238,18 +10244,48 @@
 	while (tmp) {
 		if (tmp->channel > 0) {
 			int alarm = get_alarms(tmp);
-			astman_append(s,
-				"Event: ZapShowChannels\r\n"
-				"Channel: %d\r\n"
-				"Signalling: %s\r\n"
-				"Context: %s\r\n"
-				"DND: %s\r\n"
-				"Alarm: %s\r\n"
-				"%s"
-				"\r\n",
-				tmp->channel, sig2str(tmp->sig), tmp->context, 
-				tmp->dnd ? "Enabled" : "Disabled",
-				alarm2str(alarm), idText);
+
+			/* If a specific channel is queried for, only deliver status for that channel */
+			if (zapchanquery > 0 && tmp->channel != zapchanquery)
+				continue;
+
+			channels++;
+			if (tmp->owner) {
+				/* Add data if we have a current call */
+				astman_append(s,
+					"Event: ZapShowChannels\r\n"
+					"ZapChannel: %d\r\n"
+					"Channel: %s\r\n"
+					"Uniqueid: %s\r\n"
+					"AccountCode: %s\r\n"
+					"Signalling: %s\r\n"
+					"Context: %s\r\n"
+					"DND: %s\r\n"
+					"Alarm: %s\r\n"
+					"%s"
+					"\r\n",
+					tmp->channel, 
+					tmp->owner->name,
+					tmp->owner->uniqueid,
+					tmp->owner->accountcode,
+					sig2str(tmp->sig), 
+					tmp->context, 
+					tmp->dnd ? "Enabled" : "Disabled",
+					alarm2str(alarm), idText);
+			} else {
+				astman_append(s,
+					"Event: ZapShowChannels\r\n"
+					"ZapChannel: %d\r\n"
+					"Signalling: %s\r\n"
+					"Context: %s\r\n"
+					"DND: %s\r\n"
+					"Alarm: %s\r\n"
+					"%s"
+					"\r\n",
+					tmp->channel, sig2str(tmp->sig), tmp->context, 
+					tmp->dnd ? "Enabled" : "Disabled",
+					alarm2str(alarm), idText);
+			}
 		} 
 
 		tmp = tmp->next;
@@ -10260,8 +10296,10 @@
 	astman_append(s, 
 		"Event: ZapShowChannelsComplete\r\n"
 		"%s"
+		"Items: %d\r\n"
 		"\r\n", 
-		idText);
+		idText,
+		channels);
 	return 0;
 }
 

Modified: team/oej/moremanager/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/manager.c?view=diff&rev=61854&r1=61853&r2=61854
==============================================================================
--- team/oej/moremanager/main/manager.c (original)
+++ team/oej/moremanager/main/manager.c Wed Apr 25 15:22:09 2007
@@ -1466,7 +1466,7 @@
 	while (c) {
 		channels++;
 		if (c->_bridge)
-			snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid\r\n", c->_bridge->name, c->_bridge->uniqueid);
+			snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", c->_bridge->name, c->_bridge->uniqueid);
 		else
 			bridge[0] = '\0';
 		if (c->pbx) {



More information about the svn-commits mailing list