Question

I'm trying to build a Sip client for android using pjsipsuch 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!

Was it helpful?

Solution

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.

OTHER TIPS

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

  1. it doesnt support Dtmf tone

    • it doesnt support video call
  2. -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

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top