A Python-based bot for APRS net and tactical group message handling (UPDATE: now with SMS gateway)

APRS bot based on the ioreth Python script can be used off-grid in purely RF and in mixed APRS-IS environments

APRS stations in DU1 and DU3

APRS NET

I have built an APRS bot on top of the ioreth script by Alexandre Erwin Ittner (PP5ITT).

Some use cases include:

  • NET checkins for APRS users
  • CQ messaging for group chats (among checked-in users)
  • SMS gateway
  • Remote commands for the server.

You can find a simple text-based instructions and logs here: https://aprsph.net.

The group chat logs are here: https://aprsph.net/cq.

Update: I have forked Alexandre’s repository into my own — github.com/jangelor/ioreth. This includes bot functionalities, and I am actively updating it with new fixes/features.

How to checkin

Send an APRS message to APRSPH staring with NET (case insensitive). You can add a message after that keyword, which will be logged in the list linked above. DMR users can also send a message to their master server’s APRS gateway (515999 in the BM_Philippines server) with the message body APRSPH NET <any message here>.

It does these things:

  • Logs the callsign+ssid into a daily logfile;
  • Logs the rest of the message text into a cumulative logfile;
  • The bot also sends BLN#PH and BLN#NET messages announcing stuff , including an update of the day’s checkins— https://aprs.fi/bulletin/ph & https://aprs.fi/bulletin/net
  • The bot updates aprsph.net after every check-in it will add timestamp, callaign, and messages written after the “net” keyword.
  • The bot also checks for duplicate checkins (since aprs messages are resent multiple times until an ACK is received by the sender) so the list is not overpopulated. Messages sent by duplicate checkins or multiple checkins in a day are still logged in the list.

By checking in to the net, you join the “group list” for that day (which expires every midnight HKT).

Note: I have initially wondered whether to make this a weekly thing instead so that stations can keep “subscribed” to the group until they stop checking in in a week’s time. But that might result in a noisy RF environment with a lot of messages if a station were to send a group message to a long list. Setting it to renew every day might make more sense.

A very rudimentary presentation of the net checkins and messages

How to check the log

Send a message starting with “list” to APRSPH.

  • This returns a comma-separated reply with the current date and the stations logged for that day so far.
  • The day restarts at 1600H UTC or 0000H HKT, and the list refreshes every day.
  • You can of course go to https://aprs.fi/bulletin/net or wait for the bulletin numbered BLN8PH and BLN9PH to be sent by the system. If you are in DU1, you will get these via RF. If you are elsewhere, you can perhaps configure your iGate to send such BLNs to RF if you wish. Some APRS clients may have the ability to subscribe to bulletins by keyword.

Send a message to all checkins

Starting a message with “cq” (case insensitive) + your message will transmit your message text to all callsign+ssid in the current day’s checkin list. This refreshes every day.

This also checks you in to the day’s net if not already checked in.

There is also an undocumented keyword for group-sending to stations within my vicinity — the use case is for tactical communication in EmComm scenarios.

APRS.fi captures all the data, assuming they are heard by an igate and not set to RFONLY or NOGATE.

The bot can also send you a short history of the most recent messags, so you can review them while on your radio or APRS device. Of course, you can see them on the web logs linked above, but in case there is no internet connection, at least you can still have some sort of backread capability.

  • Sending “log” sends you the last 3 net logins with their messages.
  • Sending “last” sends you the last 3CQ chat messages.

If you don’t have an APRS-enabled radio or computer-connected terminal

You can use APRSdroid, QTH app, PocketPacket, or any other smartphone- or computer-based APRS application.

The great thing with this is that the bot sends group messages individually, so you can still get the CQ messages even if apps like APRSdroid don’t support receiving GROUP or BULLETIN messages.

The bot supports other commands, such as

  • Ping — replies with Pong plus the rest of the original message
  • ?Ping? or ?aprst — replies with the paths that the message went through to get to the APRSPH bot
  • Time — replies with current time on my machine
  • Version — replies with software versions
  • Help — replies with supported keywords

I am still cleaning up the code. I’m not a great coder, so it’s a bit messy. It’s been decades since I learned rudimentary coding, although I am quite imaginative and I tend to believe I have good grasp of logic.

You can check out the original source repository here: https://github.com/ittner/ioreth which I will try to fork and possibly make a pull request so that other parties that may wish to develop.

UPDATE as of May 4, 2022: The bot now has an APRS-to-SMS gateway

After a lot of conceptualization in my head, hunting for the right code, and tweaking the ioreth code, the two-way APRS-to-SMS gateway for Philippine numbers is now online.

APRS to SMS

To send from APRS to SMS, simply send a message to APRSPH with this format (not case sensitive):

SMS 09XXXXXXXXX Your message here …

Make sure the cell# does not have any spaces and starts with the 09XX and NOT +63, etc.

SMS to APRS

