[Asterisk-Dev] Feature request: CDR to serial port

Adam Goryachev mailinglists at websitemanagers.com.au
Mon Sep 20 19:10:05 MST 2004


On Tue, 2004-09-21 at 05:33, Aaron S. Joyner wrote:
> Chris A. Icide wrote:
> 
> > I'm interested in a module that would allow asterisk to output (based 
> > upon a config file) certain CDR entries to a serial interface.
> 
> I'm sure having a native interface in * would have it's advantages, but 
> don't discount the simple solution.  You can easily run a single command 
> to tail the output of the cdr log, and send it to the serial port (`tail 
> /var/log/asterisk/cdr-csv/Master.csv > /dev/ttyS0`).  As a super-simple 
> solution for filtering, if you needs are this basic, you can exclude all 
> extensions that match a regular expression so easy it's almost amusing 
> (`tail /var/log/asterisk/cdr-csv/Master.csv | egrep -v 
> '^.*?,.*?,"7...",' > /dev/ttyS0`).You might also consider some of the following advantages in the above suggestion.

What happens if the other side is down/offline, etc... you would lose cdr
information. However, with a nice perl script, you can do something like this:
while read cdr line;
do
  if serial port is up
  then
     reformat cdr and send to serial port
     record somewhere the current date/time or cdr line number or something
  else
     die "Serial port is not listening to me!\n";
done

This is ummm, mixture of bash/perl for your reading pleasure, but...

Anyway, once you have done that much, you can then add in the obvious missing
features, like jump to the line after the line you last successfully processed,
maybe using byte numbers instead of line numbers. Don't forget to check if the
file was truncated, or is bigger than before but with different data etc...

Then, when you are finished, run the script every minute (or 10, or hour or whatever).

Worst case is that your cdr data is slightly delayed, but if asterisk is running, 
then it should be able to write the data to local disk, so you can't have phone 
calls that are never billed for.

If you would like to pay for someone to write that for you, I'd be happy to help, 
as would a number of other consultants, or even ordinary programmers...

Regards,
Adam




More information about the asterisk-dev mailing list