How To Install A Raspberry Pi SMS Server
How To Install A Raspberry Pi SMS Server
How To Install A Raspberry Pi SMS Server
Tutorial search
Ad Flatfile is a JavaScript data importer that integrates into any app, instantly improving the import experience
for customers.
On this page
How to
install a Before we start
Raspbian
Raspberry Pi PlaySMS
Gateway - SMS Server Tools 3
SMS Server Login and configure smstools in playsms webpanel
Send an SMS
Before we start
This tutorial will show you how you can set up an SMS server on a Raspberry Pi 2
Model B, running Raspbian.
We will use playsms and smstools. In my example, I have used a Huawei E3131
3G modem.
Raspbian
First we need to download raspbian, you can grab the latest version
at https://www.raspberrypi.org/downloads/
unzip 2015-05-05-raspbian-wheezy.zip
You will get a file named 2015-05-05-raspbian-wheezy.img, this file must
be written to your micro-sd card.
If you need to know some basics on how to work with raspberry pi, and writing the
image to micro-sd, you could start with reading this tutorial:
https://www.howtoforge.com/tutorial/howto-install-raspbian-on-raspberry-pi/
When the image is written, insert the micro-sd card into your Raspberry Pi, and
turn it on.
When the Raspberry Pi is booted, you should see a screen like this, on first startup.
1 Expand Filesystem
3 Enable Boot To Desktop/Scratch -> Select Console Text Console, requiring login
(default)
8 Advanced Options -> A4 SSH -> Enable
8 Advanced Options -> A0 Update
Finish -> Reboot
Now you can login with following username: pi and password: raspberry.
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.255.50.30
netmask 255.255.255.0
gateway 10.255.50.1
dns-nameservers 8.8.8.8 8.8.4.4
sudo -s
apt-get install apache2 libapache2-mod-php5 mysql-server php5 php5-cli php5-my
sql php5-mcrypt php5-gd php5-imap php5-curl
php5enmod mcrypt
service apache2 restart
When asked for the new password for the MySQL "root" user, use a strong
password, in this example I have used MyP@$$w0rd
Now we can go to http://your-ip, in my case http://10.255.50.30 ,and we will see a
page showing: "It Works!".
cd /tmp/
wget http://downloads.sourceforge.net/project/playsms/playsms/Version%201.1/p
laysms-1.1.tar.gz
tar -zxf playsms-1.1.tar.gz -C /usr/local/src
ls -l /usr/local/src/
cd /usr/local/src/playsms-1.1/
cp install.conf.dist install.conf
nano install.conf
Copy install.conf.dist to install.conf and edit install.conf
# INSTALL DATA
# ============
# Please do not change variable name, you may change only the value
Now Run:
./install-playsms.sh
Press Y if everything looks OK.
Now we want to make sure playsms starts on boot by adding a line into rc.local
file.
nano /etc/init.d/rc.local
Add following to the file: /usr/local/bin/playsmsd start
on the bottom of the file (before exit if there's an exit command).
This way playsmsd will start automatically on boot.
..
/usr/local/bin/playsmsd start
nano /etc/apache2/sites-available/default
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/playsms
Options FollowSymLinks
AllowOverride None
ErrorLog ${APACHE_LOG_DIR}/error.log
username: admin
password: admin
Now I have plugged in the Huawei E3131 modem, and I can see it listed with
lsusb:
lsusb
lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 12d1:14fe Huawei Technologies Co., Ltd.
We would like it to be with ID: 12d1:1506, but it's detected with 12d1:14fe right
now.
To change this, we install usb_modeswitch to the system, you can grab the latest
version from here:
http://www.draisberghof.de/usb_modeswitch/#download
cd /tmp
wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-2.2.5.tar.bz2
tar jxvf usb-modeswitch-2.2.5.tar.bz2
cd usb-modeswitch-2.2.5
make install
cd /tmp
wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-2015062
7.tar.bz2
tar xjvf usb-modeswitch-data-20150627.tar.bz2
cd usb-modeswitch-data-20150627
make install
Now unplug the modem, and plug it in again, then run:
lsusb
lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 006: ID 12d1:1506 Huawei Technologies Co., Ltd. E398
LTE/UMTS/GSM Modem/Networkcard
cd /usr/local/src
wget http://smstools3.kekekasvi.com/packages/smstools3-3.1.15.tar.gz
tar -zxvf smstools3-3.1.15.tar.gz
cd smstools3
make
If you see an error like in my case, when you run make:
make
cd src && make -
make[1]: Entering directory '/usr/local/src/smstools3/src'
Makefile:51: *** recipe commences before first target. Stop.
make[1]: Leaving directory '/usr/local/src/smstools3/src'
Makefile:10: recipe for target 'compile' failed
make: *** [compile] Error 2
Then do following:
nano src/Makefile
And move the line override LFLAGS += -lsocket -lnsl with a TAB
make
make install
Now we create some required folders:
mkdir -p /var/log/sms/stats
mkdir -p /var/spool/sms/{checked,failed,incoming,outgoing,sent}
mkdir /var/spool/sms/modem1
chown www-data:www-data -R /var/spool/sms
chmod 777 -R /var/spool/sms
And then move the original configuration file and download a sample from
PlaySMS:
mv /etc/smsd.conf /etc/smsd.conf.dist
cd /tmp
wget -c https://raw.githubusercontent.com/antonraharja/playSMS/master/contrib/s
mstools/smsd.conf
cp smsd.conf /etc/
To make sure I always will use the correct device, I will use a dynamic device file.
touch /etc/udev/rules.d/ttyusb-map.sh
chmod 755 /etc/udev/rules.d/ttyusb-map.sh
nano /etc/udev/rules.d/ttyusb-map.sh
#!/usr/bin/perl -w
Now unplug, and replug your modem, and it should be located at /dev/gsm*:
ls -l /dev/gsm*
lrwxrwxrwx 1 root root 7 Jul 24 01:39 /dev/gsm1-1 -> ttyUSB0
lrwxrwxrwx 1 root root 7 Jul 24 01:39 /dev/gsmmodem -> ttyUSB0
# Global configuration
loglevel = 5
# logfiles
stats = /var/log/sms/stats
logfile = /var/log/sms/smsd.log
# do not set report folder, let status report files saved in incomin
g
#report = /var/spool/sms/report
delaytime = 2
errorsleeptime = 10
blocktime = 180
autosplit = 3
#receive_before_send = yes
incoming_utf8 = yes
# Queue configurations
[queues]
modem1 = /var/spool/sms/modem1
#modem2 = /var/spool/sms/modem2
# Modem configurations
/etc/init.d/sms3 restart
Verify if SMS Server Tools 3 is running:
ps ax | grep -v grep | grep smsd
Monitor SMS Server Tools 3 log file:
tail -f /var/log/smsd.log
Username is admin
Password is admin
Now you have to setup the SMSC, so please select the + sign at SMSTools.
You should fill in the SMSC Details like this, in receiver number write your modem
phone number.
When you are done click save.
Default sender ID
Default prefix or country code
And set Default SMSC to smstools, like shown on the image below.
Click save, we are ready to send first SMS.
Send an SMS
Write your cell phone number in Send To, and a message etc. Hello World! in
message field, and click send.
Incoming messages that are unhandled is kept in sandbox, you will this in Reports
=> Sandbox
And log if something doesn't is located in Reports => View log
If you have any trouble with your setup, a good place seek some help is playsms
forum.
https://forum.playsms.org/
Suggested articles
13 Comment(s)
Add comment
Name * Email *
p
Submit comment
I'm not a robot
reCAPTCHA
Privacy - Terms
Comments
By: Jc Reply
Can't make it to work. It works fine in a few minutes then it will not sync to the sms server
anymore. Help!
Hi,
First of all I really appreciate your time and effort that you put into creating this guide. Its truly
amazing. I am having an issue. When i try to install php5enmod package. i get error of "E:
Unable to locate package php5enmod". Can you please help in this regards. I did apt-get update
and upgrade but still it wasn't able to find the package. I am using raspbian jessie lite version on
RPi Model B.
What kind of service plan do you need or would you advise to take from your wireless provider?
Is this sending the SMS via data or just as a regular SMS?
@k7mm,
This requires a GSM modem, so it's sending regular SMS, just like your phone. I use a pre-
pay SIM card on a similar setup, I just add a few dollars to it every once in a while to keep it
active.
Thanks to your set by step guide I now have a fully fnctioning system on a Raspberry PI. Great
job!
By: Tomas Reply
Hi, where can i found MO/PO files, which can i may translate to czech language?
The same, sent a few sms and now dowsn't work. Can't send but everything is running.
By: al Reply
Hi,
Can we send ussd commande and catch response ?
Thanks
many, many, many problems, the forum does not help, the author is pouring commands that do
not help. I've found another project and it's simpler.
kremil... by not linking us to the better solution that you've found, you're the same thing
you're complaining about in this forum.
Sign up now!
Tutorial Info
Author: ressel
Tags: raspbian, server
The new standard for
importing data
Flatfile is a JavaScript data importer
that integrates into any app, instantly
improving the import experience for
customers.
Try it free
40.2k Followers
Popular Tutorials
Vim Basics
Xenforo skin by Xenfocus Contribute Contact Help Imprint and Legal Notice