Friday, April 25, 2008

SIP User Agent for Android

A legend: when I refer to "mjsip User Agent", I am talking of MjSip UA

For a class assignment, I decided to build a VOIP client for Android. But it turns out Android does not have any inbuilt support for the session initiation protocol (SIP) and real time protocol (RTP). However, guys at have ported the Java based open source SIP stack mjsip ( and have discussed it here. They have even shown a screencast in which they show up a client on Android and call a Xlite soft phone. The source code of the stack is also available on the same site. However, they have not released the SIP User Agent yet and this is what I am going to do here (I would suggest you track their site for a more concrete and practical implementation later).

Note that the Android user agent can only make a call to another non-Android SIP Client. A SIP call establishment is done and no voice converstion is possible since Android emulator does not allow coice capture yet. I will try to stream a media file later over the same call. My next step would be to stream a media file using RTP from the Android client to the non-android SIP client. (The mjsip User Agent also has RTP implementation)

However, the code that I have has been made over a night long session. Not technically challenging but required some patience. And so, I have mixed up all the classes of the standard mjsip User agent at and the android port of the stack at I had to replace all System.out statements with the Android logging at info level. There is no GUI yet for the user agent that I have developed. When the application starts up it initates a call and you can hear a ring on the non-Android Client. You will have to step through the code to understand what I have done and to be able to use it in your application. Also, the constructors for the SIP Stack, SIP Provider, etc take a file name as a string, I added a new constructor in some classes to take an InputStream. Its not a neat implementation but should help until releases a nicer client and if you have been eager to do some VOIP based or to be more general SIP-based applications. So this is how to run it:

  1. Download the binaries for MjSip UA
  2. Download the project that I made from here
  3. Copy the file /Non-AndroidClient/non-android.cfg into the /lib folder of the MjSip UA
  4. In non-android.cfg do this:
    1. The parameter from_url="Bob" . After the '@ ' sign put the IP address of your local machine.
    2. Let "realm" be also equal to the IP address of the same machine
  5. To start up the mjSip User Agent, co to your command prompt and enter the root of the mjsip files you just downloaded and type in "uaw -f config\non-android.cfg"
  6. Now lets see what to with Android. Somehow try to import the files stored in /AndroidUA into an Android Project in Eclipse IDE (IDE must come with the Android extension and SDK) and include/copy the Activity class that I have created.
  7. In the android project, open to /res/raw/a.txt and edit it as explained:
    1. Change the "call_to" parameter to be: call_to= sip::5080
      where the "IP addr" is the IP address in 4. This file is now actually added as a resource/asset to the application and will be opened by the reference to the Activity instance like this:
      1. this.getResources().openRawResource(R.raw.a) which returns an InputStream and hence, I had to change many methods/constructors to take an inputstream instead of a string file name.
  8. Thats it. You are done. Start up the Android client and shall here a ring on the non-Android client
Though has shown a screencast on their blog, if you want me to do the same, please drop a line and I can try to make one. Questions/comments are most welcome. And thanks to people at and Please feel free the use the code the way you want and spare me if there is any problemo :)


Anonymous said...

your link seems to be broken

Himanshu said...

Well...I would need to do some searching to find where I have kept the programs now. I had worked on the Android SIP client in March 2008. At that time, all I could do was make a call (send a ring) from the Android client to a SIP Client. A conversation was not possible since Android development environment never supported a microphone. Other than that you should see the links to in the above article. If you still needed, leave a comment and I will try to get it.

Himanshu said...

The link is now fixed.

RoSippA said...

Hi I interest its.
But I can't download from How can I get it.

Himanshu said...
This comment has been removed by the author.
Himanshu said...

Dont bother looking at the code that I developed, HSC has continued development on the SIP client and has uploaded it here:

Dreamer said...

Hi, I interest too.
I can't download from your last link.


Michael Angelo said...

hi boss, hope you could restore your sample app for SIP using mjsip thanks im on a project hehehe

Srikanth said...

Hi shu, I Gone thru blog, It's very useful.Do u Have an idea abt Sip Communicator....


Himanshu said...


dan rogy said...

I am looking for voip sip sdk solution

I have found

Did anybody used it?

Anonymous said...

My project required to integrate dialer
with voice playing ability, fax detection and digit recognition

I bought
and that guys provide great support

Android app developer said...

Its interesting information and i got a good knowledge about android. now a days android is most popular one and also most of the peoples are likes this one, because its entirely different from others.

Android app developers said...

This is one of the fantastic post.I like your blog nature ..Its presenting very advance and important is one of the fast moving mobile Operating system.We are also provide good logic related to Android.Android app developers

Android app developer said...

I think most of the peoples are likes your blog, because its having the wonderful information about android.

Android app developers

Android app development said...

This is one of the brilliant. post.I like your blog details.Try to present more this kind of information.
Android app developers

Android app developers said...

This is one of the excellent post.I like your blog creativity.Thais is one of the good post.

Android app developers said...

Great idea.This is one of the thoughtful and pretty post.This kind of post will help us to increase our knowledge.