Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Friday, July 31, 2009

Gammu SMS Gateway

Writer Using

  1. HP SE K790i
  2. OS Ubuntu 9.04

Install Step By step

1.Install gammu

$sudo apt-get install gammu

$locate smsdrc

$cp /usr/share/doc/gammu/examples/config/* .

$gunzip smsdrc .gz gammurc.gz

$sudo cp smsdrc gammurc /etc

$sudo vim /etc/gammurc

#change this line

[gammu]

port = /dev/ttyACM0
connection = at19200

; Do not use model configuration unless you really need it
;model = 6110
;synchronizetime = yes
;logfile = gammulog
;logformat = textall
;use_locking = yes
;gammuloc = locfile
;startinfo = yes
;gammucoding = utf8
;usephonedb = yes

#save

$gammu --configure

Manufacturer : Sony Ericsson
Model : K790i/K790c (AAF-1022011-BV)
Firmware : R8BF003 080130 2133 CXC1250481_CHINA_EV
IMEI : 352206010781695
Product code : AAF-1022011-BV
SIM IMSI : 510219160664064

$echo "tes sms server" | gammu --sendsms TEXT 085691662771

If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..OK, message reference=203

test sms server will send to destination number.

2.Connect to Database mysql

$gunzip mysql.gz

$mysql -uroot -pyourpassword

Your MySQL connection id is 81
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database smsserver;
Query OK, 1 row affected (0.03 sec)

mysql> exit
Bye

$mysql -uroot -pyourpassword smsserver <>

SMS Database has been imported now.

$sudo vim /etc/smsdrc

# ----------------- SETTINGS FOR --smsd MYSQL or --smsd PGSQL -------------------
user = root
password = yourpassword
pc = localhost
# pc can also contain port or socket path after colon (eg. localhost:/path/to/socket)
database = smsserver

$wget http://www.syednetworks.com/gammu-sms-gateway.zip

$unzip gammu-sms-gateway.zip

$sudo mv gammu-sms-gateway/* /var/www/gammu

$sudo chmod -R 777 /var/www/sms

Edit your sms.php on /var/www/sms

mysql_connect("localhost", "root", "yourpassword") or die(mysql_error()); //connect to mysql
mysql_select_db("smsserver") or die(mysql_error()); //select database

Run SMS gateway and it will take all of your inbox(all inbox will remove to database).

$gammu –smsd MYSQL smsdrc

Note:

Untuk mengirim sms dari aplikasi anda harus:

menambah permission /dev/ttyACM0

$sudo chmod o+rw /dev/ttyACM0

change this line on send-sms.php

        $destination = getPostVariable( 'destination' );
$message = getPostVariable( 'message' );
exec( '/usr/bin/gammu --sendsms EMS ' . escapeshellarg( $destination ) . ' -text ' . escapeshellarg( $message ) ); // try this one
//system( sprintf( '/usr/local/bin/gammu --sendsms EMS %s -text %s', escapeshellarg( $destination ), escapeshellarg( $message ) ) );
header( 'Location: ' . $_SERVER[ 'PHP_SELF' ] . '?accepted=yes' );
exit();

then send sms by aplication

3.Make SMS AutoRespond

run gammu sms-gateway

$gammu –smsd MYSQL smsdrc

make trigger in database smsserver

create trigger
smsserver.autorespond1
AFTER
INSERT
on
smsserver.inbox
for each row begin
if(New.TextDecoded = "REG COBA")
THEN
insert into outbox(DestinationNumber,
TextDecoded,Coding,CreatorID)values(New.SenderNumber,"Terima Kasih",'Default_No_Compression','1');
end if;
end

Send REG COBA to your phone no,
then you'll retreive sms

"Terima Kasih"

End Of the Game

Make iso from cd or dvd rom with Ubuntu

to make iso just write this on your console:

sudo dd if=/dev/cdrom of=/home/mydir/Desktop/filename.iso

and to mount iso to you cdrom:

1) Create the directory aka mount point:

# sudo mkdir -p /mnt/disk

password: "your password"

2) Use mount command as follows (assumes that your ISO file name is disk1.iso):

#sudo mount -o loop disk1.iso /mnt/disk

3) Change directory to list it:

# cd /mnt/disk
# ls -l

then your iso will become files on your cdrom