Call statistics from your Cisco router using SNMP

If you are into VOIP using Cisco equipment. You'll understand how important it is to have good metrics. There are many commercial packages available, but this article focuses on the basics. For this you will not need any commercial software, but it will simply pull the information needed using SNMP, leaving it to you to format it into anything that will be more readable.

Needed: SNMP and Mib's

Assuming you will be doing this from a Windows based computer you will need the SNMP toolset to start with. In particular the SNMPWalk command will be used in this document. An excellent set of these tools can be found in the open source "net-snmp" project: net-snmp | Get net-snmp at
Direct link to the download location: Browse net-snmp Files on
Once installed these will have created a directory with MIB files. To get the most out of SNMPWalk digging into the call statistics we will need to add more Cisco specific MIB information. This can be found here:
Do not simply overwrite all the files already installed in the share/mib folder; as this will later on create a number of error messages (although functionality remains, it is annoying to get all this extra output).
The specific MIB files we need are:
Please note that the files from the location mentioned above need two minor changes to become functional:

  1. These are Unix files; meaning they need CR to become CR LF
  2. The extension is .my and needs to become .txt

Since we only need a few files the most practical way is achieve this is to simply list the files in the web bowser, then copy and paste them into notepad and write the resulting file with the correct name into the mib folder.

Pulling the data

We are now ready to start pulling the information out of the router. Assuming you know the IP address (or DNS name) of the router and the community string to read SNMP data from the device (usually 'public').
Go to the 'bin' directory and run the following command:

snmpwalk -m ALL -c public -v2c

–m ALL: it will read all the MIB information you have added and will translate the OID's (Object ID) into readable form.
-c public: the community string
-v2c: We are using version 2 SNMP the IP number of the router
The MIB information we want to read. In this case this represents the Cisco ISDN MIB. More information on this can be found here:
Cisco SNMP Object Navigator
This is The MIB module to describe the status of the ISDN
Interfaces on the routers.
The output for this command would be something similar to:
CISCO-ISDN-MIB::demandNbrLogIf.37.1 = INTEGER: 67
CISCO-ISDN-MIB::demandNbrLogIf.37.2 = INTEGER: 64
CISCO-ISDN-MIB::demandNbrAddress.37.1 = STRING: 00541143312929
CISCO-ISDN-MIB::demandNbrPermission.37.1 = INTEGER: weCanCallEachOther(3)
CISCO-ISDN-MIB::demandNbrPermission.37.2 = INTEGER: weCanCallEachOther(3)
CISCO-ISDN-MIB::demandNbrMaxDuration.37.1 = INTEGER: 2147483647 seconds
CISCO-ISDN-MIB::demandNbrMaxDuration.37.2 = INTEGER: 2147483647 seconds
CISCO-ISDN-MIB::demandNbrLastDuration.37.1 = INTEGER: 14 seconds
CISCO-ISDN-MIB::demandNbrLastDuration.37.2 = INTEGER: 456 seconds
CISCO-ISDN-MIB::demandNbrClearReason.37.1 = STRING: Unallocated/unassigned number
CISCO-ISDN-MIB::demandNbrClearReason.37.2 = STRING: Normal call clearing
CISCO-ISDN-MIB::demandNbrClearCode.37.1 = STRING: "0x01"
CISCO-ISDN-MIB::demandNbrClearCode.37.2 = STRING: "0x10"
CISCO-ISDN-MIB::demandNbrSuccessCalls.37.1 = Counter32: 5331
CISCO-ISDN-MIB::demandNbrSuccessCalls.37.2 = Counter32: 0
CISCO-ISDN-MIB::demandNbrFailCalls.37.1 = Counter32: 0
CISCO-ISDN-MIB::demandNbrFailCalls.37.2 = Counter32: 0
CISCO-ISDN-MIB::demandNbrAcceptCalls.37.1 = Counter32: 37793
CISCO-ISDN-MIB::demandNbrAcceptCalls.37.2 = Counter32: 6077
CISCO-ISDN-MIB::demandNbrRefuseCalls.37.1 = Counter32: 0
CISCO-ISDN-MIB::demandNbrRefuseCalls.37.2 = Counter32: 0
CISCO-ISDN-MIB::demandNbrLastAttemptTime.37.1 = Timeticks: (321505671) 37 days, 5:04:16.71
CISCO-ISDN-MIB::demandNbrStatus.37.1 = INTEGER: active(1)
CISCO-ISDN-MIB::demandNbrStatus.37.2 = INTEGER: active(1)
CISCO-ISDN-MIB::demandNbrCallOrigin.37.1 = INTEGER: originate(1)
CISCO-ISDN-MIB::demandNbrCallOrigin.37.2 = INTEGER: answer(2)
If we want more detailed call logging information we need to look at another MIB: This is the Cisco call history MIB, and gives a whole lot more information. The command:

