Sending an email if more than 10 calls are made in a minute

Dear All,

Can you help if you can write a script to send an email to a specified email address if outgoing call if more than 10 calls are made.

I think this is a good idea depends on your normal call to create an alert.

Thanks for your help!

Asking for help is one thing, expecting some one to do your work for you another :slight_smile:

I can suggest a path that relies purely on mysql, so say “yes” if you are prepared to learn how mysql “triggers” work and then come back when you understand completely:-

you need to create a trigger on inserting a row into asteriskcdrdb.cdr that fires when enough calls have been placed outbound within your defined constrained time period, which then can use a “system call” that can turn your xmas lights on or whatever floats your boat…

Thanks Dickio,

I finally managed just to create a trigger and put it in hourly cron! this would work. i have completely forgotten about this, thanks for the reminder! i keep looking at asterisks configuration instead of just thinking about the database!

2 Likes

Triggers, properly written, are synchronous and instantaneous and totally independent of any underlying helpers, so you should never need cron to trigger the trigger :slight_smile:

Hi @januargh, do you mind sharing it?

1 Like

as far as i know, mysql cannot send an email, so we do this in php, and do hourly cron job, to alert me if the condition are met (by inserting a data into a new table), at least if there is any abnormalities, i am notified within the hour. :slight_smile:

trigger -> if condition are met -> insert data into tblCRON -> use php to send an email to me when there is data on that day and that hour

if anyone has a better idea, please share

Hi @januargh, do you mind sharing the script?

OUTFILE + incron?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.