Posts Tagged ‘gsm’

HOWTO: SMS Gateway with Nokia 6230i GSM

Thursday, December 27th, 2007

This howto will guide you to build a SMS gateway with Nokia 6230i on Linux machine (Tested on Debian etch).

Hardware  requirements:

DKU2 cable (Nokia cable which connects the phone to machine’s USB port)

GSM Nokia 6230i

Linux box with USB interface (Debian prefered :)

There are many tools for sms under linux, I tested the Gnokii (Nokia unique tool) and sms-tools v3. Found that sms-tools much more professional and faster.

Connect your phone to the AC power (the DKU2 cable doesn’t charge the phone) and to the machine using the cable.

When you type ‘lsusb’ you should see:

chiq:~/smstools3/scripts# lsusb
Bus 003 Device 015: ID 148f:2573 Ralink Technology, Corp.
Bus 003 Device 001: ID 0000:0000 
Bus 002 Device 002: ID 045e:009d Microsoft Corp.
Bus 002 Device 001: ID 0000:0000 
Bus 001 Device 017: ID 0421:0428 Nokia Mobile Phones
Bus 001 Device 001: ID 0000:0000 

Now the DKU2 cable connects the serial port of the phone to the USB interface, you can access the phone using the serial protocol or the usb protocol. To access using the usb, you need to load gnokii nokia usb module which works slower than the serial way. When using serial connection the GSM AT commands sent directly to the phone and it works better and faster.

You should see /dev/ttyACM0 device, its your emulated serial device.

 

If you don’t check ‘lsmod’ if you have this modules loaded:

usbcore               112644  7 usbserial,cdc_acm,rt73,usbhid,ehci_hcd,ohci_hcd

 

 If you do, you can use the SMS-TOOLs v2/3 to operate the phone. (On the sms-tools site the Nokia 6230/i is not in the supported phones list but when you use it in serial connection it doesn’t metter at all which phone type you have because it sends plain AT commands to the GSM modem).

Download the sms-tools v3 from http://smstools3.kekekasvi.com/ at http://smstools3.kekekasvi.com/packages/smstools3-3.0.10.tar.gz

tar xvfz smstools3-3.0.10.tar.gz

cd smstools3

make

make install

it will create simple smsd.conf in /etc/smsd.conf

edit the device parameter, put /dev/ttyACM0 there, should look like this:

# Example smsd.conf. Read the manual for a description

devices = GSM1
logfile = /var/log/smsd.log
loglevel = 7

[GSM1]
device = /dev/ttyACM0
incoming = yes
#pin = 1111

 

Now start the smsd daemon /etc/init.d/sms3 start

check the log file: tail -f /var/log/smsd.log

should look like that:

2007-12-27 21:04:47,7, GSM1: <- 425010502703950
OK
2007-12-27 21:04:47,6, GSM1: IMSI: 425010502703950
2007-12-27 21:04:47,6, GSM1: Checking memory size
2007-12-27 21:04:47,7, GSM1: -> AT+CPMS?
2007-12-27 21:04:47,7, GSM1: Command is sent, waiting for the answer
2007-12-27 21:04:47,7, GSM1: <- +CPMS: "SM",0,20,"SM",0,20,"MT",150,170
OK
2007-12-27 21:04:47,6, GSM1: Used memory is 0 of 20
2007-12-27 21:04:47,6, GSM1: No SMS received

 

The sms-tools use spool files, all incoming sms messages are stored at:

/var/spool/sms/incoming/

To send a message you can use the tool that comes with the sms-tools.

cd smstools3 (the untared directory of the source)

cd scripts

the tool called sendsms.

What the script does is creating a temp file in the outgoing folder of the spool which looks like this:

To: 491721234567

Hello, this is the sms.

 

You can create flash SMS messages too:

From: Stefan
To: 491721234567
Flash: yes
Alphabet: ISO

Hello Stefan, how are you?

 

More information about SMS file format here:

http://smstools3.kekekasvi.com/index.php?p=fileformat