Wednesday, October 22, 2008

Jain Sip is working on top of android

I had a bit of free time yesterday night and I noticed the first google android powered phone hit the market in USA so I said to myself, what if I tried to port jain sip stack to android...
Not so much work should be needed since android supports a lot of the JDK 1.5 packages natively. So I tried and believe it or not, no work was actually required to make the jain sip stack work on android, it just runs :-)
Again kudos to Ranga for such a great stack :-) and to Google for having a nice OS where you can really reuse most of your Java applications (pending a rewrite of the UI)

So here is my proof of concept :
I ported the well known Shootist and Shootme examples from the sip stack to android and uploaded a zip here that you can play with.

The zip contains shootist and shootme standard examples and shootist and shootme android examples. Unzip in a location that we will call

So first you need to have the android SDK installed and have the android tools on your path (see the Android installation instructions for that)

Then you can start the android emulator with the following command:
$ emulator

from , do the following :
$ cd shootme-android/bin/

and then
$ adb install shootme-android.apk 

this install the shootme android example application into the emulator
go back to and do the following :
$ cd shootist-android/bin/

and then
$ adb install shootist-android.apk 

this install the shootist android example application into the emulator

You can see the applications installed in the emulator by clicking on the gray arrow at the bottom of the android phone screen :



Ok so much for the installation of the applications into android. Now let's get real and have some fun. Let's try the shootme android application first.

on the emulator, go to the menu and select the application called shootme.
It says that the jain sip stack has started on 10.0.2.15 (localhost's emulator ip address of android)

Since the emulator has its own ip address system we need to setup a UDP redirection from our host's localhost:5070 to the emulated system's localhost:5070 so that teh shootme android application can be pinged from our shootist standard application with the following command

$ adb emu redir add udp:5070:5070


let's start the standard shootist example so that it calls shootme and that a SIP call flow (INVITE-OK-ACK and then BYE-OK) is done between them.
go back to and do the following :
$ cd shootist/dist

and then
$ java -jar shootist.jar

you should now see the messages being exchanged between the shootme android application and the shootist standard application.

if the emulator sip messages are not enough, more log is available through the command
$ adb logcat

now kill the shootist app with Ctrl+C and close the emulator

You can also do the reversed example and start first the shootme:

Since the emulator has its own ip address system we need to setup a UDP redirection from our host's localhost:5060 to the emulated system's localhost:5060 so that the shootist example application can be pinged back from our shootme standard application with the following command

$ adb emu redir add udp:5060:5060


let's start the standard shootme example so that it waits to be called by the shootist android applicationand that a SIP call flow (INVITE-OK-ACK and then BYE-OK) is done between them.
go back to and do the following :
$ cd shootme/dist

and then
$ java -jar shootme.jar

on the emulator, go to the menu and select the application called shootist.

You should now see the messages being exchanged between the shootme android application and the shootist standard application.

if the emulator sip messages are not enough, more log is available through the command
$ adb logcat


Please post comments if you have problems running the examples or if you want to give me some feedback...