|
Installing configuring Gnokii on Linux
Gnokii provides tools and a user space driver for use with mobile phones under various operating systems (most testing is done under Linux but also Solaris, *BSD family and MS Windows families are known to work. Using Gnokii one can send/receive SMS, phonebook, call management and others.
Installation from rpm manager (yum)
Gnokii package is available via most of Linux distro repository, on Fedora 10 the below will install the gnokii package if not then do the installation from source.
yum install gnokii
Installing from Source:
1. Download the gnokii source download.
2. Untar the source and change (cd) to gnokii source directory
Run...
./configure (to configure)
make (to compile)
make install (to install the binaries)
Copy the example config file for gnokii from the Docs/sample/ directory to
your home directory:
$ cp Docs/sample/gnokiirc ~/.gnokiirc
If you copied the .gnokiirc file to your home directory (not root) then do not forget to add your shell user account to uucp otherwise you wouldn't able to use gnokii due to permission problem on serial device you setup in .gnokiirc file.
$ groups
askar wheel uucp
I have tested Gnokii with my Motorola L6/L7 cell phones check gnokii.org whether your phone is supported or not. (Tip. use gnokii --identify to verify your phone is supported)
Configuration.
Gnokii uses gnokiirc file for all this configuration, if gnokii has been installed via package manager then most probably it may have installed a /etc/gnokiirc file, the settings in this file will be used in the absence of a .gnokiirc file in your home directory.
Below is the minimum setting we need.
[global]
port = /dev/ttyACM0 # Set to port on which your phone is connect Tip: check /var/log/messages ]
model = AT
initlength = default
connection = serial
use_locking = no
serial_baudrate = 19200
smsc_timeout = 10
[xgnokii]
allow_breakage = 0
[gnokiid]
bindir = /usr/sbin/
#[connect_script]
#TELEPHONE = 12345678
[disconnect_script]
[logging]
debug = off # Turn it on for debugging
rlpdebug = off
xdebug = off
|
While phone is connected and /etc/gnokiirc or .gnokiirc has been setup properly.
2. Check if you phone has been recognize by gnokii.
If your phone is connected and gnokii supported then you will see something like this
GNOKII Version 0.6.27
IMEI : IMEI359411000810925
Manufacturer : Motorola CE, Copyright 2000
Model : GSM900","GSM1800","GSM1900","GS
Product name : GSM900","GSM1800","GSM1900","GS
Revision : R4513_G_08.B7.DCR_R
|
This is what I get for my Motorola L7 connected with via USB cable with my laptop running Fedora 10.
Note: During testing use 'root' account or you will need read/write permissions on whatever serial port you specify in /etc/gnokiirc or .gnokiirc file.
Using Gnokii
All the below information and more can be found here.
Backup & Restoration of phonebook on phone SM card using gnokii
Backup
|
gnokii --getphonebook SM 1 end --vcard > myphonebook.vcf
|
Restore
|
gnokii --writephonebook --vcard < myphonebook.vcf
|
Handling calls
To dial a voice call
|
gnokii --dialvoice +9212345678
|
SMS Sending and Receiving
Use smsd if you need both to send and to receive SMS. You can use it with a file or a database backend.
If you only need to send, you can also use gnokii --sendsms, which reads message body from stdin.
|
echo "This is a test message" | gnokii --sendsms +12345678
|
OR
gnokii --sendsms +12345678
type your text and press
Ctrl+d to exit.
|
You can also use the utils/sendsms bash script that uses a text based interface using dialog as a more friendly frontend to gnokii --sendsms, allowing you to pick recipient numbers from your phonebooks instead of typing them on the command line.
In my next article you can learn how to use Gnokii + Nagios for sending SMS Notifications from Nagios whenever there is problem with any of the monitored host/service
|