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


reference : http://bagoesseptian.blogspot.com/2009/07/gammu-sms-gateway.html

Share this

Related Posts

Previous
Next Post »