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...
- 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?
- 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"?
- Are there any other SIP libs for android (that dont require any knowledge of the NDK or native code)?
- 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
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.
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
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.
来源:https://stackoverflow.com/questions/25908817/android-ready-jain-sip-library