Skip to content

Instantly share code, notes, and snippets.

@Zoddo
Created May 2, 2020 12:48
Show Gist options
  • Save Zoddo/d7694584c64f12b223451122933e9c38 to your computer and use it in GitHub Desktop.
Save Zoddo/d7694584c64f12b223451122933e9c38 to your computer and use it in GitHub Desktop.
Gammu config
# /etc/udev/rules.d/10-local.rules
SUBSYSTEMS=="usb", ACTION=="add", ENV{.ifNumber}="%s{bInterfaceNumber}"
SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001", ENV{.ifNumber}=="00", SYMLINK+="phone"
# /etc/gammu-smsdrc
# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
device = /dev/phone
name = Téléphone sur le port USB série ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿHUAWEI_Mobile
connection = at
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
service = files
logfile = syslog
# Increase for debugging information
debuglevel = 0
pin = xxxxxxxxxx
RunOnReceive = /home/pi/relay-sms.sh
# Paths where messages are stored
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/
MultipartTimeout=30
# /etc/systemd/system/gammu-smsd.service.d/override.conf
[Unit]
Wants=asd.service
BindsTo=dev-phone.device
After=dev-phone.device asd.service
[Install]
WantedBy=dev-phone.device
#!/bin/bash
# /home/pi/relay-sms.sh
#/usr/bin/env >> /home/pi/log.txt
if [[ $DECODED_PARTS -gt 0 ]]; then
for i in `seq $DECODED_PARTS`; do
number="SMS_1_NUMBER"
text="DECODED_${i}_TEXT"
eval "gammu-smsd-inject TEXT +337xxxxxxxx -text \"${!number}: ${!text}\" -autolen 1000"
done
else
for i in `seq $SMS_MESSAGES`; do
number="SMS_${i}_NUMBER"
text="SMS_${i}_TEXT"
eval "gammu-smsd-inject TEXT +337xxxxxxxx -text \"${!number}: ${!text}\" -autolen 200"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment