Skip to content

Instantly share code, notes, and snippets.

@fbradyirl
Last active May 13, 2016 09:05
Show Gist options
  • Save fbradyirl/15c0e94922325112e190 to your computer and use it in GitHub Desktop.
Save fbradyirl/15c0e94922325112e190 to your computer and use it in GitHub Desktop.
Modified version of kario's script from http://whrl.pl/ReAdkH
#######################
#EMAIL SMS IN ROOTER #
#######################
#
#name this file to /usr/lib/sms/forwardsms.sh
#insert the following lines between "uci commit modem" and "fi" of the loop in file /usr/lib/sms/processsms
#if [ -e /usr/lib/sms/forwardsms.sh ]; then
# sh /usr/lib/sms/forwardsms.sh $CURRMODEM
#fi
echo "Starting possible modem queries and smsread.lua" "Date: `date -R`" > /tmp/timestamps
#NEXT SMSREAD.LUA SCRIPT !!!!
CURRMODEM=$1
echo forwardsms.sh did run, CURRMODEM was $CURRMODEM > /tmp/debug_forwardsms
lua /usr/lib/sms/smsread.lua $CURRMODEM
#smsread.lua writes list of decoded SMS messages to file /tmp/smstext
echo "End of modem query/smsread.lua section," "Date: `date -R`" >> /tmp/timestamps
SUBJECT="ROOTER $HOSTNAME got SMS"
TIMES=`cat /tmp/timestamps`
SMSTEXT=`grep -B 1 "["$'\xe2\x9a\x91'"]" /tmp/smstext`
SMSRESULT=`cat /tmp/smsresult$CURRMODEM.at`
# Cisco Spark Config. Fill this in for yourself. You can get these details at https://developer.ciscospark.com/getting-started.html
spark_auth_token=<token>
spark_person_uuid=<uuid>
notify_spark () {
# Send a message to me via Cisco Spark
curl -k https://api.ciscospark.com/v1/messages -X POST -H "Authorization:Bearer $spark_auth_token" --data "toPersonId=$spark_person_uuid" --data-urlencode "text=$1"
}
notify_spark "---------------------------
$SUBJECT
---------------------------
$SMSTEXT
---------------------------
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment