Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PJSip in android [closed]

Tags:

android

pjsip

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!

like image 535
Kingfisher Phuoc Avatar asked May 10 '12 09:05

Kingfisher Phuoc


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

like image 141
Rajesh Avatar answered Nov 10 '22 15:11

Rajesh


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

like image 42
James Avatar answered Nov 10 '22 15:11

James


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.

like image 2
EntangledLoops Avatar answered Nov 10 '22 15:11

EntangledLoops