Backup/export your contacts using gammu

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

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 😀

Kalkun: Simple Autoreply (Experimental)

This feature implement some users who simply want to have automatic reply to every incoming message. No matter what is the sms contain of, that’s why we called it simple autoreply.

Off course this feature disabled by default, you need to change the config in /application/config/kalkun_settings.php

/*
|--------------------------------------------------------------------------
| Simple Autoreply (Experimental)
|--------------------------------------------------------------------------
|
| Always reply (automatically) every incoming message
|
*/
$config['simple_autoreply'] = FALSE;
$config['simple_autoreply_uid'] = '1'; // set user id who sent the message, must be valid ID
$config['simple_autoreply_msg'] = "Thanks for sending me the message";

Change $config[‘simple_autoreply’] to TRUE to enable this feature.
$config[‘simple_autoreply_uid’]
is an identifier which user sent the autoreply, uid 1 is the default value.
$config[‘simple_autoreply_msg’]
is the message you want to sent.

Last, you need to setup the daemon. The daemon will scan the inbox and process the autoreply and some other activity like @username check. The daemon also needs php-cli.

There are 2 ways to run the daemon. First, using the runonreceive which provided by gammu, or by cron/scheduler. But, because cron need third party software, i prefer using runonreceive.

Edit your gammu-smsd configuration file (smsdrc), change the path based on your environment:

[smsd]
runonreceive = /opt/lampp/htdocs/kalkun/scripts/daemon.sh

Or if you are using Windows:

[smsd]
runonreceive = C:\xampp\htdocs\kalkun\scripts\daemon.bat

Warning: It always a good idea to move the scripts directory outside the www, so it’s not accessible from browser.

Set correct path on daemon.sh or daemon.bat:

# Configure this (use absolute path)
PHP=/usr/bin/php # php cli path
DAEMON=/path/to/kalkun/scripts/daemon.php # daemon.php path

Make sure that the daemon script is executable.

$ sudo chmod +x daemon.php daemon.sh daemon.bat

Change URI path in daemon.php, the default value is:

// Please configure this
$url = "http://localhost/kalkun";

That’s it, now try send message to Kalkun, and see if the autoreply is working.

Troubleshooting: If somehow gammu-smsd fail to run the daemon script it will thrown error like this:

gammu-smsd[3665]: Process failed with exit status 126

Check permission and try to run the script manually.