Search code examples
javaandroidvoippjsip

How to use PJSIP on Android?


I lost hours of searching and reading. I didnt really understand how to work with PJSIP.

I have some questions about it:

  1. Can you explain how actually this library is used when developing for Android?
  2. When I build the library do I use only Java code or defintely I'll have to write in C++?
  3. My goal is encrypted VOIP Application for Android.
  4. Is there a good documentation with description of all methods, fields and constructors?
  5. Do you have any references to some tutorials or samples?

Solution

  • 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.