Monday, March 4, 2013

A POCSAG -> email gateway

EDITED 26-Nov-2013: Minor bugfixes on commands, moved script to Google Drive, added more explanation.

I put this script together a while ago. It examines the output from Multimon-NG, and forwards selected POCSAG messages via email. Note that it uses SMTP via TLS, which may not work for your email provider. Gmail works fine.

First off, copy the script to the home directory of your Pi.

Then:

sudo apt-get install libnet-smtp-tls-perl libdatetime-perl
chmod +x pocsag_fwd.pl

Next, configure it. Lines 31-33 need to be updated to include your SMTP server and login details.
Also, the definition of the @stream variable (lines 11-26) need to be modified to include the POCSAG address ID's and email addresses you want. Hopefully the syntax and meaning of the fields will be self-explanatory. You might want to examine the output from multimon-ng for a while to find the addresses you're interested in.

To use it:

rtl_fm -N -o 4 -l 10 -A fast -r22050 -s88200 -C -D -f 148.7125M - |multimon-ng  -t raw -a POCSAG512 -f alpha /dev/stdin|./pocsag_fwd.pl

2 comments:

  1. Thanks Geoff. I've used this as a base for some software which posts to my remote server and logs it all in a DB

    ReplyDelete
  2. Hi!
    Im trying to get your script working but I just get som errors and my Perl knowledge are quite poor :-)

    The error I receive after I have added "use warnings;" in the top of the file are:

    main::process_msg() called too early to check prototype at ./pocsag_fwd.pl line
    70 (#1)

    The line 70 is under the STDIN main loop

    process_msg(\@stream,$addr,$function,$text,$now);

    Do you have any idea whats going wrong?

    ReplyDelete