How to determine Max channels used

Is there a way to determine the max channels used at any time on our pri? The reason for this is we have a pri and would like to know if we’re reaching, or getting close, to using the total available channels. This would help us know if we need to upgrade our service or possibly cut our pri down to only 11 channels.

Another nice thing to be able to do is have an easy way to determine what FXS or FXO zap channels are configured without having to look through all of the extensions. We have 96 FXS channels and they constantly get changed because of moves, add or deletes. We currently maintain a list outside of FreePBX but we still have to do an inventory every once in a while to insure its accuracy which is a major pain in the butt.

Thanks for any assistance.


You can get some information about simultaneous calls from the CDR report built into FreePBX. Click on daily load at the top of the screen.

Zap show channels at the CLI might help some, but beyond that, I don’t know.

I’ve looked several times and there is nothing built to do this easly.

Some background on PRI, T1, E1 setups, channels are used in this way by default:
Incoming calls start at the lowest number (1) and work up using the first available channel number. So if you have 3 incoming calls the next call would come in on Zap/4 (also I’m assuming it’s the first zap device so starts at 1). Outbound calls start at the high end and work down using the first available channel. So first out on a PRI would be Zap/23, second is Zap/22. If Zap/23 hangs up and another attempts a call out while Zap/22 is still in use it will use Zap/23 again.

So knowing this you can scan the /var/log/asterisk/full log for all references to answer/dial and hangup on a Zap channel

This search string helps: egrep ‘(Executing Answer|Executing Dial|Hungup|answered|INSERT INTO cdr|Answer)’ full | grep -i Zap | grep -v pseudo

It will get all answering and dialing strings along with the matching hangup and CDR record sets. If you don’t want the CDR records remove INSERT INTO cdr| Also notice that it is possible to get more then one – Executing Answer ("Zap/

If you have multiple Zap devices it get’s more interesting. We have a tdm110 (Zap/1 - Zap/23) and tdm400 card (Zap/25 - Zap/28) so we need to then filter out anything starting at Zap/25 as those are the dedicated analog ports.

No answer here, but maybe a lead. In the Truck setup you specify the “Maximum channels” value to limit the capability of the channel.

How is this check implemented, is it a “xxxx show channels” and then a script to count the lines, or some variable in asterisk that can be queried and checked against ?

For the few times I needed it - I called my Telco provider, and they sent me a report. I think that they even show that info in the web portal they have for us, but it hasn’t been important to me.
BTW - We use Paetec

If I recall correctly, using g0 (assuming group 0) for your trunk will select the lowest available channel for outbound calls and G0 would select the highest available channel (thus behaving as indicated). So set your trunk as g0 and then scan your logs to find the highest available zap channel that was ever used. There are other options that are a bit more involved but this seem the easiest.

What would be nice is if asterisk had some basic snmp data that could be polled at regular intervals. That is where it really needs to be tracked at the application level and not at the FreePBX level.

It’s even possible that it exists I’ve never looked to see if they provide any snmp data access. Ok I spend 30 seconds and looked. IT seems that asterisk 1.4 has snmp support so you can use any one of hundreds of snmp monitoring packages to do this and get graphs. I’ve not yet dug into the details on what they provide but it’s possible and more importantly the correct way to do it.

I just use the “Reports” page on FreePBX. Specify “Zap/xx” in the “CHANNEL” field to see how many call have been made (in & out) for that channel. Increment the “Zap/xx” (Zap/1, Zap/2, … Zap/23) to see calls for each channel.

It was always my intention to get MRTG running on an Asterisk box. The mib is fairly well documented.

I just took a look on a CentOS machine and I was able to start snmpd service with a skeletal snmpd.conf.

snmpwalk is not installed in CentOS5 and I could not find what package it is in.

I did find the Asterisk MIB so now my curiosity is peaked. If anybody else is interested in this we should try and put together a how to.

My Apache is very weak so I would need help getting MRTG running.


To find out which day in the last six months had the highest amount of ZAP calls:
[]Click on Call Logs
]From: change to 6 months ago and click the checkbox, To: should automatically be set to the current month
[]Type ZAP/ in CHANNEL field (this will return all ZAP traffic)
]Click Search button
[*]Below the - Call Logs - table there is the TOTAL table that shows traffic totals by day. DURATION is total calls in minutes:seconds. CALLS is total number of calls. ACT is Average Connection Time.

To find out detailed ZAP traffic statistics by hour and minute for your busiest day:
[]Click on Daily Load
]Select the day From: change this to the busiest day in the last six months as found above
[]Type ZAP/ in CHANNEL field (this will return all ZAP traffic)
]Click Search button
[]Below the TOTAL table the first graphic, Load by hours, shows the number of calls during each hour.
]Below that is a control for the second graphic, Hourly Graph. Change the HOUR INTERVAL to the hour with the highest load shown in the first graphic.
[]Make sure the TYPE GRAPH is set to WATCH CALLS GRAPH.
]Click Search button.
[]The Hourly Graph may be a little difficult to understand. It visually indicates the start and stop time of each call and the total calls during the hour. This allows you to see which calls were active simultaneously.
]However, the important number is MAX LOAD. This is the number of simultaneous calls active at any point during that hour.


Most excellent set of documentation. About the only thing it does not show is the max number of inbound versus outbound calls, but when watching for amount of PRI usage in total this does it very nicely…

sasargen -

That’s a great process for generating ad-hoc reports.

I see much value in real time stats and the ability to integrate into enterprise monitoring solutions. The metrics produced by the Asterisk MIB are quite useful.

MRTG + net-snmp + Asterisk MIB integration would be a great addition. if we do a good job it could be contributed to the project and included in the reports tab.

I hope someone offers to help, I stand ready to do all I can.