[Asterisk-Users] MY Sql CDR

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Sun Sep 21 19:41:58 MST 2003


On Sunday 21 September 2003 18:16, Uriel Carrasquilla wrote:
> I have a question regarding MySQL CDR's:
> For a given extension I need to limit the number of minutes it can
> use in a given week.
> I was thinking about using the CDR information in the MySQL table to
> see the usage for the week and then if exceeded, STOP the call and
> play a message. does anybody have a suggestion on how to query the
> database so I don't have to add-up all the minutes this particular
> extension have used during the week?

I'm guessing you're looking for a query formula?

mysql> select sum(billsec) from cdr where calldate >
'2003-09-01 00:00:00' and '2' in (src,dst);
+--------------+
| sum(billsec) |
+--------------+
|          173 |
+--------------+
1 row in set (0.03 sec)

where '2' is the extension you want to limit.

-Tilghman




More information about the asterisk-users mailing list