Friday, December 30, 2011

How to Setup smstools in debian

3G dongle is the only bandwidth service I have when i'm home. (If my neighbor didn't turn on his WIFI connection ). Due to heavy usage of mobile broadband, my 3g Dongle frequently get caught to service disruptions by exceeding the reserved data bundle, Most of the time I had to call 3G service provider to get the connection temporary to do an online payment.

Normally service provider send a SMS when reaching the reserved quota (Probably when reaching 75%). But as I can't use Mobile Partner software in linux, I always missed those SMSs, if I didn't connect my dongle in to a Windows powered machine (As I hardly use Windows OS, most of the time I was in trouble).

As a solution I installed and configured smstools to avoid this mess and getting alone without the Internet.

Install smstools
  1. sudo apt-get install smstools (Install smstools)
  2. dmesg | grep usb (get the device. ex: /dev/ttyUSB0)
  3. sudo vim /etc/smsd.conf (smstools config file)
  4. sudo /etc/init.d/smstools start (Start smstools after changing configurations)
  5. cd  /var/spool/sms/incoming (to see incoming sms)

Configuration  (/etc/smsd.conf)

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
receive_before_send = no
autosplit = 3

[GSM1]
device = /dev/ttyUSB0
incoming = yes
baudrate = 19200
memory_start = 1

If you configured the smstools properly you will get sms to  /var/spool/sms/incoming

Test your settings.
  1. Send a test sms to your 3G Dongle from a mobile phone
  2. then ls /var/spool/sms/incoming (if the dongle received the sms, you will see a file, name is slimier to GSM1.AuvV6s  )
  3. vim  /var/spool/sms/incoming/$filename to read the sms
Debug your setings
  1. sudo tail -f /var/log/smstools/smsd.log
Note: I didn't test sms sending through the 3G dongle as my service provider has blocked the facility.


No comments :