Python SMS backend

The Python SMS backend for submitting data to the inbox or the appropriate table in the DB of SahanaPy based on the received SMS.

Current Status

  • Can interface with most GSM modems and supporting mobile phones.
  • Recognizes and places the received SMS into the appropriate table in the DB (if submitted via the J2MEclient) or the inbox of SahanaPy

TODO

  • Add authentication support to the xforms/post in SahanaPy.
  • Integrate the application to launch from within SahanaPy & hence not need to redefine Table definitions
    • Ideally launch from cron via @reboot
    • Until that's working can run as: python web2py.py -S sahana -M -R applications/sahana/cron/SMSDaemon.py
  • Access Configuration via Webservices
  • Post incoming SMS to InBox via Webservices (ideally using HTTP PUT, but can also use GET /create?format=json)
  • Add support for Sahana PHP

User Guide

  1. Install Python2.5, pywin32 for windows and pyserial
  2. Obtain the code by executing bzr branch lp:~lifeeth/sahana/mobile
  3. To run the code you will need a GSM modem or phone with an AT command set.
  4. Connect the modem or phone to your computer and note the name of the serial port it connects to.
    • On linux it is typically /dev/ttyUSB0 if you use a USB to Serial for connectivity.
    • On windows you can check for the ports in the control panel, COM xx.
  5. Select the Baud rate of your device → If the baud rate is not explicitly mentioned the defaults mentioned are sufficient.
  6. If you are using the Sqlite db for Sahana Eden development point the Database location the .db else copy the database string from SahanaPy.
  7. Choose the number of modems and replicate the Modem sections as shown below.
  8. Run the code by executing ( Keep the window open):
  python SMSDaemon.py

An example of the modems.cfg configuration file is given below.

[Main]
Modems = 1
Branch = py
Database = sqlite:///home/praneeth/work/sahana/gsoc/web2py/devel/applications/sahana/databases/storage.db
Debug = 4
PostURL = http://j2me.sahanapy.org/sahana/xforms/post
 
[Modem1]
Port = /dev/ttyUSB0
BaudRate = 115200

Navigation
  • Navigate