Using Kalkun and gammu-smsd with SQLite3

February 28, 2011 19 comments

It’s been a long time ago since i’ve started to thinking adding other database backend support besides MySQL. The problem is CodeIgniter (Kalkun is developed using CodeIgniter) and gammu-smsd both must support the database engine used, for example if CodeIgniter support PostgreSQL, than gammu-smsd must support PostgreSQL too, and so on. To make this dream comes true, i’ll have to “convert” all native SQL query to Codeigniter Active Record to make the query independent to all database engine because it’s handled by database driver.

Imagine that you want to install a software, but you only have SQLite3/PostgreSQL on your server, installing MySQL just for that can be huge problem. That’s the basic idea to support all database engine.

OK, for the first time, i’ve added SQLite3 support to Kalkun. But, it’s not as easy as i imagine to implement it. First, CodeIgniter doesn’t have official support for SQLite3, the driver only compatible with SQLite2, fortunately there’s community contribution that add SQLite3 through PDO (PHP Data Objects). So, you need pdo_sqlite extension on your PHP installation. Second, gammu-smsd also doesn’t have native support for sqlite3, otherwise it use libdbi.

Now let’s configure gammu-smsd to works with SQLite3 first. FYI, i’m using Mac OS X and gammu 1.29.0. Let’s install SQLite3 and libdbi drivers, i’m installing it using MacPorts.

$ sudo port install sqlite3
$ sudo port install libdbi
$ sudo port install libdbi-drivers

Next, compiling gammu with libdbi support. Make sure you get “Found libdbi: …” when running configure otherwise you can’t run gammu-smsd with SQLite3.

Create Kalkun database and import gammu database schema
Because of Kalkun New Installation, gammu database schema is not included on Kalkun source, now you’ve to import gammu database schema on your own (it’s included on gammu source eg. docs/sql/sqlite.sql). You can do the import using sqlite3 console:

$ sqlite3 kalkun.sqlite < docs/sql/sqlite.sql

or, if somehow it’s throw error “Error: near “/”: syntax error“, use this:

$ cat docs/sql/sqlite.sql | sqlite3 kalkun.sqlite

Or you can the import using SQLite3 client with GUI. I’m using SQLite Manager Firefox add-ons, off course you can use other SQLite client.

Next is import Kalkun database schema to the database, you can import it using your SQLite3 client or by Kalkun Installation. I’ll show you how to import using Kalkun installation. But before that you have to config the database first (it’s located on /application/config/database.php)

$db[‘default’][‘username’] = “”;
$db[‘default’][‘password’] = “”;
$db[‘default’][‘database’] = “sqlite:/path/to/database/kalkun.sqlite”;
$db[‘default’][‘dbdriver’] = “pdo”;

You only need to change the database path, SQLite doesn’t need username and password, and the driver should be pdo. It’s recommended to place your SQLite3 database outside your web root folder because of security issue.

Setting database permission, before launch Kalkun installation make sure the database is writable by web server user, you can give it world writable.

$ chmod 666 /path/to/sqlite3_db/
$ chmod 666 kalkun.sqlite

Next fire up Kalkun installation and choose SQLite3 on Database Setup.

Kalkun installation with SQLite3

Kalkun installation with SQLite3

Next, let’s configure gammu-smsd, open up your gammu-smsd configuration file a.k.a smsdrc

Service = SQL
Driver = sqlite3
database = kalkun.sqlite
dbdir = /path/to/sqlite3_db/

That’s all, now run your gammu-smsd, check logs and see if it’s working (no error). You can try sending SMS using gammu-smsd-inject:

$ gammu-smsd-inject TEXT 123456 -text “Hi, this is gammu sending using sqlite3”

Next, try sending SMS using Kalkun πŸ˜€

..

PS: SQLite is famously knows for it’s liteness, but it’s may slower with network access and lots of activity/user using the same resource. So make sure you know what are you doing before using it.

