Home > World Of ICT > Develop SMS Gateway with gammu , php, mysql on ubuntu 10.10

Develop SMS Gateway with gammu , php, mysql on ubuntu 10.10


Berhubung sudah mau magrib jadi saya  tulis denga gaya  BASBeng saja deh, bagi yang belum tahu SMS gateway, aplikasinya, serta gammu itu apa silahkan googling dulu agar tidak tersesat kemudian. Dalam eksperimen saya menggunakan Sistem Operasi Ubuntu 10.10 untuk membangun aplikasi SMS gateway ini,  sekaligus terinstall aplikasi LAMP (Linux With Apache Mysql Php5). jika requirement sudah lengkap bisa dimulai instalasi gammu ini.

1.  Install dependency aplikasi gammu dan librarynya

root@gigih:sudo apt-get install gammu gammu-smsd libgammu7 libgsmsd7
2. Masukkan Modem USB anda, disini saya menggunakan modem SIERRA At&T buatannya b*ngsat Israel. check dengan perintah berikut apakah modem terdeteksi atau tidak
 root@gigih:/var/www/sms# lsusb & wvdialconf
 [3] 19333
 Editing `/etc/wvdial.conf'.
 Scanning your serial ports for a modem.
 ttyS0<*1>: ATQ0 V1 E1 -- Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 004 Device 005: ID 1199:6856 Sierra Wireless, Inc. ATT "USB Connect 881"
 Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 003 Device 002: ID 04b3:3025 IBM Corp.
 Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 failed with 2400 baud, next try: 9600 baud
 ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
 ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

Modem Port Scan<*1>: S1   S2   S3
 WvModem<*1>: Cannot get information for serial port.
 ttyUSB0<*1>: ATQ0 V1 E1 -- OK
 ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
 ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
 ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
 ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
 ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
 ttyUSB0<*1>: Modem Identifier: ATI -- MC8781
 ttyUSB0<*1>: Speed 9600: AT -- OK
 ttyUSB0<*1>: Max speed is 9600; that should be safe.
 ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
 WvModem<*1>: Cannot get information for serial port.
 ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
 ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
 ttyUSB1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
 WvModem<*1>: Cannot get information for serial port.
 ttyUSB2<*1>: ATQ0 V1 E1 -- OK
 ttyUSB2<*1>: ATQ0 V1 E1 Z -- AT+CPMS="SM","SM"
 ttyUSB2<*1>: ATQ0 V1 E1 S0=0 -- OK
 ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
 ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
 ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
 ttyUSB2<*1>: Modem Identifier: ATI -- ATI
 ttyUSB2<*1>: Speed 9600: AT -- OK
 ttyUSB2<*1>: Modem Identifier: ATI -- Manufacturer: Sierra Wireless, Inc.
 ttyUSB2<*1>: Max speed is 9600; that should be safe.
 ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
 Found a modem on /dev/ttyUSB0.
 Modem configuration written to /etc/wvdial.conf.
 ttyUSB0<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
 ttyUSB2<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
 [3]   Done                    lsusb
 root@gigih:/var/www/sms#

Dari Informasi diatas diketahui bahwa modem sudah terdeteksi dan berada pada port ttysUSB2

Buat configurasi gammu dengan perintah berikut (sesuaikan Port dan Connection)
 root@gigih:/# gammu-config
 ┌───────────────────────
 │ Current Gammu configuration
 │
 │  P Port                 (/dev/ttyUSB2)
 │  C Connection           (at)
 │  M Model                ()
 │  D Synchronize time     (yes)
 │  F Log file             (/etc/gammu)
 │  O Log format           (textall)
 │  L Use locking          ()
 │  G Gammu localisation   ()
 │  H Help
 │  S Save
 │
 │
 │        <Ok>            <Cancel>
 │
 └───────────────────────
root@gigih:/var/www/sms# more /root/.gammurc
# This is a generated gammurc file.
 # It was generated by Gammu configurator 0.4
 # In Unix/Linux  : copy it into your home directory and name it .gammurc
 #                  or into /etc and name it gammurc
 # In Win32       : copy it into directory with Gammu.exe and name gammurc
 # Port           : in Windows/DOS: "com*:",
 #                  (instead of "*" please put "1", "2", etc.)
 #                  in other (Linux/Unix) "/dev/ttyS%"
 #                                     or "/dev/ircomm%" ("irda" connection)
 #                  (instead of "%" please put "0", "1", "2", etc.)
 # Model          : use only, when Gammu doesn't recognize your phone model.
 #                  Put it here. Example values: "6110", "6150", "6210", "8210"
 # Connection     : type of connection. Use "fbus" or "mbus" or "dlr3" or
 #                  "irda" (Infrared over sockets) or "infrared" (DirectIR)
 #                  or "at19200" (AT commands on 19200, 8 bits, None parity,
 #                  1 stop bit, no flow control) or "at115200" (AT commands on
 #                  115200, 8 bits, None parity, 1 stop bit, no flow control)
 #                  or "atblue" (AT over BlueTooth) or "dlr3blue" (FBUS
 #                  over BlueTooth)
 # SynchronizeTime: if you want to set time from computer to phone during
 #                  starting connection. Do not rather use this option when want
 #                  to reset phone during connection (in some phones need to
 #                  set time again after restart)
 # Logfile        : Use, when want to have logfile from communication.
 # Logformat      : What debug info and format should be used:
 #                  "nothing" - no debug level, "text" - transmission dump in
 #                  text format, "textall" - all possible info in text format,
 #                  "errors"  - errors in text format, "binary" - transmission
 #                  dump in binary format
 # Use_Locking    : under Unix/Linux use "yes", if want to lock used device
 #                  to prevent using it by other applications
 # GammuLoc       : name of localisation file
[gammu]
port = /dev/ttyUSB2
 model = 
 connection = at
 synchronizetime = yes
 logfile = /etc/gammu
 logformat = textall
 use_locking = 
 gammuloc =
 root@gigih:/var/www/sms#

Check kembali apakah gammu sudah bisa berkomunikasi dengan modem anda.

root@gigih:/# gammu --identify
 Device               : /dev/ttyUSB2
 Manufacturer         : Sierra Wireless, Inc.
 Model                : unknown (MC8781)
 Firmware             : F1_0_0_4CAP C:/WS/FW/F1_0_0_4CAP/MSM7200R3/SRC/AMSS 2007/09/25 18:39:23
 IMEI                 : 356685013198591
 SIM IMSI             : 510014010262841
 root@gigih:/#
 
root@gigih:/usr/share/doc/gammu/examples/sql# ls mysql.sql  pgsql.sql.gz  sqlite.sql.gz root@gigih:/usr/share/doc/gammu/examples/sql#

Create Database gammu

root@gigih:/usr/share/doc/gammu/examples/sql# mysql -u root -p
 Enter password: 
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 147
 Server version: 5.1.49-1ubuntu8.1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,
 and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database gammu;
 ok
 mysql>
root@gigih:/usr/share/doc/gammu/examples/sql# mysql -u root -p gammu < mysql.sql
 Enter password:
 root@gigih:/usr/share/doc/gammu/examples/sql#
mysql> use gammu;
 Reading table information for completion of table and column names
 You can turn off this feature to get a quicker startup with -A
Database changed
 mysql> show tables;
 +------------------+
 | Tables_in_gammu  |
 +------------------+
 | daemons          |
 | gammu            |
 | inbox            |
 | outbox           |
 | outbox_multipart |
 | pbk              |
 | pbk_groups       |
 | phones           |
 | sentitems        |
 +------------------+
 9 rows in set (0.00 sec)
mysql>
Edit gammu-smsdrc agar bisa tersambung dengan database MYSQL
root@gigih:/# vi /etc/gammu-smsdrc
 port = /dev/ttyUSB2
 connection = at
 startinfo = yes
 # Debugging
 logformat = textall
 # SMSD configuration, see gammu-smsdrc(5)
 [smsd]
 service = mysql    #INGAT JIKA INGIN MENGGUNAKAN MYSQL rubah menjasi MYSQL jika dlm bentuk file menjadi FILES
 logfile = /etc/smsdlog
 # Increase for debugging information
 debuglevel = 255
 user = root     #bagian ini user mysql
 password = 123456789   #Password mysql
 pc = localhost  #Server Mysql
 database = gammu  #Nama Database
 # Paths where messages are stored
 #inboxpath = /var/spool/gammu/inbox/
 #outboxpath = /var/spool/gammu/outbox/
 #sentsmspath = /var/spool/gammu/sent/
 #errorsmspath = /var/spool/gammu/error/

Pengujian Send SMS dari Console

root@gigih:/# echo "testing" | gammu --sendsms TEXT 085289774152
 If you want break, press Ctrl+C...
 Sending SMS 1/1....waiting for network answer..OK, message reference=113
 root@gigih:/#
Check log
 root@gigih:# tail -f /etc/smsdlog 
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: 41A|54T|2B+|43C|4DM|47G|4CL|3D=|344|0D                          AT+CMGL=4.      
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: 1 "AT+CMGL=4"
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: 2 "OK"
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: RECEIVED frametype 0x00/length 0x10/16
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: 41A|54T|2B+|43C|4DM|47G|4CL|3D=|344|0D |0D |0A |4FO|4BK|0D |0A  AT+CMGL=4...OK..
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: SMS listing received
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: Read 0 SMS locations
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: GSM_GetNextSMS failed with error EMPTY[22]: Entry is empty.
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: gammu: Leaving GSM_GetNextSMS
 Tue 2011/07/19 17:52:04 gammu-smsd[22560]: Execute SQL: UPDATE `phones` SET `TimeOut`= (NOW() + INTERVAL 10 SECOND)+0, `Battery`= 100, `Signal`= 9 WHERE `IMEI` = '356685013198591'
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Entering GSM_GetSecurityStatus
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Getting security code status
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: SENDING frametype 0x00/length 0x09/9
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D                              AT+CPIN?.       
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 1 "AT+CPIN?"
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 2 "+CPIN: READY"
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 3 "OK"
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: RECEIVED frametype 0x00/length 0x1F/31
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D |0D |0A |2B+|43C|50P|49I|4EN AT+CPIN?...+CPIN
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: 3A:|20 |52R|45E|41A|44D|59Y|0D |0A |0D |0A |4FO|4BK|0D |0A      : READY....OK.. 
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Parsing +CPIN: READY with +CPIN: @r
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Grabbed string from reply: "READY" (parsed 5 bytes)
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Parsed raw string "READY"
 Tue 2011/07/19 17:52:05 gammu-smsd[22560]: gammu: Security status received - nothing to enter
 ^C
 root@gigih:#

Terakhir buat aplikasi backend PHP untuk eksekusi SMS via WEB menggunakan PHP Script

isi kode  form.php
 <h1>Kirim SMS</h1>
<form method="post" action="send.php">
 Nomor HP Tujuan<br>
 <input type="text" name="nohp"><br><br>
 Isi SMS<br>
 <textarea name="sms"></textarea><br><br>
 Format SMS<br>
 <input type="radio" name="format" value="flash"> Flash SMS <br>
 <input type="radio" name="format" value="normal"> Normal SMS <br><br>
 <input type="submit" name="submit" value="Kirim SMS">
 </form>

isi kode  send.php

<?php
// koneksi ke database Gammu
 mysql_connect("dbhost", "dbuser", "dbpass");
 mysql_select_db("dbname");
// baca no tujuan
 $no_tujuan = $_POST['nohp'];
// baca isi sms
 $isi_sms = $_POST['sms'];
// baca format sms
 $pilih_format = $_POST['format'];
if ($pilih_format == "flash")
 {
 // jika format yang dipilih 'flash'
// query kirim sms format flash
 $query = "INSERT INTO outbox(DestinationNumber, TextDecoded, CreatorID, Class)
 VALUES ('$no_tujuan', '$isi_sms', 'Gammu', '0')";
// jalankan query
 mysql_query($query);
 }
 else if ($pilih_format == "normal")
 {
 // jika format yang dipilih 'normal'
// query kirim sms normal
 $query = "INSERT INTO outbox(DestinationNumber, TextDecoded, CreatorID, Class)
 VALUES ('$no_tujuan', '$isi_sms', 'Gammu', '-1')";
// jalankan query
 mysql_query($query);
 }
 else echo "Anda belum memilih format SMS";
?>
  1. July 28, 2011 at 5:05 am

    kok gak mau ngirim ya mas? udah diterapin tetep aja gak masuk ke database

    tapi kalo make terminal terkirim, tapi make php gak terkirim n gak masuk ke database

  2. July 28, 2011 at 5:23 am

    db user dan password sudah dipastikan bener ???.

    logikanya simple saja form html digunakan sebagai data input untuk di proses oleh program send.php
    send.php akan mengambil data nomer tujuan, isi sms, tipe sms, data ini akan dicopy ke outbox db gammu yg selanjutnya akan diproses secara otomatis oleh gammu daemon untuk dikirimkan,

    Pertanyaan saya apakah gammu sudah dibuat jalan untuk service mysql ??
    pastikan configurasi anda sama dgn contoh berikut;

    admin1@ubuntu:~$ ll /etc/gammu-smsdrc
    -rw-r–r– 1 root root 434 2011-07-27 15:28 /etc/gammu-smsdrc

    admin1@ubuntu:~$ cat /etc/gammu-smsdrc
    # Configuration file for Gammu SMS Daemon

    # Gammu library configuration, see gammurc(5)
    [gammu]
    # Please configure this!
    port = /dev/ttyUSB2
    connection = at
    startinfo = yes
    # Debugging
    logformat = textall

    # SMSD configuration, see gammu-smsdrc(5)
    [smsd]
    service = mysql
    logfile = /etc/smsdlog
    # Increase for debugging information
    debuglevel = 255

    # Paths where messages are stored

    user = root
    password = xxx
    database = gammu

    ================================================================================
    contoh log saya ketika sukses membaca sms

    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: Lemlit 1234567
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: Leaving GSM_GetNextSMS
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: Received message from +6285289774152
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: Execute SQL: INSERT INTO `inbox` (`ReceivingDateTime`,`Text`,`SenderNumber`,`Coding`,`SMSCNumber`,`UDH`, `Class`,`TextDecoded`,`RecipientID`) VALUES (‘20110728122354′,’004C0065006D006C0069007400200031003200330034003500360037′,’+6285289774152′,’Default_No_Compression’,’+6281100000′,”,’-1′,’Lemlit 1234567′,”)
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: Inserted message id 22
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: Execute SQL: UPDATE phones SET Received = Received + 1 WHERE IMEI = ‘356685013198591’
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: Entering GSM_DeleteSMS
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: Location = 0, Folder = 0
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: SMS folder 0 & location 0 -> ATGEN folder 1 & location 0
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: Getting SMS
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: SENDING frametype 0x00/length 0x0A/10
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 41A|54T|2B+|43C|4DM|47G|52R|3D=|300|0D AT+CMGR=0.
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 1 “AT+CMGR=0”
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 2 “+CMGR: 1,,33”
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 3 “06912618010000040D91265882794751F20000117082213245820ECC729B9DA68362B219AD66BB01”
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 4 “OK”
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: RECEIVED frametype 0x00/length 0x72/114
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 41A|54T|2B+|43C|4DM|47G|52R|3D=|300|0D |0D |0A |2B+|43C|4DM|47G AT+CMGR=0…+CMG
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 52R|3A:|20 |311|2C,|2C,|333|333|0D |0A |300|366|399|311|322|366 R: 1,,33..069126
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 311|388|300|311|300|300|300|300|300|344|300|44D|399|311|322|366 18010000040D9126
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 355|388|388|322|377|399|344|377|355|311|46F|322|300|300|300|300 5882794751F20000
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 311|311|377|300|388|322|322|311|333|322|344|355|388|322|300|45E 117082213245820E
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 43C|43C|377|322|399|42B|399|44D|41A|366|388|333|366|322|42B|322 CC729B9DA68362B2
    Fri 2003/08/01 22:25:59 gammu-smsd[1934]: gammu: 311|399|41A|44D|366|366|42B|42B|300|311|0D |0A |0D |0A |4FO|4BK 19AD66BB01….OK

    pastikan lognya sudah dibuat agar bisa memantau apakah service berjalan atau tidak disaya contohnya sy buat file /etc/smsdlog

    Selamat mencoba

    • July 28, 2011 at 5:35 am

      saya menggunakan gammu versi 1.29 dna ubuntu 10.04

      apa ada perbedaan dengan tutorial di atas ya mas?

  3. July 28, 2011 at 6:24 am

    harusnya sama saja. sudah di check service mysql jalan dan gammu daemon nya support mysql ? jika sudah bisa kirim sms dari console ya berarti gammu sudah berjalan , yang penting log gammu-nya ITU YG PERTAMA DIPERIKSA dulu 🙂

  4. December 16, 2011 at 3:29 am

    setahu saya pengujian gammu-smsd nya menggunakan
    gammu-smsd-inject TEXT nohp -text pesan
    kalau kita menggunakan
    gammu sendsms TEXT nohp -text pesan
    maka konfigurasi yang di gunakan adalah gammurc bukan gammu-smsdrc, karena dia tidak menggunakan gammu-smsd
    maaf kalau salah.

  5. December 16, 2011 at 8:03 am

    #kenzanin. penggunanaan gammu-smsd-inject untuk gammu versi lama

  6. re
    January 11, 2012 at 6:18 am

    waktu saya mengikuti tutorial mas diatas kok di terminal seperti ini mas ;

    root@unix:/usr/share/doc/gammu/examples/sql# mysql -u root -p gammu < mysql.sql
    bash: mysql.sql: No such file or directory

    mungkin ada solusi…
    terimakasih sebelumnya

  7. January 11, 2012 at 7:04 am

    dicheck di /usr/share/doc/gammu/examples/sql ada tidak file mysql.sql

    root# ls /usr/share/doc/gammu/examples/sql

  8. re
    January 11, 2012 at 11:08 am

    Adanya ini saja mas…

    root@unix:~# ls /usr/share/doc/gammu/examples/sql
    mysql.sql.gz pgsql.sql.gz sqlite.sql.gz

    Lalu bagaimana selanjutnya?

    Terimakasih Mas…

    • January 11, 2012 at 12:51 pm

      tar -zxvf mysql.sql.gz untuk ekstrack menjadi mysql.sql , lalu coba perintah sebelumnya.

  9. re
    January 11, 2012 at 1:42 pm

    ketika saya mencoba ekstrak, hasilnya seperti ini mas…

    root@unix:/usr/share/doc/gammu/examples/sql# tar -zxvf mysql.sql.gztar: This does not look like a tar archive
    tar: Skipping to next header
    tar: Exiting with failure status due to previous errors

    Terus apa yang harus saya lakukan?
    Terimakasih…

  10. re
    January 11, 2012 at 1:43 pm

    ketika saya mencoba ekstrak, hasilnya seperti ini mas…

    root@unix:/usr/share/doc/gammu/examples/sql# tar -zxvf mysql.sql.gz
    tar: This does not look like a tar archive
    tar: Skipping to next header
    tar: Exiting with failure status due to previous errors

    Terus apa yang harus saya lakukan?
    Terimakasih…

  11. February 23, 2012 at 5:18 am

    saya coba untuk send smsnya dari php yang mengexecute shell, tanpa harus lewat database
    perintahnya :
    system( ‘/usr/bin/gammu –sendsms EMS ‘ . escapeshellarg( $destination ) . ‘ -text ‘ . escapeshellarg( $message ) );

    dan errornya : “Error opening device, you don’t have permissions. ”

    nah jika langsung lewat terminal, bisa terkirim smsnya.

    ada solusi ga ?

  12. February 23, 2012 at 7:45 am

    check CHMOD perintah gammu, apakah di allow untuk di eksekusi via WWW, gampangnya dibuat begini

    root# chmod 777 /usr/bin/gammu

  13. student
    February 24, 2012 at 3:12 am

    mau tanya, waktu masuk mysql -u root -p.. kok hasilnya seperti ini

    The program ‘mysql’ can be found in the following packages:
    * mysql-client-core-5.1
    * mysql-client-5.0
    * mysql-cluster-client-5.1
    Try: apt-get install

    apa yg salah ya??
    Thx

    • February 24, 2012 at 7:38 am

      artinya mysql server belum terinstall di server anda coba install dahulu,

      root# apt-get install mysql-server

  14. student
    February 24, 2012 at 3:20 am

    trs bedanya sama /opt/lampp/bin/mysql -u root apa ya??

    • February 24, 2012 at 7:38 am

      jika memang sudah terinstall /opt/lampp/bin/mysql , ya tinggal digunakan saja

      • student
        February 27, 2012 at 2:58 am

        tapi waktu menjalankan gammu-smsd, hasilnya spt ini mas..

        Error connecting to database!
        Mon 2012/02/27 09:44:20 gammu-smsd[1477]: Error code: 2002, Error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

  15. root
    February 27, 2012 at 10:48 am

    Mas, mau tanya.. gammu –identify udah bisa jalan, gammu –sendsms text juga udah bisa.. tapi waktu saya menjalankan gammu-smsd knp hasilnya sprt ini ya..

    Mon 2012/02/27 13:13:08 gammu-smsd[3093]: Starting phone communication…
    Mon 2012/02/27 13:13:08 gammu-smsd[3093]: Error at init connection Can not open specified file. (28)
    Mon 2012/02/27 13:13:08 gammu-smsd[3093]: Terminating communication Can not open specified file., (28, 250 times)
    Mon 2012/02/27 13:13:08 gammu-smsd[3093]: Going to 30 seconds sleep because of too much connection errors
    Mon 2012/02/27 13:13:38 gammu-smsd[3093]: Starting phone communication…
    Mon 2012/02/27 13:13:38 gammu-smsd[3093]: Error at init connection Can not open specified file. (28)
    Mon 2012/02/27 13:13:38 gammu-smsd[3093]: Terminating communication Can not open specified file., (28, 250 times)
    Mon 2012/02/27 13:13:38 gammu-smsd[3093]: Going to 30 seconds sleep because of too much connection errors
    Mon 2012/02/27 13:13:38 gammu-smsd[3409]: Connected to Database: dbKRS on localhost
    Mon 2012/02/27 13:13:38 gammu-smsd[3409]: Starting phone communication…
    Mon 2012/02/27 13:13:43 gammu-smsd[3409]: Communication established
    Mon 2012/02/27 13:14:08 gammu-smsd[3093]: Starting phone communication…
    Mon 2012/02/27 13:14:08 gammu-smsd[3093]: Error at init connection Can not open specified file. (28)
    Mon 2012/02/27 13:14:08 gammu-smsd[3093]: Terminating communication Can not open specified file., (28, 250 times)
    Mon 2012/02/27 13:14:08 gammu-smsd[3093]: Going to 30 seconds sleep because of too much connection errors
    Mon 2012/02/27 13:14:38 gammu-smsd[3093]: Starting phone communication…
    Mon 2012/02/27 13:14:38 gammu-smsd[3093]: Error at init connection Can not open specified file. (28)
    Mon 2012/02/27 13:14:38 gammu-smsd[3093]: Terminating communication Can not open specified file., (28, 250 times)

    saya pakai modem siera juga, versi gammu 1.26.1
    kira2 salah dmnnya ya?? Thx

    • February 28, 2012 at 1:37 am

      hmm kalau lihat log ini “Error at init connection Can not open specified file.”
      coba di check kembali path log “gammu atau smsd” nya apakah sudah benar

  16. February 28, 2012 at 1:41 am

    student :

    tapi waktu menjalankan gammu-smsd, hasilnya spt ini mas..

    Error connecting to database!
    Mon 2012/02/27 09:44:20 gammu-smsd[1477]: Error code: 2002, Error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

    biasanya kejadian ini karena Daemon Mysql anda belum jalan, coba jalankan mysql server

    lalu check apakah daemon mysql sudah berjalan, harusnya seperti ini

    root@MyShell:~# ps ax | grep mysql
    2411 ? S 0:00 /bin/sh /opt/MyShell/mysql/bin/mysqld_safe –defaults-file=/opt/MyShell/conf/my.cnf –external-locking –log-error=/opt/MyShell/log/mysql_error.log –ledir=/opt/MyShell/mysql/libexec
    2602 ? Sl 5:10 /opt/MyShell/mysql/libexec/mysqld –defaults-file=/opt/MyShell/conf/my.cnf –basedir=/opt/MyShell/mysql –datadir=/opt/MyShell/db/data –external-locking –log-error=/opt/MyShell/log/mysql_error.log –pid-file=/opt/MyShell/db/mysql.pid –socket=/opt/MyShell/db/mysql.sock –port=7306
    3115 ? S 0:28 /usr/bin/perl -w /opt/MyShell/libexec/zmstat-mysql
    17217 pts/0 S+ 0:00 grep –color=auto mysql
    root@MyShell:~#

  17. root
    February 28, 2012 at 2:54 am

    Gigih Forda Nama :

    hmm kalau lihat log ini “Error at init connection Can not open specified file.”
    coba di check kembali path log “gammu atau smsd” nya apakah sudah benar

    maksudnya gmn ya mas??

    • February 28, 2012 at 3:03 am

      ini config disaya /etc/gammu-smsdrc

      port = /dev/ttyUSB2
      connection = at
      startinfo = yes
      # Debugging
      logformat = textall
      # SMSD configuration, see gammu-smsdrc(5)
      [smsd]
      service = mysql
      logfile = /etc/smsdlog
      # Increase for debugging information
      debuglevel = 255
      # Paths where messages are stored

      maksud saya apakah anda mengaktifkan logging untuk gammu-nya, dan apakah file tsb sudah dibuat/create , contoh saya saya aktifkan logging dan buat file log dengan path /etc/smsdlog , jadi seluruh transaksi SMSD dari gammu akan terekam pada file tersebut.

  18. May 14, 2012 at 2:13 am

    Assalammualaikum mas gigih…
    mau tanya sya pan database na pake xampp for linux (lampp),kra2 bisa g ya??
    trus setingannya gimana ya???

    • May 16, 2012 at 9:31 am

      bisa banget, sama saja. tinggal ikutin langkah diatas

  19. June 14, 2012 at 1:51 pm

    Waduh… Puyeng ni mas gigih, saya dah nyoba ikutin tutorialnya pas saya coba kirim sms via terminal itu bisa jalan, tapi pas nyoba pake php nya g jalan…

    nama database =gammu, user=root, ga pake password alias pasword na kosong,
    ni file gammu-smsd yang say buat
    # This is a sample Gammu SMSD configuration file. It’s required for gammu-smsd,
    # see gammu-smsdrc(5) for documentation.

    # Gammu configuration, this section is like section “gammu” in “gammurc” file,
    # see gammurc(5) for documentation.
    [gammu]
    #Device = /dev/ttyUSB1
    #port = /dev/ttyUSB1
    #model = unknow (MF180)
    #connection = at19200
    #synchronizetime = yes
    #logfile = /etc/smsdlog # this is not used at all in SMSD mode
    #logformat = textall
    #use_locking = yes
    #gammuloc = gammu.us
    #startinfo = yes

    # When uncomment this section and insert numbers here, smsd will process
    # incoming sms only from numbers written here (incoming sms from all other
    # numbers will be deleted)
    #[include_numbers]
    #number1 = 1234

    # When uncomment this section and insert numbers here, smsd will process
    # incoming sms from all numbers not written here (incoming sms from numbers
    # written here will be deleted). This is “black” list.
    # Note: after using “include_numbers” section this one will be ignored
    #[exclude_numbers]
    #number1 = 1234

    # General SMSD settings, see gammu-smsdrc(5) for detailed description.
    [smsd]
    # SMSD service to use, one of FILES, MYSQL, PGSQL, DBI
    service = MYSQL
    # PIN for SIM card
    PIN = 1234
    # File (or stderr, syslog, eventlog) where information will be logged
    logfile = /etc/gammu
    # Amount of information being logged, each bit mean one level
    debuglevel = 255
    # Configuration for using more phones on same database
    #phoneid = MyPhone1
    # Script to be executed when new message has been received
    #runonreceive = /some/script
    # Commication frequency settings
    commtimeout = 30
    sendtimeout = 30
    #receivefrequency = 0

    # Phone communication settings
    #checksecurity = 1
    #resetfrequency = 0

    # Delivery report configuration
    #deliveryreport = no
    #deliveryreportdelay = 10

    # Ignoring broken SMSC
    #skipsmscnumber = +48602123456

    # Database backends congfiguration
    user = root
    password =
    pc = localhost
    # pc can also contain port or socket path after colon (eg. localhost:/path/to/socket)
    database = gammu

    # DBI configuration
    driver = sqlite
    # driverspath = /usr/lib/dbd/
    # Database directory for sqlite
    # dbdir = /var/lib/smsd

    # Files backend configuration
    #inboxpath = /var/spool/gammu/inbox/
    #outboxpath = /var/spool/gammu/outbox/
    #sentsmspath = /var/spool/gammu/sent/
    #errorsmspath = /var/spool/gammu/error/
    #inboxformat = unicode
    #transmitformat = auto
    #outboxformat = detail

    log yang saya buat ketika ngejalanin sms d nya
    [Terminating]
    [Closing]
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: Configuring Gammu SMSD…
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: SHM token: 0xffffffffce02715f (-838700705)
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: No gammu configuration found (no [gammu] section in SMSD config file)!
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: Using MYSQL service
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: Configuring Gammu SMSD…
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: SHM token: 0xffffffffce02715f (-838700705)
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: No gammu configuration found (no [gammu] section in SMSD config file)!
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: Using MYSQL service

  20. June 14, 2012 at 1:53 pm

    sata :
    Waduh… Puyeng ni mas gigih, saya dah nyoba ikutin tutorialnya pas saya coba kirim sms via terminal itu bisa jalan, tapi pas nyoba pake php nya g jalan… saya pakenya lamm, xampp for linux
    nama database =gammu, user=root, ga pake password alias pasword na kosong,
    ni file gammu-smsd yang say buat
    # This is a sample Gammu SMSD configuration file. It’s required for gammu-smsd,
    # see gammu-smsdrc(5) for documentation.
    # Gammu configuration, this section is like section “gammu” in “gammurc” file,
    # see gammurc(5) for documentation.
    [gammu]
    #Device = /dev/ttyUSB1
    #port = /dev/ttyUSB1
    #model = unknow (MF180)
    #connection = at19200
    #synchronizetime = yes
    #logfile = /etc/smsdlog # this is not used at all in SMSD mode
    #logformat = textall
    #use_locking = yes
    #gammuloc = gammu.us
    #startinfo = yes
    # When uncomment this section and insert numbers here, smsd will process
    # incoming sms only from numbers written here (incoming sms from all other
    # numbers will be deleted)
    #[include_numbers]
    #number1 = 1234
    # When uncomment this section and insert numbers here, smsd will process
    # incoming sms from all numbers not written here (incoming sms from numbers
    # written here will be deleted). This is “black” list.
    # Note: after using “include_numbers” section this one will be ignored
    #[exclude_numbers]
    #number1 = 1234
    # General SMSD settings, see gammu-smsdrc(5) for detailed description.
    [smsd]
    # SMSD service to use, one of FILES, MYSQL, PGSQL, DBI
    service = MYSQL
    # PIN for SIM card
    PIN = 1234
    # File (or stderr, syslog, eventlog) where information will be logged
    logfile = /etc/gammu
    # Amount of information being logged, each bit mean one level
    debuglevel = 255
    # Configuration for using more phones on same database
    #phoneid = MyPhone1
    # Script to be executed when new message has been received
    #runonreceive = /some/script
    # Commication frequency settings
    commtimeout = 30
    sendtimeout = 30
    #receivefrequency = 0
    # Phone communication settings
    #checksecurity = 1
    #resetfrequency = 0
    # Delivery report configuration
    #deliveryreport = no
    #deliveryreportdelay = 10
    # Ignoring broken SMSC
    #skipsmscnumber = +48602123456
    # Database backends congfiguration
    user = root
    password =
    pc = localhost
    # pc can also contain port or socket path after colon (eg. localhost:/path/to/socket)
    database = gammu
    # DBI configuration
    driver = sqlite
    # driverspath = /usr/lib/dbd/
    # Database directory for sqlite
    # dbdir = /var/lib/smsd
    # Files backend configuration
    #inboxpath = /var/spool/gammu/inbox/
    #outboxpath = /var/spool/gammu/outbox/
    #sentsmspath = /var/spool/gammu/sent/
    #errorsmspath = /var/spool/gammu/error/
    #inboxformat = unicode
    #transmitformat = auto
    #outboxformat = detail
    log yang saya buat ketika ngejalanin sms d nya
    [Terminating]
    [Closing]
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: Configuring Gammu SMSD…
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: SHM token: 0xffffffffce02715f (-838700705)
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: No gammu configuration found (no [gammu] section in SMSD config file)!
    Thu 2012/06/14 20:49:54 gammu-smsd[2899]: Using MYSQL service
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: Configuring Gammu SMSD…
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: SHM token: 0xffffffffce02715f (-838700705)
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: No gammu configuration found (no [gammu] section in SMSD config file)!
    Thu 2012/06/14 20:50:38 gammu-smsd[2930]: Using MYSQL service

  1. July 20, 2011 at 8:33 am
  2. July 28, 2018 at 9:41 am
  3. August 22, 2021 at 3:02 am
  4. August 22, 2021 at 7:45 am

Leave a comment