[asterisk-users] CDR extract call numbers on interval on unique callers

Andre Gronwald andregronwald78 at gmail.com
Tue Nov 12 08:16:51 CST 2019


thanks john,

that is a good idea and really easy.
I selected both values to have a good comparison:

select calldate, count(distinct(clid)), count(clid) from cdr where 
calldate > '2019-10-12' group by unix_timestamp(calldate) DIV 900 ;

now it would be nice to have intervals starting always in the same 
manner. currently the output is like:

MariaDB [asteriskcdrdb]> select calldate, count(distinct(clid)), 
count(clid) from cdr where calldate > '2019-10-12' group by 
unix_timestamp(calldate) DIV 900 ;
+---------------------+-----------------------+-------------+
| calldate            | count(distinct(clid)) | count(clid) |
+---------------------+-----------------------+-------------+
| 2019-10-14 08:04:36 |                     5 |          24 |
| 2019-10-14 08:16:42 |                     6 |          14 |
| 2019-10-14 08:30:55 |                     7 |          29 |
| 2019-10-14 08:45:10 |                     3 |           6 |
| 2019-10-14 09:00:46 |                     6 |          19 |
| 2019-10-14 09:35:57 |                     4 |           5 |
| 2019-10-14 09:45:05 |                     4 |          19 |
| 2019-10-14 10:01:12 |                     6 |          45 |

[...]

would be better to have dates starting with "2019-10-14 08:00:00", 
"2019-10-14 08:15:00" etc...
any quick idea? i will search for that anyway.

regards,
andre



More information about the asterisk-users mailing list