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 -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
