[asterisk-commits] russell: trunk r68507 - in /trunk:
doc/asterisk-mib.txt res/snmp/agent.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jun 8 14:31:33 MST 2007
Author: russell
Date: Fri Jun 8 16:31:33 2007
New Revision: 68507
URL: http://svn.digium.com/view/asterisk?view=rev&rev=68507
Log:
Add support for retrieving the number of channels that are currently bridged
via SNMP.
(closes issue #9637, initial patch from jeffg, modified by me)
Modified:
trunk/doc/asterisk-mib.txt
trunk/res/snmp/agent.c
Modified: trunk/doc/asterisk-mib.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/asterisk-mib.txt?view=diff&rev=68507&r1=68506&r2=68507
==============================================================================
--- trunk/doc/asterisk-mib.txt (original)
+++ trunk/doc/asterisk-mib.txt Fri Jun 8 16:31:33 2007
@@ -11,7 +11,7 @@
FROM DIGIUM-MIB;
asterisk MODULE-IDENTITY
- LAST-UPDATED "200603061840Z"
+ LAST-UPDATED "200606081626Z"
ORGANIZATION "Digium, Inc."
CONTACT-INFO
"Mark A. Spencer
@@ -736,4 +736,14 @@
"Number of active channels using the current technology."
::= { astChanTypeEntry 7 }
+astChanScalars OBJECT-IDENTIFIER ::= { asteriskChannels 5 }
+
+astNumChanBridge OBJECT-TYPE
+ SYNTAX Gauge32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of channels currently in a bridged state."
+ ::= { asteriskChanScalars 1 }
+
END
Modified: trunk/res/snmp/agent.c
URL: http://svn.digium.com/view/asterisk/trunk/res/snmp/agent.c?view=diff&rev=68507&r1=68506&r2=68507
==============================================================================
--- trunk/res/snmp/agent.c (original)
+++ trunk/res/snmp/agent.c Fri Jun 8 16:31:33 2007
@@ -138,6 +138,8 @@
#define ASTCHANTYPETRANSFER 6
#define ASTCHANTYPECHANNELS 7
+#define ASTCHANBRIDGECOUNT 5
+
void *agent_thread(void *arg)
{
ast_verbose(VERBOSE_PREFIX_2 "Starting %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
@@ -583,6 +585,26 @@
break;
}
return NULL;
+}
+
+static u_char *ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ unsigned long long_ret = 0;
+ struct ast_channel *chan = NULL;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return NULL;
+
+ while ((chan = ast_channel_walk_locked(chan))) {
+ if (ast_bridged_channel(chan) != NULL)
+ long_ret++;
+ ast_channel_unlock(chan);
+ }
+
+ *var_len = sizeof(long_ret);
+
+ return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL;
}
static u_char *ast_var_Config(struct variable *vp, oid *name, size_t *length,
@@ -802,6 +824,7 @@
{ASTCHANTYPEINDICATIONS, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEINDICATIONS}},
{ASTCHANTYPETRANSFER, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPETRANSFER}},
{ASTCHANTYPECHANNELS, ASN_GAUGE, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPECHANNELS}},
+ {ASTCHANBRIDGECOUNT, ASN_GAUGE, RONLY, ast_var_channel_bridge, 2, {ASTCHANNELS, ASTCHANBRIDGECOUNT}},
};
register_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid),
More information about the asterisk-commits
mailing list