How to check yesterdays channel count on particular time in asterisk

Hi,
Is there any way we can check yesterdays channel count on particular time on asterisk

Did you look at Reports >> CDR Reports?

You can have so many options to filter / group your results and you can export as csv file

Mysql can COUINT SELECTed data from the ‘cdr’ table in asteriskcdrdb

SELECT COUNT(uniqueid)  FROM  cdr WHERE calldate >= 'YEAR-MO-DA HR:MN:SE' AND  addtime(calldate,DURATION) <= 'YEAR-MO-DA HR:MN:SE'

YEAR-MO-DA HR:MN:SE is of course numbers to identify the point of interest

1 Like

It depends on what the OP means by channel count. I read it as the number of channels concurrently open, but even if you want the cumulative number closed, that query will underestimate.

If you can get by with the cumulative number created, and there are not too many, there is an implementation detail of unique ID that will give you that, in that the part of unique ID after the dot is a serial number modulo some power of two. The other part is the time of creation.

I don’t think the number concurrently open is logged.

Only the OP can answer what he means by ‘channel count’ (@moussa854 ?)

I supplied a query to simply count the number of concurrent calls at a singular second in time that have been opened but not closed, If he wants absolute channels he can use a similar method on the ‘call event log’ (cel) table using eventtype and counting uniqueid’s but bearing in mind any linkedid , both of these records are committed on the state change of the channel.

The granularity is 1 second (asterisk not mysql) , so I guess you are correct the result might be either an over or under estimation.

Actually the mantissa of uniqueid is simply the number of ‘channels’ previously opened since Asterisk was last started ++ and the significant part is the number of seconds since the ‘epoch’ (Jan 1 00:00 1970 in Greenwich London) , which is why it is always a ‘uniqueid’,

No, the number of open channels is not logged, however Asterisk’s SNMP mib can show ‘the number of active channels’ as ‘asteriskChannels’ in a contemporaneous fashion if he needs it.

Thank you for your input. I use the cdr table to get some information. I was trying to help . Will see what the op @kiranpk is trying to achieve

1 Like

Sorry, I shoulda said @kiranpk, I was just pointing out how cdr/cel tables can more specifically filtered

1 Like