I'm trying to build a Sip client
for android using pjsip
such as CSipSimple
project. However, i actually don't know much about pjsip
. Does anyone have a tutorial about pjsip or something like that to build a Sip softphone
in android using PJsip lib?
Any suggestion is welcome!

- 8,052
- 9
- 46
- 86
-
1Is there a tutoprial. Sadly I can't use the native SIP API. Any suggestions where to start? – Hannes Niederhausen Jan 05 '13 at 15:56
5 Answers
You do not have to use third-party libraries to build SIP client functionality in Android. Android includes a full fledged SIP API. You can take a look at SIP demo to understand how to use SIP APIs for a walkie-talkie type of implementation.

- 15,724
- 7
- 46
- 95
-
1Note that this will limit your application to Android version 2.3 [(API Level 9)](http://developer.android.com/guide/appendix/api-levels.html#level9) and higher, but I guess that is something like 75% of the user base – Paaske Jun 14 '12 at 14:19
-
According to Play Store statistics on [Platform Versions](http://developer.android.com/resources/dashboard/platform-versions.html), your guess is right (as on the day of this comment) – Rajesh Jun 14 '12 at 15:00
-
1this also limit your app to wi-fi only, which is not usefull.... do you know any other way to use pjsip except apjsua because apjsua is not working , i have spent days on it..... – maninder singh Oct 17 '12 at 09:48
-
I have heard good comments about [CSipSimple](http://code.google.com/p/csipsimple/). You may check it out. – Rajesh Oct 17 '12 at 10:10
-
3I have build CSipSimple successfully, but it is very challenging to change UI and make it work according to you and also there may be some legal issues while using their code. That's why I wanted a basic demo like apjsua which is provided by pjsip, but it is giving me error while registration. If you have worked on pjsip then it will be a great help for me. – maninder singh Oct 17 '12 at 13:43
-
Please post the issues faced by you as a new question and someone will be able to help you. – Rajesh Oct 17 '12 at 13:44
-
@Rajesh The link to SIP demo is not available anymore, please update the new link – onmyway133 Jan 10 '13 at 04:08
-
@entropy, the samples are no longer available on the developer site, they have to be downloaded using the SDK Manager. – Rajesh Jan 10 '13 at 04:46
-
@Rajesh i'm using Android Studio SDK Manager doesn't show any option to download samples! – Muhammad Babar Mar 25 '16 at 14:09
-
The post and the comments above are quite old. In fact, there was no Android Studio at the time of writing it. You can find the samples by doing a [web search](https://www.google.co.in/search?q=SIP+demo). – Rajesh Mar 25 '16 at 18:24
-
Define "full fledged". The provided SIP API is lacking in many respects, most notably for me: the ability to make any custom modifications to the audio stream and inability to fine tune SIP parameters by hand. – EntangledLoops May 16 '16 at 19:09
-
@Rajesh, I implemented full-fledged SIP API as per your suggestion, peer to peer SIP audio call is working fine, but not able to listen voice from both sides. I thought it's because of ICE and TURN server enable. How can I enable ICE and TURN server. Please help me. – Tushar Patil Mar 29 '18 at 04:51
i wouldnt recomment Android default sip stack to build a softphone. I have made a same mistake and had lots of issue. some of disadvantages i came across using android default sip stack
it doesnt support Dtmf tone
-
- it doesnt support video call
-it support quite a limited version of android and it would not going to support older version android, specially those non standard android version available on those cheap tablets.
So after wasting about a month , i have developmed entire app again using pjsip. It wasnt as easy as android sip stack ,but worth its feature

- 318
- 1
- 10
The accepted answer isn't entirely accurate. There are many desirable features missing from the Android SIP API that you may wish to achieve via a 3rd-party library.
With respect to the aforementioned pjsip, I've spent a great deal of time experimenting with the Android build of pjsip, and truthfully the only way to get reliable instantaneous registration to work as documented is to build the OpenSSL 1.0.2a library and pass it at configure time. Then in Java you need to attempt (and fail) to enable TLS communication, just as you see them do for UDP and TCP. Here is what I mean:
/* Create transports. */
try { transports.add( ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_TLS, transportConfig) ); }
catch (Throwable t2) { SipManager.log().e(t2); }
try { transports.add( ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, transportConfig) ); }
catch (Throwable t) { SipManager.log().e(t); }
try { transports.add( ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_TCP, transportConfig) ); }
catch (Throwable t) { SipManager.log().e(t); }
Replace the SipManager.log()
calls for your own app.
I'm not entirely sure why, but this is necessary for me. Otherwise, the registration process is semi-nondeterministic, in the sense that it will work after failing a few times, or fail for 5 minutes then suddenly succeed, etc. It seems to get confused after the 1st registration.
Here is how I configured:
TARGET_ABI=arm64-v8a ./configure-android --use-ndk-cflags --with-ssl=`pwd`/../3rd-party/openssl-1.0.2a
And that was after following the proper Android instructions, exrtacting the OpenSSL tarball into a folder above pjsip ../3rd-party/
and first building there. I described that process in some detail in a previous post.

- 1,951
- 1
- 23
- 36
i wouldnt use Android buildin Sipstack Api as a first option.It lacks lots of basic call functionality and doesnt support on lots of Android devices. I would rather suggest PJSip for production.

- 367
- 1
- 12
If you want to develop only sip client then you can use android's sip API but as mentioned in above answers it will limit your apps features. But if you want to develop chat or calling facilities in your app then you can use pjsip which provides many rich features. As for building pjsip for android, you can learn from here(android) and for ios,learn from here(ios). Basically, pjsip gives you many APIs with rich features which you can use as per your requirements like pjlib, pjsip, PJ media, pjsua etc. pjsua (or pjsua2 for android) are higher level API which helps you to extract maximum output with minimum complexities.you can see directly here.you can learn about pjsua from here. They have also provided a demo app (pjsua CLI) , Pjsua CLI and its source which will help you to understand the basic structure of an app to build with pjsip having chat and calling functions.
for Android, you can see a demo application at github.

- 1,781
- 17
- 27

- 405
- 3
- 12