Implemented on commit #fa845a4

Advertisements
Categories: kalkun Tags: , ,

Kalkun: New installation

February 28, 2011 2 comments

To make Kalkun works with all gammu version i’ve decided to remove gammu database schema from kalkun installation, now you have to import gammu database schema on your own, gammu database schema is included on gammu source, usually located /docs/sql/mysql.sql, but it’s may be different depends on gammu installer you used (source, windows binary, debian packages, etc).

Now the summary of Kalkun installation should be:

  1. Download and extract Kalkun to web root directory
  2. Create database named kalkun and setup database permission (optional)
  3. Import gammu database schema (you can do it using mysql console or phpmyadmin)
  4. Launch Kalkun installation, if you don’t have gammu database schema, it will throw error “Cannot find gammu database schema“.

That’s all πŸ˜€

Implemented on commit #fa845a4

Categories: kalkun Tags:

SSH tunneling dengan putty dan iSSH

February 25, 2011 1 comment

Kalau di postingan ini dan ini saya menggunakan command line untuk melakukan ssh tunneling (baca: “pencurian” bandwidth :P), tapi koq lama-lama capek juga ya karena yang diketikkan cukup panjang dan dilakukan berulang-ulang:

$ ssh -D localhost:4321 -p 993 support@hostname

Akhirnya nyari-nyari ssh client yang memiliki GUI dan bisa melakukan tunneling.

Dan, ternyata gw harus kembali bernostalgia dengan putty, tools yang pertama kali kenal pas jaman kuliah D3 πŸ˜€
Tapi ternyata config-nya ga segampang yang dibayangkan, dan agan Rasyid-lah jadi saksinya, ribet kan gan? Apa gw yg bego ya πŸ˜›

Akhirnya ngoprek-ngoprek lagi di rumah, dan akhirnya ketemu πŸ™‚

Seperti biasa, isi dulu Hostname/IP address tujuan dan portnya, Connection type yang digunakan tentu saja SSH.

Lanjut ke menu Connection –> SSH –> Tunnels

Masukin Source portnya localhost:4321, jangan centang Dynamic dan IPv4 (kalau Auto malah nanti kepilihnya IPv6).

Udah, gitu doang πŸ˜€ Jangan lupa di Save biar nanti ga capek-capek setting lagi.

 

Oiya, ternyata ada yang lebih mudah lagi, yaitu iSSH. Berhubung putty tidak berjalan secara native di Mac OS, jadinya gw milih iSSH aja, dan putty memang lebih “ribet” karena menunya lebih banyak (tidak hanya SSH), sedangkan iSSH khusus untuk SSH jadi lebih simpel πŸ˜€

Semuanya di satu halaman, dan memang sudah ada templatenya πŸ˜€

Kalo begini kan tunneling jadi lebih lancar *digeplak admin πŸ˜€

Categories: Tips 'n trick Tags: , , ,

Kalkun Database Schema

February 25, 2011 Leave a comment

Just added Database Schema page on Wiki.

It’s for developer who want to know about database tables description and relationship.

Kalkun Database Schema

Kalkun Database Schema

Created with MySQL Workbench.

Categories: kalkun Tags: ,

2010 in review

February 24, 2011 Leave a comment

*Ternyata lumayan banyak juga yang nyasar ke blog ini πŸ˜›

 

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meterβ„’ reads Wow.

Crunchy numbers

Featured image

The average container ship can carry about 4,500 containers. This blog was viewed about 17,000 times in 2010. If each view were a shipping container, your blog would have filled about 4 fully loaded ships.

 

In 2010, there were 42 new posts, growing the total archive of this blog to 79 posts. There were 75 pictures uploaded, taking up a total of 9mb. That’s about a picture per week.

The busiest day of the year was October 20th with 138 views. The most popular post that day was Installing Kalkun from PPA.

Where did they come from?

