Wednesday, March 11, 2009

Setting up gammu with smsd

Gammu is the most popular program to build customized sms  server. It can connect to various of handset, from the oldest model until recently launched model.  Also it support populars os(es) such as Microsoft Windows and Linux Ubuntu. 


To setup gammu under windows simply download win32 binary from gammu site. For Ubuntu, even easier.

$ sudo apt-install gammu

That's all.

Once installed try edit gammurc (gammu config files). Windows version, config file will be in same folder as gammu.exe. For Ubuntu version, the config file is in /etc. Edit where needed.
My working setting is :


[gammu]

port = /dev/ttyS1
;model = 6110
connection = at19200
;synchronizetime = yes
logfile = /home/says/gammulog
logformat = textall
;use_locking = yes
;gammuloc = locfile
;startinfo = yes
;gammucoding = utf8
;rsslevel = teststable
;usephonedb = yes


To test out :

$ gammu --identify


On success connection it should display our gsm modem properties.

Manufacturer : Nokia
Model : 6150 (NSM-1)
Firmware : 4.12 E (02-12-98)
Hardware : 2320
IMEI : 493002107068660
Original IMEI : 493002107068660
Manufactured : 1298
Product code : 0502690
Simlock 1 : MCC+MNC 00101, opened, factory, counter 0
Simlock 2 : GID1 0000, opened, factory, counter 0
Simlock 3 : GID2 0000, opened, factory, counter 0
Simlock 4 : MSIN 0000000001, opened, factory, counter 0
MSID : 823c21bb67cc5d6aab0f3caae6
MCU checksum : 4057
DSP ROM : 4


Next is configure smsd engine. Create a smsd config file. Ussually named smsdrc. Edit where needed. Put the file in same folder as we running Gammu. I strongly recommend using files style, as you can easily to customize the system.

[smsd]
PIN = 327426
logfile = /home/says/sms/logs/smsdlog
commtimeout = 10
sendtimeout = 20
#receivefrequency = 0
#resetfrequency = 0
deliveryreport = log
phoneid = mdsms

inboxpath = /home/says/sms/inbox/
outboxpath = /home/says/sms/outbox/
sentsmspath = /home/says/sms/sent/
errorsmspath = /home/says/sms/error/
inboxformat = standard
transmitformat = auto

The main part of the system just to read incoming sms save it to /inbox, send any message that we put in /outbox. Next gammu smsd able to do the rest.

Next, create an agent just to read message source to be send out, and retrieve incoming msg in inbox to store in your database. last thing is create nice fancy interface, of course dont forget the user authentication. Then hola, your own sms server is ready to serve.


Download : php agent to read & delete files

9 comments:

Anonymous said...

gammu supports msg saving to db.

gammu smsd MYSQL ~/.smsdrc

Anonymous said...

sure, gammu has capability of story direct to MySQL. But by using file, we can freely design our logic, including keyword-based reply, using any database as storage, having our own database structure. And most important, for high traffic, file storage proven minimize lossing of msg when system crash.
Do you agree with me?

Shoaib Hussain said...

i have nokia 5230, its sending sms from outbox table, but there is no any sms received in inbox table

says said...

Are you sure any message in your phone Inbox ?

Addressing direct storage to MySQL, I'd prefer to use my own function to store to MySQL as I can add any field I need, as well as alter business flow.

Unknown said...

I am having the same problem as Shoaib. I am using a telstra z90. Initially it worked fine but has now sotopped reading the incoming texts. It will happily send from the outbox but will not add new texts to the inbox. The log on the server shows that it is polling the phone OK.
Dennis Howe

Ehsan-ul-haq said...

hi

i have Sony ericsson K790i i install gammu when i try to run gammu --identify
i get error

I/O Possible

can you help to find out the solution

thanks

Werner said...

Hi

The dispatch_sms.tar.gz file cannot be downloaded anymore.

Will you please make it accessible again, so I can download it as look at the source?

Thank you!

kangni said...

Hi I need help for my addictions gammu configuration I have a samsung Galaxy S GT-I9000 I can't access my sim contacts and I also connected a mysql for the simultaneous distribution of sms database

kangni said...

Hi I need help for my addictions gammu configuration I have a samsung Galaxy S GT-I9000 I can't access my sim contacts and I also connected a mysql for the simultaneous distribution of sms database