just some stuff

access to sms messages on a 3g dongle

29 Nov 2010

After a recent discussion in a pub i looked into how to access sms messages on the sim card on a 3G dongle. here are the first results after playing around with it for about 20 minutes this morning:

the reference here is Debian/GNU Linux squeeze and a Huawei e220 dongle, a common 3g dongle in the UK. so i sent a couple of messages to the number of my dongle. for my very first test i used "gammu":

apt-get install gammu

then creating a gammu config file

port = /dev/ttyUSB0
model =
connection = at
synchronizetime = yes
logfile =
logformat = nothing
use_locking =
gammuloc =

/dev/ttyUSB0 is the correct port, even if your dmesg output reports other weired stuff.

then i run gammu:

gammu -c ./gammurc backupsms outfile.txt

it seems it takes a while to set the modem into the correct mode of operation, as nothing happens for 10+ seconds or so, then

Delete each sms after backup? (yes/no/ALL/ONLY/NONE) no
Backup sms from folder "Inbox" (SIM)? (yes/no/ALL/ONLY/NONE) ALL
Backup sms from folder "Outbox" (SIM)? (yes/no/ALL/ONLY/NONE) YES (always)
Backup sms from folder "Inbox"? (yes/no/ALL/ONLY/NONE) YES (always)
Backup sms from folder "Outbox"? (yes/no/ALL/ONLY/NONE) YES (always)

and to my suprise, i found the following message format in my outfile.txt: ( i have hidden the tel numbers with xxx and the UIDs with nnn ;)

[SMSBackup010] ; Hello World SMSC = "+xxxxxxxxxxx" SMSCUnicode = nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn PDU = Deliver DateTime = 20101129T103422Z State = UnRead Number = "+xxxxxxxxxxx" NumberUnicode = nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn Name = "" NameUnicode = Text00 = nnnnnnnnnnnnnn Coding = Default Folder = 1 Length = 4 Class = -1 ReplySMSC = False RejectDuplicates = False ReplaceMessage = 0 MessageReference = 0

"Number" is the sender's mobile number, the rest should be easy to understand. i assume there is a way to run gammu without interaction ( or otherwise skript the dialogue. ) in any way, it should be straight forward to parse the outputfile and generate a nice view of the messages or move them into a database.