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


(Januargh) #1

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!


#2

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…


(Januargh) #3

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!


#4

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:


(Itzik) #5

Hi @januargh, do you mind sharing it?


(Januargh) #6

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


(Moussa) #7

Hi @januargh, do you mind sharing the script?


#8

OUTFILE + incron?


(system) closed #9

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