Sending SMS with cellphone on linux : gnokii

A place for discussion of topics that are not specific to ZoneMinder. This could include Linux, Video4Linux, CCTV cameras or any other topic.
Post Reply
ktheking
Posts: 70
Joined: Fri Oct 12, 2007 11:53 am

Sending SMS with cellphone on linux : gnokii

Post by ktheking »

Gnokii is highly configurable and broadly used. Chances that you get your cell phone to send sms is very high. All works from command line ,thus can be integrated in scripts to get stuff send trough SMS.

WATCH IT : Depending on the model,this connection setup will probably change. But with a bit of googling around ,you'll get your cellphone quickly up and and running. For more on connectivity check the gnokii site : http://www.gnokii.org/cables.shtml
example with nokia 6300 : http://graemehunter.co.uk/2007/05/linki ... to-ubuntu/

I got mine to work : Nokia E50 (S60 symbian based)

OS : Ubuntu Gutsy 7.10 - alternate version
Cabling : Standard USB cable used to check the connection.
Phone mode : Data Suite (is asked on the phone when connecting cable)
OS phone version : V 2.26.01

I followed these guidelines :

Installing gnokii
sudo apt-get install gnokii

Testing USB connectivity : using wvdial
http://ubuntuforums.org/showthread.php? ... kii&page=2

This enabled me to see if connectivity was real,working and on what port.

First install wvdial

Code: Select all

sudo apt-get install wvdial

Code: Select all

    root@ubuntu:~# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 003: ID 0421:04c9 Nokia Mobile Phones
Bus 001 Device 001: ID 0000:0000


sudo /sbin/modprobe usbserial vendor=0×421 product=0×4c9

wvdialconf create


root@ubuntu:~# wvdialconf create
Editing `create'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0   S1   S2   S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM0<*1>: Modem Identifier: ATI -- Nokia
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Speed 9600: AT -- OK
ttyACM0<*1>: Speed 19200: AT -- OK
ttyACM0<*1>: Speed 38400: AT -- OK
ttyACM0<*1>: Speed 57600: AT -- OK
ttyACM0<*1>: Speed 115200: AT -- OK
ttyACM0<*1>: Speed 230400: AT -- OK
ttyACM0<*1>: Speed 460800: AT -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found an USB modem on /dev/ttyACM0.
create<Warn>: Can't open 'create' for reading: No such file or directory
create<Warn>: ...starting with blank configuration.
Modem configuration written to create.
ttyACM0<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
    
Configuring the gnokii config file : /etc/gnokiirc
http://dt.in.th/
Posted on January 2nd, 2008 at 1:09pm by the DtTvB

This post is about sending SMS from Linux. This time it needs some devices connected to your computer, which is... your mobile phone!

I have an E50, which, is Symbian, along with DKU-2 cable, connected to my laptop running Ubuntu 7.10.

Now, the program you need is: Gnokii. It is a program that can manage your mobile phone. You can use bluetooth also, but, my laptop doesn't has a Bluetooth. Uhhh, it was, but it is not working now. Both on Windows and Linux.

I ran this command on my laptop:

sudo apt-get install gnokii

And I got gnokii installed. The next thing you want to do is get your phone working. You should read gnokii's wiki and make a configuration file.

Here is mine (E50 connected via DKU2):

[global]
port = /dev/ttyACM0
connection = serial
model = AT

After I made a configuration file, I ran this command:

echo 'Hello World' | gnokii --config configfile --sendsms 089XXXXXXX

If it said Send succeeded! and you received your SMS, then it is working.

By getting your computer online all the day you can make your own SMS gateway! Using a bit PHP and shell scripts will make it possible. :P
For more gnokii commands : http://wiki.gnokii.org/index.php/User's_Guide


An interesting command as well : gnokii --identify

Code: Select all

root@ubuntu:~# gnokii --identify
GNOKII Version 0.6.18
IMEI         : 35xxxxxxxxxxxxxx1
Manufacturer : Nokia
Model        : Nokia E50
Product name : Nokia E50
Revision     : V 2.26.01
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

And how did you manage to link this with ZoneMinder? What filter did you use?
v1.25.0 + Ubuntu Linux 12.04 Server
ktheking
Posts: 70
Joined: Fri Oct 12, 2007 11:53 am

Post by ktheking »

Discovered a better one : gammu !

More activity on the development scene ,and more different phones supported.

If it doesn't work with gnokii ,try with gammu

apt-get install gammu

or install it from source

wget http://archive.ubuntu.com/ubuntu/pool/u ... rig.tar.gz
Beofres
Posts: 32
Joined: Tue Jun 19, 2007 6:53 pm
Location: North-Bay , California

Post by Beofres »

I forget how to implement it, but when researching SMS over various carriers, I found that some providers provide the ability to send short (less than 300 character) emails to cellphones, which get translated into SMS messages. For instance, with T-Mobile, every T-Mobile subscriber can recieve email by simply putting their phone number @ tmomail.net (Example:860xxxxxxx@tmomail.net)

For a much more crude notification system, a script could be called by a filter to issue AT commands to a modem that would send a page to the cellphone, coded in a manner to let you know what's up. Example: Camera 5 (Lobby) goes off in the middle of the night. The script calls T-Mobile's voicemail system. The voicemail system prompts you to input a subscribers number (the person whom you wish the page is for) followed by #. Then, it asks if you want to leave a voicemail (no!) or press 5 to page the person. You are then prompted to leave a callback number. This callback number could be a code to notify the user which camera went off. All this could be automated via a script executed by a filter.
ktheking
Posts: 70
Joined: Fri Oct 12, 2007 11:53 am

Post by ktheking »

@Beofres : Yes , I'm aware of the ability to send SMS trough mailproxy. Some of them are 'free' from your provider ,but most of them need to be paid. But the downside is ,that you have to be able to rely on a connected cellphone in case internet connection goes down. There is more chance of the connection goiing down ,then on the unavailability of the cellphone network.

The gnokii and gammu way provide a cheap possibility of sending emergency text messages ,from systems who are already running on UPS.
ghassen
Posts: 2
Joined: Thu Jun 17, 2010 12:55 pm

Post by ghassen »

please can someone help me?? if i create a script that allow me to send sms.where i can put it in zoneminder.to make it work when an alarm is occure.thx
devlista
Posts: 9
Joined: Sun Jul 04, 2010 12:35 pm

Curl, wget and lynx

Post by devlista »

can be useful in that situation on firewalled systems. Because almost all systems allow outbound port 80 requests. You can use lynx, for example, to request a page and put the outbound data you need in the request headers.

Push rather than pull. Then send the actual email from another machine, outside.
Post Reply