[asterisk-users] Caller ID questions
Gordon Henderson
gordon+asterisk at drogon.net
Sat May 22 10:28:19 CDT 2010
On Sat, 22 May 2010, GlenM wrote:
> Hello Folks;
>
> I have a dilemma:
>
> I have a client with Asterisk 1.4x and he needs to have a record of all
> incoming calls - caller ID and date/time is sufficient. Since I am not
> an Asterisk wizard, I am doing it this way.
>
> I set a cron job to tailf the last 10 lines of the Master.csv file and
> package those nicely in an email. However, I can see some inefficiencies
> in this. Main one is what if there are more than 10 incoming calls
> between cron runs?
>
> So, questions:
>
> 1. has anyone done this?
> 2. is there a better way?
> 3. if so, can you 'skool' me ?
AIUI, Asterisk opens for append the Master.csv file, (fopen (... "a"))
which creates the file if it doesn't existis.. writes a line to it then
closes it for each CDR recorded, so ...
You can rename the Master.csv file then email the file then delete it...
Pseudocode:
Once every 10 miuntes from cron:
if Master.csv does not exist, then exit // No calls
rename Master.csv work.csv
sleep 1
process and email work.csv to whoever
delete work.csv
exit
The sleep may not be needed, but it won't do any harm in the event that
you rename the file after asterisk opens it but before it writes the line
into and closed it.
And instead of deleting the work.csv you could append it to some other
file for a permanent log...
Gordon
More information about the asterisk-users
mailing list