How to use PJSIP on Android?

I am assuming that you are familiar with PjSIP and have some experience using some of the APIs, at least from the top level layer, viz. Pjsua.

If that's true, you can go ahead and take a look into the CSipSimple project. Its an open source Android project based on PjSIP.

You can try out the app from the Google Play store and see if it fits your needs before you start modifying the source.

EDIT: Since you say, you are new to PjSIP, I suggest you get familiar with it on desktop platform first.

First of all you will need to build all the PjSIP libraries for your target platform. Then include those libraries in your application and start using the APIs. To begin with you can achieve almost all the SIP features you require using the PJSUA API - High Level Softphone API. PjSUA stands for PjSIP User Agent and its actually a command line softphone in itself. The APIs in PjSUA-lib are categorized based on their functionality like transport creation, account registration, call handling, media handling etc. and you can find links to each category in the previous link. That will give you a good documentation with description of all methods, fields and constructors.

I suggest you go through the sample application Simple PjSUA which will get you familiar with the way of initializing PjSIP, account registration, how to handle incoming INVITE in the case of an incoming call, how to make an outbound call and how to handle the call media.

Coming to Android you can either go ahead and use the CSipSimple which uses a modified version of pjsip-jni. Else you can build pjsip for Android following the intructions here.

Hope this helps.


Useful Links:

  • PJSIP Starter for Android
  • PJSUA2 API

This thread is pretty old but I've recently used PJSIP with android. If you can get pjsip to build correctly, which a major feat considering the numerous issues when trying to build for android and openssl(if you want encryption), it's a good library to work with on android.

The PJSUA2 api is what you'll use to work with PJSIP on android. The entire library is written in java and fairly easy to learn and work with. The PJSUA2 documentation will help with most issues, but if you run into errors you'll have to google it until you figure it out.

I found that the CSipSimple project does not provide a good reference for people who are completely new to PJSIP. However, this is just my opinion.

On Android, once you get it all set up, it's as simple as just following the instructions on the PJSUA2 documentation to get calls working. Video takes a bit more effort, but is still achievable.

Also at the time of posting you still have to use Eclipse ADT to work with PJSIP for android; android studio still does not support the NDK.