kill modemmanger
killall /usr/sbin/ModemManager
grab minicom, connect to ttyUSB2 and then run the following:
AT+CMGF=1
AT+CNMI=2,2,0,0,0
then send yourself a message while your still attached to the port. you should see it come across plaintext.
Now if that works you can do the following
sudo over to root:
apt-get update
apt-get install smstools
edit /etc/default/smstools
change USER to root
delete /etc/smsd.conf
create a new /etc/smsd.conf with the following
#
# /etc/smsd.conf
#
# Description: Main configuration file for the smsd
#
devices = GSM1
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/smstools/smsd.log
infofile = /var/run/smstools/smsd.working
pidfile = /var/run/smstools/smsd.pid
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent
stats = /var/log/smstools/smsd_stats
loglevel = 7
delaytime = 10
#errorsleeptime = 10
#blocktime = 3600
#stats = /var/log/smsd_stats
#stats_interval = 3600
#stats_no_zeroes = no
#checkhandler = /usr/local/bin/smscheck
receive_before_send = no
# autosplit 0=no 1=yes 2=with text numbers 3=concatenated
autosplit = 3
# store_received_pdu 0=no, 1=unsupported, 2=unsupported and 8bit, 3=all
#store_received_pdu = 1
#validity = 255
#decode_unicode_text = no
#internal_combine = no
# You can specify here an external program that is started whenever an alarm occurs.
# alarmhandler = /path/to/an/alarmhandler/script
# Specifies what levels start an alarmhandler. You can use value between 2 and 5.
# alarmlevel = 4
# eventhandler = @EVENTHANDLER@
#blacklist = /etc/smstools/blacklist
#whitelist = /etc/smstools/whitelist
#[queues]
# Commented lines are examples for germany
# D1 = /var/spool/sms/D1
# D2 = /var/spool/sms/D2
# O2 = /var/spool/sms/O2
# EPLUS = /var/spool/sms/EPLUS
# QUAM = /var/sppol/sms/QUAM
# MOBILCOM = /var/spool/sms/MOBILCOM
#OTHER = /var/spool/sms/OTHER
#[provider]
# Commented lines are examples for germany
# D1 = 49160, 49170, 49171, 49175, 49151
# D2 = 491520, 49162, 49172, 49173, 49174
# O2 = 49176, 49179, 49159
# EPLUS = 49163, 49177, 49178, 49157
# QUAM = 49150
# MOBILCOM = 49156
#OTHER = 0,1,2,3,4,5,6,7,8,9
[GSM1]
device = /dev/ttyUSB2
init = AT+CMGF=1
init1 = AT+CNMI=2,2,0,0,0
incoming = yes
baudrate = 115200
eventhandler = /usr/bin/sms
#mode = new
rtscts = no
#mode = new
save that file
create a new file /usr/bin/sms
paste in the following.
#!/bin/bash
# $1 is the type of the event wich can be SENT, RECEIVED, FAILED or REPORT.
# $2 is the filename of the sms.
# $3 is the message id. Only used for SENT messages with status report.
if [ "$1" == "RECEIVED" ]; then
# read received SMS line by line
while IFS= read -r line || [ -n "$line" ]
do
if [ -z "${BODY+set}" ]; then
# variable BODY not defined
# separate key-value pairs
KEY=$(echo ${line} | cut -d':' -f1 )
VAL=$(echo ${line} | cut -d':' -f2- | cut -d' ' -f2- )
case "$KEY" in
From)
FROM="$VAL"
;;
Sent)
SENT="$VAL"
;;
Length)
# Data behind Lenght belong to body, so define BODY here
BODY="\n"
;;
esac
else
# append every body line
BODY="${BODY}${line}"
fi
done < $2
# If we got a body, then forward
if [ -n "${BODY}" ]; then
echo "=> forwarding SMS now"
DISPLAY=:0 sudo -u cpi notify-send "Sms From $FROM" "$BODY"
# rename file
mv $2 $2.forwarded
else
echo "no mail body found"
fi
# delete oldest *.forwarded files, but keep 5 files
cd /var/spool/sms/incoming
ls -1t *.mailed 2>/dev/null | tail -n +6 | xargs rm -f
fi
exit 0
save and run chmod +x /usr/bin/sms
create a new file called /usr/bin/sendsms
paste in:
#!/bin/bash
# This script send a text sms at the command line by creating
# a sms file in the outgoing queue.
# $1 is the destination phone number.
# $2 is the message text.
# If you leave $2 or both empty, the script will ask you.
# If you give more than 2 arguments, last is taken as a text and
# all other are taken as destination numbers.
# If a destination is asked, you can type multiple numbers
# delimited with spaces.
# Keys for example: "password" and "keke":
# KEYS="5f4dcc3b5aa765d61d8327deb882cf99 4a5ea11b030ec1cfbc8b9947fdf2c872 "
KEYS=""
# When creating keys, remember to use -n for echo:
# echo -n "key" | md5sum
smsd_group="smsd"
# Will need echo which accepts -n argument:
ECHO=echo
case `uname` in
SunOS)
ECHO=/usr/ucb/echo
;;
esac
if ! [ -z "$KEYS" ]; then
printf "Key: "
read KEY
if [ -z "$KEY" ]; then
echo "Key required, stopping."
exit 1
fi
KEY=`$ECHO -n "$KEY" | md5sum | awk '{print $1;}'`
if ! echo "$KEYS" | grep "$KEY" >/dev/null; then
echo "Incorrect key, stopping."
exit 1
fi
fi
DEST=$1
TEXT=$2
if [ -z "$DEST" ]; then
printf "Destination(s): "
read DEST
if [ -z "$DEST" ]; then
echo "No destination, stopping."
exit 1
fi
fi
if [ -z "$TEXT" ]; then
printf "Text: "
read TEXT
if [ -z "$TEXT" ]; then
echo "No text, stopping."
exit 1
fi
fi
if [ $# -gt 2 ]; then
n=$#
while [ $n -gt 1 ]; do
destinations="$destinations $1"
shift
n=`expr $n - 1`
done
TEXT=$1
else
destinations=$DEST
fi
echo "-- "
echo "Text: $TEXT"
ALPHABET=""
if which iconv > /dev/null 2>&1; then
if ! $ECHO -n "$TEXT" | iconv -t ISO-8859-15 >/dev/null 2>&1; then
ALPHABET="Alphabet: UCS"
fi
fi
group=""
if [ -f /etc/group ]; then
if grep $smsd_group: /etc/group >/dev/null; then
group=$smsd_group
fi
fi
for destination in $destinations
do
echo "To: $destination"
TMPFILE=`mktemp /tmp/smsd_XXXXXX`
$ECHO "To: $destination" >> $TMPFILE
[ -n "$ALPHABET" ] && $ECHO "$ALPHABET" >> $TMPFILE
$ECHO "" >> $TMPFILE
if [ -z "$ALPHABET" ]; then
$ECHO -n "$TEXT" >> $TMPFILE
else
$ECHO -n "$TEXT" | iconv -t UNICODEBIG >> $TMPFILE
fi
if [ "x$group" != x ]; then
chgrp $group $TMPFILE
fi
chmod 0660 $TMPFILE
FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
mv $TMPFILE $FILE
done
save and run chmod +x /usr/bin/sendsms
reboot.
if you dont have modemmanager disabled, youll need to kill it or this wont work
killall /usr/sbin/ModemManager
now when you get an sms, it should pop up in a little window on the desktop. you can change this to do whatever you want but I like it popping up.
to send you can just run sendsms 19992223333 “this is a text”