Anyway to know the load for outbound channels at any exact time from reports/stats?

Hi Everyone,

I have a client that complains that occasionally they get BUSY even though not many people are not making calls.

I have assigned them 5 outbound lines and I am assuming they are running out of lines. However, I want to know if there is a way that I can search a specific time during the day to see if for example 5 channels were used between 1:00 to 1:02 or not so that I know if they run out of channels or what?

If there is any other program other than the Asterisk Stats (know as Reports) that can do this please guide me to it.


you can do that with master.csv file and awk or with mysql query.

awk method :
awk ‘BEGIN{FS=",""} /ANSWERED/{split($11, a, “”"); split($12, b, “”");printf ("%s,1\n%s,-1\n", a[1],b[1]); }’ Master.csv | sort | awk -F , ‘{cpt=cpt+$2; printf ("%s %03d\n", $1, cpt);}’

mysql query :
SET @cpt = 0;
SELECT evttime, @cpt := @cpt + typevt AS totcalls FROM (SELECT calldate AS evttime, 1 AS typevt FROM cdr UNION ALL SELECT adddate(calldate, interval duration second) AS evttime, -1 AS typevt FROM cdr ORDER BY 1 ASC, 2 DESC) allcalls WHERE evttime > ‘2010-10-01’; is something we are looking at. However, it’s not something that would necessarily easily integrate tightly with FreePBX, but there could be a looser integration.

It does have several dependencies that have to be met (it’s written in python) including some tricky ones on platforms like centos, at least according to discussions I had a couple months ago with the team who has written this.

It does look like an excellent tool and replacement for the current reports engine though (which was originally written by the same author who has done the work). So it should eventually make its way in.

Thanks for the input. I think that would do for some part. However, I was exploring the new cdr-stats from and it does have something of the sort for calls during certain period generated from the cdr data available.

I think a better way would be to analyze the cdr table in a more specific way to extract this data. Wouldn’t it? The info is I think available.

P.S. Wondering why the new cdr-stats is not built into FreePBX yet. License issues?

Oh, that sounds complex. Is that the only option?

Thanks for the feedback.

No, that’s not the only option, but it’s probably the most robust.

How about something simpler?

Execute this by cron every minute: (as root or asterisk)

That little bit of bash shell scripting executes the ‘core show channels’ CLI command, looks for the name of your outbound provider and counts how many times it appears in the list, thus how many channels are in use to that provider. If it’s greater than or equal to 5 ("-ge 5") then send mail to torontob and tell him the threshold has been reached.

Or you can just log it with syslog by using the logger command:

and go check your syslogs when someone complains of a problem.

Hope that helps. It’s totally outside the scope of this forum so I hope it doesn’t bother anyone. The FreePBX way, I think, is to keep the admin screen up and watch the External Calls bar to see if it reaches the max.

SNMP can help you here. Check out this link on setting up Asterisk’s SNMP module and monitoring load with Cacti. (Of course you can choose any SNMP monitoring tool. There are hundreds. Or write your own.)