The top referring sites in 2010 were back2arie.capungriders.com, kalkun.sourceforge.net, google.co.id, en.wordpress.com, and managesms.net.

Some visitors came searching, mostly for iphone simulator, kalkun sms gateway, kalkun sms, emoticon kaskus, and kalkun.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

Installing Kalkun from PPA August 2010
43 comments and 1 Like on WordPress.com,

2

Kalkun 0.1.3beta on Ubuntu 8.04 August 2009
94 comments

3

Using gammu-smsd with multiple phone July 2010
8 comments

4

Installing gammu on Mac OS X July 2010
9 comments

5

Using Kalkun with other application August 2010
1 comment

Categories: Others

Backup/export your contacts using gammu

February 23, 2011 Leave a comment

This tutorial will explain step-by-step how to backup/export your contacts using gammu.

Some people might have hundred or even thousand contacts saved in their SIM card or phone memory. Imagine if such important data loss by accident and you don’t have backup? You must be so upset :/

So, let’s do the backup πŸ˜€

First, you need supported phone/modem by gammu.

Next, install gammu itself.
FYI, i’m using Mac OS X 10.5.8 and have installed gammu 1.28.0 version, but there is a bug as i mention on gammu bug tracker here. So, i try the 1.29.0 version, but no luck again, i got “ld: library not found for -lglib-2.0” when compiling, and looks someone also get same problem and report it to the developer. I’m trying the latest version again (1.29.90), but out of luck again, now i’m getting “cc1: warnings being treated as errors“. I decided to go back to 1.29.0 version and searching “glib” keyword on gammu documentation and it’s said that it needed by gammu-detect library, which i don’t need one so i decided to disable it on cmake.

$ mkdir build
$ cd build
$ cmake -DWITH_Glib=OFF ..
$ make

It’s works like a charm πŸ˜€

Now, let’s go to the main topic, the backup!

To list available contacts on your SIM card:

$ gammu getallmemory SM
List available contacts

List available contacts

Why there’s only 2 of them? Yes, it’s just an example, you may see hundred/thousand entry on your phone.
Please note there are another memory type supported by gammu, like ME for phone internal memory, you can see complete list here.

Now, to do the backup as vcf format:

$ gammu backup gammu_contact_backup.vcf -yes

That’s it! Now, you can open the file with your Contact Management Software like Address Book on Mac OS X, or if you open it text editor you’ll see something like this.

Open up vcf backup file with text editor

Open up vcf backup file with text editor

So, what’s next?

  • You can keep the backup file and restore it to your phone if you loss your contact.
  • Import it to other app, for example Gmail πŸ˜€
Import contact to Gmail

Import contact to Gmail

  • Or, even better, import it to Kalkun πŸ˜€
    But, Kalkun only support CSV import, so you need to convert it first. Fortunately, there is a online tool to do that, VCF to CSV converter
Convert VCF to CSV

Convert VCF to CSV

Next, fire up OpenOffice Calc or other spreadsheet and remove unneeded header.

Before clean up

Before clean up

After clean up

After clean up

And the rest, just follow instruction how to import it to Kalkun here.

That’s it! Hope it will help someone out there, cheers πŸ˜€

INAICTA 2010 in memoriam

February 22, 2011 3 comments

Jadi kangen suasana kompetisinya, deg-degannya (lebay), ketemu juri-jurinya yang super keren (Pak Onno, Pak Rusmanto, Ibu Betty). Jadi inget dulu saya satu-satunya peserta yang masih kuliah (di kategori open source), sendirian pula, modal nekat doang, hehehe…

Walaupun cuma jadi nominator, pastinya ada perasaan bangga bisa sampai menyisihkan ratusan bahkan mungkin ribuan karya yang lain, sampai buka stand pameran di JCC πŸ˜€

Semoga tahun ini masih bisa meramaikan INAICTA 2011. Amin πŸ˜€

Categories: kalkun Tags: , ,