OpenWrt Forum Archive

Topic: SMStools compiled for Barrier Breaker

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I've successfully compiled SMStools (http://smstools3.kekekasvi.com) for Barrier Breaker.
I believe it would be quite beneficial for the OpenWRT Community to include it in the available packages.

I'm not a professional coder (actually I spent quite some time doing cut n' paste from the Internet in order to get it working) so I'm not familiar with the process of adding packages to a development tree.

I'm available to share everything (Makefile, patches, code, directory structure, etc.) with anyone that would know how to add it correctly to the repositories.

Just reply me back.

Thanks
Jabss

(Last edited by jabss on 6 Oct 2014, 22:11)

Looks interesting smile

Maybe a friend of mine would be interested in this, his name is Dairyman.

As you can see we have already setup SMS to work with openwrt and we have been working on a new them (new look) for Luci also. We have not set SMS up as a package but rather Dairyman has programmed the sms tool into the openwrt scripts.

We have had this running for some 6 months now i guess, Cobia recently created a tool to create packages and so now our ROOTER firmware scripts can be included as a package for compilation into the final image. Im not sure if Dairyman would be interested in a standalone sms package but I am sure many other would as it allows more customisation.

Have a look at this photo of my setup in Luci:

http://s10.postimg.org/hglnjcy21/sms.jpg

Here is our somewhat dated website:

http://ofmodemsandmen.com/

O just so you know we are in no way Openwrt developers. Just a bunch of farmers.

Hi Jabss,

would you mind sharing what you have? I was just about to start doing exactly the same thing when I found this post smile

Cheers,
Jens

I'm also really interested in integrating the SMS tools on my custom Openwrt build for Alix.  Can you share?
You might be interested that I am working to get FrontlineSMS running (which needs a working 1.6 jvm) on Barrier Breaker (on x86 for now, but probably on Pi to with Arm based jvm).   I'm happy to share this work too once it's working wink

Hello,

I can share the build folder with a working structure so you can build on your own binary.
(I think it's always preferable to get a build structure rather than having just the binary because of security reasons - you never know what is compiled within).

I'll put everything in a tar file and share it temporarily somewhere in the net. Stay tuned.

Will you then be knowlegeable enough to add it to the openwrt repository so everybody could benefit of it?

Cheers,
Jabss

Hello,

As promised,here you have a guide that shows:

How to compile SMStools3 for OpenWRT - Tested with Barrier Breaker

1) Create a build root environment as described here: http://wiki.openwrt.org/doc/howto/buildroot.exigence
     I used a Ubuntu PC to do it

2)  Extract this file to the package/utils directory. The Makefiles and the directory structure is the correct one.
     After this, you should have the following directory structure:

xxx@xxx:(your-build-root-path)$ ls -R
.:
files Makefile package.sh patches src

./files:
examples scripts

./files/examples:
language-ISO-8859-15.fi operator_logo1.sms README received_sms.sms send_sms_unicode.sms smsd.conf.full smsd.conf.non-root
language-UTF-8.fi operator_logo2.sms received_report.sms send_sms.sms smsd.conf.easy smsd.conf.net

./files/scripts:
callhandler email2sms eventhandler-utf-8 hex2bin load_balancing.sh pkill regular_run sms2html sms2xml smsevent smstest.php unicode2sms
checkhandler-utf-8 eventhandler_report forwardsms hex2dec mysmsd README sendsms sms2unicode sms3 smsresend sql_demo

./patches:
001-smsd.patch 010-makefile.patch

./src:
alarm.c blacklist.c cfgfile.c charset.c extras.c locking.c logging.c Makefile modeminit.h pdu.h smsd_cfg.c stats.c version.h whitelist.h
alarm.h blacklist.h cfgfile.h charset.h extras.h locking.h logging.h modeminit.c pdu.c smsd.c smsd_cfg.h stats.h whitelist.c

3) Go to the builroot root directory and run make menuconfig. You'll find the smstools3 option under utilities. Select it, and exit menuconfig.
    Note that you may also need to select the correct architecture for your router. My router is a TL-WR1043N/ND so I had to select ar71xx in "make menuconfig".

4) Run make, and wait for some time (hours) to have all of it compiled.
5)You should find the installation package here: (your-build-root-path)/openwrt/bin/ar71xx/packages/base/smstools3_3.1.15-2_ar71xx.ipk
If you didn't want/weren't able to compile and trust pre-compiled binaries (I won't advise it) here you have the compiled installation file ready to install on a TL-1043ND

6) Copy this file to your router and install it with "opkg install smstools3_3.1.15-2_ar71xx.ipk"
I realised that running SMSTools3 as daemon was having some problems creating the log directories, and therefore fails to start, but if created  manually it works.
Because of this, I created a workaround that works fine:

7) Create a file named /bin/smstools_wrapper and copy the code below to it:

#!/bin/sh
#Wrapper - creates the directories and log files before starting
# as it seems they arent saved during reboots
mkdir /var/log/smsd_stats
mkdir /var/spool/sms
mkdir /var/spool/sms/outgoing
mkdir /var/spool/sms/failed
mkdir /var/spool/sms/incoming
mkdir /var/spool/sms/checked
mkdir /var/spool/sms/sent
mkdir /var/run/smstools
#calls smsd
/usr/bin/smsd

8) In order to have it started automatically add "/bin/smstools_wrapper" to the file /etc/rc.local

And that's it! After these steps you should have a SMSTools3 daemon running in your OpenWRT router.

Note that you'll need to fill in the configuration file in order to match your SMS device, like you would do in any other linux box.
I add my config file just for reference.  It works on an Huawei USB stick.

root@Mojito:~# cat /etc/smsd.conf | grep -v "#"
devices = GSM1
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/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/smsd_stats
receive_before_send = no
autosplit = 3
eventhandler = /bin/sms-received

[GSM1]
device = /dev/ttyUSB1
incoming = yes
baudrate = 9600

Can anyone be able to add this to the OpenWRT repositories so everyone could benefit from it?

Thanks and good luck!
Jabss

(Last edited by jabss on 8 Nov 2014, 20:19)

Thanks Jabss,

Great Job!

mantabs

Jabbs, I try to compile using your tutorial but failed. I am using Attitude Adjustment. Is there any correction should be made in the makefile ?

updated, fixed and proposed upsream.
see : https://github.com/openwrt/packages/pull/694

Tested successfull as an email/sms gateway with :
- Device: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
- Trunk: OpenWrt Chaos Calmer r43753
- Kirkwood : Globalscale Technologies Guruplug Server Plus

Send and receive SMS with modem : OK
Forward received SMS to mailhub : OK

jabss great job with the instructions and preparing the source

/usr/bin/sendsms did not work for me (could not find bash and after changing to sh I was getting seg faults)

But doing  printf "To: 38611111111\n\nHello world!" > /var/spool/sms/outgoing/some_random_name worked fine.

(Last edited by pingo on 28 May 2015, 09:20)

The discussion might have continued from here.