Sunday, 19 June 2011

Setting up SMS gateway using Gammu

Install Gammu and Gammu SMS Daemon by running the command
sudo apt-get install gammu gammu-smsd
Create a gammu configuration file /etc/gammurc, whose contents look like this
Test that the SMS functionality by sending a message like this
$ echo "Test message"|gammu sendsms TEXT <Phone Number>
Setting up the SMS Daemon
A prerequisite is that a MySQL server is installed (either local or remote). Create the necessary tables in the database by running the SQL statements in /usr/share/doc/gammu/examples/sql/mysql.sql.gz. Create a gammu-smsd configuration file /etc/gammu-smsdrc
port = /dev/ttyUSB0model =
connection = at19200
synchronizetime = yes
logfile =
logformat = nothing
use_locking =
gammuloc =

debuglevel = 255
logfile = smsd.log
Service = mysql
User = root
Password = <Password>
Database = smsd
Now test that the daemon is receiving the messages by sending an SMS to the number associated with the SIM in the modem. Verify that the message is written into the table named "Inbox". Similarly you can send a message out by creating a row in the "Outbox" table.

  • You can inject sms into the daemon from the command line with gammu-smsd-inject example:
    • echo "All your base are belong to us" | gammu-smsd-inject TEXT 123456
  • Gammu-smsd also supports other backends like txt files in a specified folder
  • To use SMSD as a daemon, you might want to use the init script which is shipped with Gammu in contrib/init directory. It is not installed by default, either install it manually or check INSTALL file for instructions.

Possibly Related Posts

No comments:

Post a Comment