Android-ready JAIN-SIP library?
Asked Answered
B

3

5

Greets!

I am developing (trying to develop) a VoIP SIP application for Android, and after two weeks of bickering with mjsip, pjsip and the sdk's libraries, I have settled on JAIN-SIP. The libraries look great, in theory. No need to learn any android native code, lots of documentation (yet not enough, since I'm here), etc.

My first attempt was using the Android SDK's SIP libs (yes, I know they're based on JSIP), and it failed after the SipManager.open() refused to open the profile for communication with the server, with no exceptions or any sort of output to help me diagnose the issue. (If you have a potential solution please look here) After dicking around with mjsip and pjsip I decided that, being on a schedule, it would take too much time to figure out the native code, so JAIN seemed like the perfect solution... or is it?

Problem is- the JAIN SIP libraries use the same name, in the packaging, as java's core libraries, therefore causing a dex issue with dalvik. But ok- theres an "ant make all-android" solution to build the sip stack source into a single .jar prepared for android. WRONG. Only the "gov.nist" packages get refactored, leaving the "javax" packages as they were before, causing the same dalvik dex problems. But wait!- theres JarJar, a tool that repackages your jar and refactors the packages, resolving the dex conflict. WRONG. Repackaging using JarJar also renames the references to the actual javax.net packages that the stack requires for encryption and whatnot, causing exceptions and crashes and all sorts of issues. So I spent the majority of yesterday refactoring the javax libraries by hand, which led to

 ...Caused by: java.lang.Error: Unresolved compilation problem:

So here are my questions...

  1. Has anyone come across any android-ready jain-sip libraries that really work out of the box, without the need to rename,repackage, and refactor?
  2. Maybe my JarJar rules are wrong? Can someone provide me with rules to rename all the packages and references to "javax.sip" and "javax.sdp", but NOT "javax.net"?
  3. Are there any other SIP libs for android (that dont require any knowledge of the NDK or native code)?
  4. Why is this still such a pain in the back in 2014?

P.S. Before pointing me to a google page or other stackoverflow questions, consider that I've been stuck on this for two weeks now, doing nothing else but trying to solve the issue- I can assure you, the internet has been thoroughly searched and the solutions either don't apply or don't work.

Edit May 2016 - The accepted answer is now out of date, refer to thejoelpatrol's response below for the newer solution. HERE

Bant answered 18/9, 2014 at 9:21 Comment(2)
I admit this could be a good question, but there are some problems: 1) library recommendation is not accepted in SO. 2) is okay. 3) again, for the same reason as 1. 4). not constructive question. You might try to improve this question by telling what rules you have tried on JarJar. That way, people may know what's wrong. Other than that, perhaps Android VoIPers are really not many here.Nahshunn
1) Sorry, missed that rule. 2) Cool. 3) Same as 1. 4) Agreed. Still useful to know why building a message, sending it to a server and listening for a reply is possible, but gets so hectic when packaged into a library that basically does the same thing.Bant
M
2

The accepted answer is out of date. The official builds now include a version suitable for Android, linked from the homepage: https://jsip.java.net/

I'm using them now and can confirm that they work fine.

Munch answered 24/5, 2016 at 3:2 Comment(0)
H
5

You can find Android specific JAIN SIP packages renamed to com.telestax here https://mobicents.ci.cloudbees.com/job/jain-sip/ (android-jain-sip-ri jar) that we have built at TeleStax to overcome the native JAIN SIP Android issues. We are working on creating a Mobile SDKs that integrate WebRTC media as well so it's easier to implement messaging and video calls in native Android Apps We will create a blog post in the coming days on how to set things up. I'll update the thread here once this is done

Headstand answered 18/9, 2014 at 13:50 Comment(9)
The org.nist (com.telestax) packages are not the issue- The javax.sip.* and javax.sdp.* are the problem, since they use the same name as the JDK's(SDK's) core libraries.Bant
We are going to rename those to javaxx.sip and javaxx.sdp, if you have a better name, feel free to propose one. I'll update here when it's readyHeadstand
my attempt at renaming them was "jainx.**"Bant
The renaming to javaxx.sip and javaxx.sdp is complete. The gov.nist were renamed gov.nist.android also. You can find the latest jar at mobicents.ci.cloudbees.com/job/jain-sip/lastSuccessfulBuild/…Headstand
Awesomesauce! Customer support at its finest.Bant
Thanks Linas and here you have the tutorial for building a messaging chat application with it telestax.com/jain-sip-stack-for-androidHeadstand
Great! But I'd suggest NOT leaving the variable declaration part out of the tutorial :)Bant
Great tut! But I'd suggest NOT leaving the variable declaration part out of the tutorial. Also - show methods like createContactAddress() and createViaHeader(). Details are what usually get beginners like me :)Bant
Thanks for the feedback Linas. Let us improve the article and revert backHeadstand
M
2

The accepted answer is out of date. The official builds now include a version suitable for Android, linked from the homepage: https://jsip.java.net/

I'm using them now and can confirm that they work fine.

Munch answered 24/5, 2016 at 3:2 Comment(0)
A
0

There are a few extra gotchas but it's not hard to make your own build. It's really just 3-4 Eclipse commands away. Since there is so much demand I will make a proper script to do it, but I will aim for end of the month unless it's super urgent.

Ashly answered 18/9, 2014 at 9:59 Comment(1)
No longer urgent since I resorted to giving the Android SDK's libs another chance, and accidentally got some progress. But such a script would definitely benefit some other poor souls, and possibly, me if I decide to give JAIN another shot.Bant

© 2022 - 2024 — McMap. All rights reserved.