snmpwalk -m ALL -c public -v2c

Results in something looking like this:
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryTableMaxLength.0 = INTEGER: 100
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryRetainTimer.0 = INTEGER: 15 minutes
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "---N/A---"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "01234567890"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "01234567890"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "01234567890"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "---N/A---"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "---N/A---"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "---N/A---"
CISCO-CALL-HISTORY-MIB::ciscoCallHistoryCallingNumber.012345678 56789 = STRING: "01234567890"
Etc. etc.
(real numbers have been changed into 01234567890 for this article)
More information on what each OID means can be found here:
ipMonitor :: CISCO-CALL-HISTORY-MIB: Cisco Call History

Extracting information

This information needs to be digested to be really useful, and a commercial solution that can do this is for example: Cisco ISDN Call History Collector (this page also hosts more information on the OID's b.t.w)
If we do not want to buy a costly solution, but would like to keep track of certain variables, we could choose to monitor only certain variables. Instead of walking the whole tree, we are for example only interested in the total amount of accepted calls on one of the (in this case) two ISDN interfaces.
The variable for this was, as we have seen earlier:
Since we are using the MIB files, we can refer to it directly instead of using the number associated with this OID. Also, since we only want one variable we will not be walking the SNMP tree, instead we use SNMPGet this time, to simply pick out this one value:
snmpget -m ALL -c public -v2c CISCO-ISDN-MIB::demandNbrAcceptCalls.37.1
(since we are only looking at the end of the branch of this particular tree, SNMPWalk would have given the same result, but this example makes it more clear what we are doing)
The result would be something like:
CISCO-ISDN-MIB::demandNbrAcceptCalls.37.1 = Counter32: 37837
A few minutes later:
CISCO-ISDN-MIB::demandNbrAcceptCalls.37.1 = Counter32: 37841
Of course the same can be done for other interfaces or for outgoing calls. In the same way detailed information on what numbers were dialed etc. can be pulled from the call history, which is kept by default for the last 15 minutes.
Another piece of useful information can be found in the CISCO-POP-MGMT-MIB . This will enable you to see the amount of open B channeld on the ISDN interface at the moment of polling. For example:
C:\mrtg-2.14.3\snmp\usr\bin>snmpwalk -m ALL -c public -v2c isdnBearerOperStatus
ISDN-MIB::isdnBearerOperStatus.38 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.39 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.40 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.41 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.42 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.43 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.44 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.45 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.46 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.47 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.48 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.49 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.50 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.51 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.52 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.53 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.54 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.55 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.56 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.57 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.58 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.59 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.60 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.61 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.62 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.63 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.64 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.65 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.66 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.67 = INTEGER: active(4)

The command:
snmpwalk -m ALL -c public -v2c isdnBearerOperStatus
This is now showing us that there are currently 10 calls being made. It would be possible to execute the command (make a batch file on the desktop for example) for ad-hoc information, or script it to log into a database for graphic representation of calls in progress.
Note that for this to function properly the following MIB's are needed:

موضوعات مشابه: