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!
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.
it doesnt support Dtmf tone
-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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With