To send a message to an APRS station, write an SMS message to 09760685303 with the following format:

@CLSIGN-SSID Your Message here …

For example:

@DU2XXR-7 Hello Angelo this is a test message.

The bot will split the message if the message is too long to fit the standard 67-character APRS standard.

Try not to rapid-fire send, as there is some processing needed at the back-end. Also, there could be packet collisions on local RF if there are too many messages being sent in a very short span of time.

The bot polls the inbox every minute or so for new SMS messages. Meanwhile, APRS messages are processed and queued as soon as received by the bot.

I don’t expect heavy usage, but I’ve loaded the sim with few hundred no-expiry SMS messages. If we get more heavy usage, I might switch to a promo with unlimited message allocation. Remember, these are all off-pocket for me.

With GOMO, I buy 30 GB for 299 pesos. I convert 0.2 GB into 30 SMS messages. So a 299 peso. reload can be converted to a total of 4,500 SMS.

I have thus computed the cost to be at PHP0.067 per single SMS message, or around $0.0013 each message. Messages originating from cellular get a reply (confirmation of send or an errormsg + instructions), so that’s x2 the cost.

In contrast, using services like Twilio or other online-based SMS platforms would cost around 1–3 pesos per SMS sent, or around 15x to 45x the cost of doing it with a GSM modem. I am actually using a GSM modem I found lying around in storage. I still have a few others.

NOTE: APRS messages are transmitted in the clear, so users will be able to see cellphone numbers that you send to or from. Here’s where aliases play a big part. Either APRS user or SMS user can set their own aliases so their numbers don’t appear on APRS-IS logs or on RF. Check out below.

Update 2022–05–07: SMS now supports aliases, so users may exchange messages with their SMS contacts in the Philippines without numbers appearing on APRS-IS.

Usage:

SMSALIAS 09XXXXXXXXX nickname

Replies from contacts with aliases will also no longer include numbers but instead their names. This is validated per callsign, which means the alias will work between using DU2XXR-7 and DU2XXR-9 for example. You may contact me directly if you want to upload a cell# and alias list without having to do it over-the-air.

Aliases work per callsign, independent of the SSID used. So aliases used by DU2XXR-7 will work when a message is sent from DU2XXR-9 for example.

This is similar to SMSGTE, although on a smaller scale and without having to request support from the SMSGTE admin/s. In addition, this runs on a headless Raspberry Pi, which also powers the APRSPH-1 (formerly DX1ARM-1) digipeater. This can run fully on RF without internet (but with cellular for SMS), although it also works in a hybrind RF-IS setup.

Note, since the gateway is in the Philippines, this only supports Philippine SMS numbers. However, this can be easily ported to other countries, as well, for as long as you have the bot running, gammu-smsd, and a compatible 3G/GSM modem running locally in your country. I have yet to update the code on github with my latest additions, though.

UPDATE 2022–05–13: Cellphone-originated aliases are now working.

This lets cellphone users set aliases for themselves even if the APRS user does not. This can help protect the privacy of the SMS user — their number will not appear on APRS-IS services.

Usage:

Send a message to the SMS gateway number 09760685303:

ALIAS myname

with myname being a one-word alias. For example, for hams, it would be good if this can be your callsign (but not required, e.g., if the sender is not a ham).

Then, you can message any other APRS user, and they can reply to you using your self-defined alias/callsign. Note that an APRS user-defined alias will take precedence over an SMS user-defined alias, at least from the APRS side.

Some BUGS, TODOs and WISHLISTs

  • Some malformed message packets when sending to long callsign+SSIDs, such as 4G1AMK-15 or DL1KDX-10. I have yet to figure out what’s causing this. RESOLVED: I found a rouge “\n” line break in the callsign field causing this issue. That has since been resolved, and now messages are being written in proper AX.25 frames.
  • I also need a way to split the output in case it exceeds the APRS message character limit. The spec says 67 characters, but some clients apparently support receiving longer lines of text, so this might be a minor want for now. RESOLVED: I have been able to do this with SMS-to-APRS messages. Soon I will make a code update and cleanup to improve handling of longer APRS messages.
  • I plan a store-and-forward or at least a store-and-pull mechanism for messages, so that stations who do not hear their packets on radio when messages are on the air have the chance of reviewing them. RESOLVED: The LOG and LAST commands somehow accomplish this.

Hopefully, this “net” will help establish a list of stations/users who are into APRS messaging. If you want more information on APRS, I have a short article on APRS here:

You may also want to check out APRS.org, APRS.net, and APRS.fi among other resources. APRS is a trademark of Bob WB4APR, who unfortunately recently passed away.

There are also other bots I enjoy using, such as MPAD, WLNK-1, WXYO, SMSGTE. I’m sure many of you will be familiar with these already. ANSRVR is interesting, but I want something more “sticky” and which can be applied to RF-only use cases.

This is a work in progress!

--

--