Thursday, December 12, 2013

Bringing your contacts to a Nokia 7110

I  just needed a new phone and decided to go for cool solution: Nokia 7110 (v4.84).
I got one including serial data cable + dock and the only thing missing was: how do I get my contacts on the phone without typing?

The answer was quite simply: export your address book as vCard and send it to the phone via gnokii on an Ubuntu.

  1. Get your address book
    Export it somehow: I tried Evolution as well as GMail web-interface (both work).
  2. Get a serial port
    Setting up the serial port on my Lenovo X60 was not straight forward, but now it works...
    Really depends on your hardware
  3. Connect to phone
    Use minicom and check if the phone replies to AT commands
  4. Configure gnokii
    [global]
    port = /dev/ttyS0
    model = 7110
    connection = serial
    use_locking = yes
    serial_baudrate = 9600
  5. Use gnokii to read/write your address book
    gnokii --deletephonebook ME 1 200
    gnokii --writephonebook -o --vcard < addressbook.vcf


The Nokia 7110 has a bug: the vCard-parser is broken...
So, I needed to fix my addressbook: basically remove all not needed data (emails, addresses, birthdays etc.). I implemented a small python-script using vObject.
It reads from stdin and writes to stdout: cat addressbook.vcf | python script.py

#!/usr/bin/python
#encoding=UTF-8

import vobject
import sys
import inspect

#Remove entries except in list for one vcard.
def vcard3_remove_all_entries_except(vcard):
    allowedEntries = {'version', 'fn', 'tel', 'categories'}
    entries_dict = vcard.contents
    for key in entries_dict.keys():
        if key not in allowedEntries:
            del entries_dict[key]

importedVCards = vobject.readComponents("".join(sys.stdin.readlines()))
try:
    while (True):
        vcard = importedVCards.next()
        vcard3_remove_all_entries_except(vcard)

        vcard.add('n');
        try:
#            vcard.prettyPrint()
            print(vcard.serialize()),
        except Exception as e:
            print(e)
            
except StopIteration:
    None
Sync with style:
cat contacts.vcf | python import.py | gnokii --writephonebook -o --vcard

And a tutorial to clean the Nokia 7110 can be found here.

Tuesday, December 3, 2013

Transcode MKV (h264) with multiple audio streams to MP4 (AAC)

Transcoding MKV containers using avconv to MP4, so that the files can be processed with Adobe Premiere. The following command copies the video stream (should already be in h264)  and convert all audio streams to AAC. All audio streams are sampled to 6 channels (even if the source is only stereo).

avconv -i INPUT.mkv -c:v copy -map 0:0 -c:a aac -map 0:1 -map 0:2 -ab 448k -ac 6 OUTPUT.mp4

The example is for 2 audio streams; just add more -map commands as needed.

Friday, October 25, 2013

PJSIP for Ubuntu (PPA) with video support

I am happy to announce that PJSIP 2.1 is packed for Ubuntu 13.10 including Video support.

PPA here: https://launchpad.net/~dennis.guse/+archive/sip-tools

On Ubuntu do the following:
sudo add-apt-repository ppa:dennis.guse/sip-tools
sudo apt-get update sudo apt-get install libpjsip-samples python-pjsip


Samples reside then in /usr/lib/libpjsip-samples/

Features:
  • Python 2.7 bindings
  • SSL
  • (new) Video support
  • (new) vidgui sample application [is patched]
Next steps:
  • Add x264
  • Python bindings: Add video support
  • Python bindings: Bump bindings to Python 3.X

Monday, August 12, 2013

openHKP [initial release]

OpenHKP release mail send to openPGP.js:

Hey,
first of all thanks for building openpgp.js!
Some weeks ago I started using openpgp.js and found it pretty convenient.
However, I missed one feature: the interaction with PGP-Keyserver.
Long story short: As the keyserver protocol (HKP) is basically HTTP, I created a brief implementation in Javascript:  https://gitorious.org/openhkp-js/openhkp-js
Furthermore, I setup a CORS-enabled proxy for some keyservers: http://g00se.indus.uberspace.de/
The implementation is based upon: http://tools.ietf.org/html/draft-shaw-openpgp-hkp-00
Best regards,
---
Dennis Guse

Friday, August 2, 2013

Asterisk: Accepted Patch

First contribution to Asterisk (implemented together with Frank Haase):

For video calls, we would like to set the codecs in the dialplan using
SIP_CODEC. However, if SIP_CODEC is set, all codecs except the ONE set are disallowed and thus either audio or video is available.
Attached is a patch for 11.4 that allows SIP_CODEC to contain a list of codecs , e.g. "gsm,h264".
Thanks to Matt Jordan and Rusty Newton (both Digium) for their reviews.

Tuesday, July 30, 2013

PJSIP library package for Ubuntu

I find it pretty annoying to compile PJSIP on all hosts that I use by hand.
It is quite error-prone and the procedure is quite time-consuming.

So, I created the scripts to setup an Ubuntu packet (at the moment only 13.04). It is available as PPA here: https://launchpad.net/~dennis.guse/+archive/sip-tools

On Ubuntu do the following:
sudo add-apt-repository ppa:dennisguse/sip-tools
sudo apt-get update
sudo apt-get install libpjsip-dev python-pjsip

Features:
* Python-bindings
* SSL

Missing Features:
* Video (some dependencies are missing in Ubuntu 13.04 and will come with 13.10).

Friday, July 26, 2013

Reverse proxy with CORS usin Apache2

For the implementation of a Javascript-Client, I needed a CORS enabled reverse-proxy.

Here is one using apache2 (Virtual Host):
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so


 ProxyRequests Off

 ProxyPass / http://SERVER
 ProxyPassReverse / http://SERVER

 Header set Access-Control-Allow-Origin "*"
 Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"

Here is one using apache2 (.htaccess): mod_rewrite and mod_headers must be loaded.
RewriteEngine  On
RewriteBase /
RewriteRule  (.*)  http://SERVER/$1  [P,L]

 Header set Access-Control-Allow-Origin "*"
 Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
PS: Be aware of the security implications!