Openspot Interactive SMS Script

Post Reply
kf7eel
Posts: 7
Joined: Tue Nov 05, 2019 8:42 pm

Openspot Interactive SMS Script

Post by kf7eel »

Hi everyone,

Just wanted to share a script that I have spent several hours, over days, working on to allow SMS interaction with a Linux machine. I have wanted to create an interactive SMS service, similar to the service on Brandmeister, to control the Openspot, send email, and other functions for a long time. After days of coding, I finally have a stable-"ish" script that will check a received SMS, filter it, then reply. It also serves as an SMS to E-Mail gateway, with the ability to receive email as well. You can find it at https://github.com/kf7eel/shark-py-sms.

I don't know if there others out there that could benefit from something like this. I hope it is useful to sombody. I created it to make my Openspot a little more useful.

Thanks,

Eric
KF7EEL

n5amd
Posts: 3
Joined: Wed Jan 01, 2020 3:47 pm

Re: Openspot Interactive SMS Script

Post by n5amd »

Thank you for writing this. I am absolutely surprised more people are not taking advantage of the SMS API with as many sharks as there are out there. The utility of SMS is boundless so again, thank you!!

I am trying to accomplish the same idea but straight bash and im having a world of trouble trying to convert ascii into UTF-16BE.
In the mean time, I cloned your repo, but im not finding any sms-interact.py. Am I missing something?

kf7eel
Posts: 7
Joined: Tue Nov 05, 2019 8:42 pm

Re: Openspot Interactive SMS Script

Post by kf7eel »

No, it was just my failure to update documentation. I just updated it with a few code changes. More to come in a week or so.

n5amd
Posts: 3
Joined: Wed Jan 01, 2020 3:47 pm

Re: Openspot Interactive SMS Script

Post by n5amd »

Have you or anyone for that matter been able to get this to work when connecting to XLX? I cant appreciate the shark folks enough for implementing an API into the device, but I am finding a lack of use case without the flexibility of being able to use your own connector. Brandmeister SMS is hit or miss and I think I would get a lot more use out of it to send users on XLX information rather than bombarding BM. BTW i was able to get this working through straight Shell:

Code: Select all

#!/bin/bash
SERVER=IP-ADDRESS
PASS=PASSWORD
TOKEN=$(curl -s http://$SERVER/gettok.cgi | jq -r .token)
HEX=$(echo "$1" | iconv -f utf-8 -t utf-16be | xxd -p | tr -d '\n')
DIGEST=$(printf $TOKEN$PASS | shasum -a 256 | sed 's/-//')
JWT=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"token\":\"$TOKEN\",\"digest\":\"$DIGEST\"}" "http://$SERVER/login.cgi" | jq -r .jwt)
echo "---------"
echo "Are we authed..."
echo "---------"
AUTHED=$(curl -s -H "Authorization: Bearer $JWT" http://$SERVER/checkauth.cgi | jq -r .success)
if [ "$AUTHED" == "1" ]
then
   echo "AUTHED!! SENDING MESSAGE...."
   curl -s -X POST -H "Authorization: Bearer $JWT" http://$SERVER/status-dmrsms.cgi -d '{"only_save": 0,"intercept_net_msgs": 0,"send_dstid":"<DMR-ID>","send_calltype": 0,"send_srcid":"9998","send_format": 0,"send_tdma_channel": 0,"send_to_modem": 1,"send_msg": "'"$HEX"'"}'
else
   echo "NOT AUTHED!!!"
   exit 0
fi

kf7eel
Posts: 7
Joined: Tue Nov 05, 2019 8:42 pm

Re: Openspot Interactive SMS Script

Post by kf7eel »

I haven't played around with D-Star really, due to lack of D-Star radio, so I can't really speak to the ability of working with XLX reflectors. As far as I know, the Openspot will only send SMS from the web portal in DMR mode. I have found that it will send DMR SMS to an MMDVM network. I use HBLink3 for several hotspots and have been able to successfully send SMS from a radio via Pi-Star hotspot, to the Openspot, and receive a reply.

Post Reply