Android-ready JAIN-SIP library? - java

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

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

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.

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.

Related

Compiling LibGDX on Android with Jvdroid

I am getting back to coding Java after two years, which I sorely missed. I need to set up an environment on Android for game making, so I purchased Jvdroid for the ability to process Maven files from GitHub on my phone. Jvdroid resembles a similarity to IntelliJ from JetBrains with much less features. LibGDX offers a Project making executable JAR, yet the file limits it self only to Desktop operating systems.
My problem then focuses on getting a LibGDX Project for a hopefully simple set up. It is possible that Jvdroid may still say no to downloading required libraries for compiling. I will not be able to use LibGDX I think on Android, if that proves true.
I am familiar enough with GitHub, where I can just download a working sample Project for LibGDX from a different programmer's repository or LibGDX's own. Flappy Bird is a bad example, but that serves just to give you an idea.
If that concept fails, then I would possibly consider an alternate game engine like Cocos2D or Haxe. I need some thing with GLTF file support in the future, because of my love for Daz3D. I also restrict my coding to Java.
I appreciate insight for how LibGDX may possibly compile and run on Android. I believe producing an APK would be comparably good effort at that far of a point. I am aware a couple of other programmers have successfully done such with minimal Project files at the least of it all.
Thank you for reading and your time.
Not familiar with Jvdroid, but I would have looked at Termux and see if your device's OS version is compatible and your device has adequate storage (RAM/Flash). Termux simulates a Linux terminal environment (with limits), so it helps to be familiar with the command line interface. Do realize that there are preferred places to download as Google Play policies no longer compatible.
A quick search brings up projects like: https://github.com/ravener/libgdx-termux which may be a jumping off point.
Of course, if you can do development on a PC - your experience will be better, due to each new Android version adding restrictions to such an environment.

Android VoIP call implementation

First of all I'm a newbie in VoIP implementation. I need to implement VoIP single and group call in android application. Could you tell me, what is actually the best way to achieve this ? I'm looking for Android SIP library (probably open source) which should:
has good documentation with simple app examples
be ready to use with java
Maybe just native android SIP api will be the best ? But I heard that it doesn't support group calls.
Most of the voip libraries use C/C++ implementation for various reasons. You can use PJSip which is a C voip/sip stack. It has a good documentation but you have to build it yourself using android ndk . It has good documentation and also contains processes to build it for Android and other platforms. But there is no java/android wrapping built in so you should do that yourself. Another option is Liblinphone which is also based on C stack but provides all of the wrapping and implementations out of the box so you don't have to bother so much on native codes. It also has a sample application which you can try yourself. One downside of Liblinphone is that it lacks proper documentation and you have to dig in more.
Regarding the android SIP api, I don't think it is a good option as it has much more limitation and hardly maintained. It is based on Jainsip stack which is a 100% java stack but is too verbose. I personally would like to recomment Liblinphone as I am currently implementing it and am pretty satisfied with it. Best of luck...
Update
Here is the source code of linphone for android if you are interested in it. You can get pretty much idea of Liblinphone for android from it. You have to dig much more into the sources though.
You can have a look at Restcomm Android SDK:
It's open source, with an active community around it
It using SIP for signaling and Webrtc for media so should work nicely with NATs, etc
Comes with 2 sample applications that you can play with and alter their code to experiment
Comes with quick start guide, reference doc
You can check the Olympus sample App right away by installing the .apk from this link
Notice that the SDK doesn't support group calling out of the box, but you could combine it with Restcomm-Connect open source platform to add such functionality very easily. Restcomm-Connect also comes with docker, so you should be able to install it right away.
Please let me know if you have any questions
Best regards,
Antonis

Compiling this OCR Library Code

I came upon this simple Library that someone wrote in java GetImageText.java for OCR in images so i tried compiling it on my Ubuntu via terminal but i get several error as shown below in this paste :
Compilation Errors
Can Someone help me with it , it is absolute necessity that i test this code , its explanation can be found here
I think the problem is that i do not have com.sun.image.code.jpeg in my system, although java is definitely installed. Although I am not sure how to import this package without using an IDE.
The problem is that the library you are trying to recompile depends on INTERNAL classes1. Portable libraries are not supposed to do that!
What has happened is that the class has been removed or replaced. This happens from time to time, and that is the reason that people are not supposed to write code that depends on INTERNAL classes.
Solutions:
Bug the authors of the library to fix the problem.
Figure out which version(s) of Java that the library supports, and stick with those.
Find an alternative library that supports the version(s) of Java that you need.
Non-solution: Compiling the library on an older version of Java and running on a newer one is likely to fail. The class needs to be present at runtime, as well as at compile time.
1 - Anything in the "com.sun" tree counts as INTERNAL. Sometimes people have no choice but to have such a dependency. However, they still needs to deal with the potential consequences for portability.

Implementing PPTP/L2TP Protocols on Android +14

I am working on an Android app using Android Studio v 1.4 and the minimum sdk version is 14 and what I am trying to do is building a simple VPN client that implements PPTP and L2TP protocols.
I have googled and searched here in Stack Overflow and I have looked at the Android sdk VPN sample called toyvpn and also looked at the official documentation for the VPN Service class.
How to implement PPTP or L2TP with VpnService on Android Platform?
Is there any code samples,libraries or even a starting point to such an implementation.
The question is an interesting one. There is a fundamental flaw though in how it is phrased. I think the question is too general. However, I still think it is useful for direction.
First as others are saying VPN's are very complicated and I am sure many others would recommend not taking that on. However, there are many solutions for your needs. You mention PPTP.
"Don’t use PPTP. Point-to-point tunneling protocol is a common protocol because it’s been implemented in Windows in various forms since Windows 95. PPTP has many known security issues..." taken from this article.
The going recomendation is to use OpenVPN. Now if you go to their site they ofter already built software at a price. I assume this is not what you are looking for in the end.
What you can do is leverage the OpenVPN libraries and build it out yourself. Since it is opensource you can use the libraries for your benefit but you have to do the implementation work. What I have found for you is the GitHub repository where OpenVPN is leveraged in Android.
Source
I would certainly take a look here. It is probably a useful example that you can build from. This way you can come back and ask code specific questions if you are hitting a wall.
Lastly, VPN's are a two way street. Having it on the Android( client ) side still requires a server side implementation. So I would also think this article would be a beneficial part of the learning process.
I hope this helps.

Why I can't use JMF on Android?

I don't really have or want to use the Java Media Framework (JMF) on Android but I am looking for detailed information about why it's not possible to use it. (I know that it's considered as outdated anyway and I am aware that there may be better ways to achieve certain things in Android using this for example: http://developer.android.com/guide/topics/media/index.html)
Nevertheless I need more information regarding JMF on Android but all I could find is, that "JMF isn't working on Android" - but I wonder why.
So I have two questions:
Do you know any kind of "official" statement, for example from Google or Oracle, saying that JMF isn't supported on Android? I wasn't able to find something like that.
Why is JMF supposed to be not working on Android? I am interested in the technical details and would be grateful for all kind of references.
Thank you!
EDIT:
To be a bit more specific and clarify my approach: I built a tiny test-app and tried to play an audiofile the same way as I have done in a standard java desktop application (which was working as expected). I included the JMF.jar (for now without any modification) compiled, deployed and started the app - no problems so far. The (first) exception (javax.media.NoPlayerException) is thrown when calling Manager.createPlayer().
That was actually the point where I stopped and wondered if it's worth digging deeper, although the result is kind of predictable. I decided to ask about the technical background first, instead of figuring it out the hard way in hours of testing and debugging (the reason is not a lack of interest but unfortunately a matter of time at the moment).
I am looking for detailed information about why it's not possible to use it
Because it was not included in the Android SDK. Lots of things from Java SE were not included in Android.
Do you know any kind of "official" statement, for example from Google or Oracle, saying that JMF isn't supported on Android?
I am not aware of such a statement. They also have not released a statement indicating why Android does not integrate with the Hubble Space Telescope, why it does not include shoe-shining APIs, etc. There are an infinite number of things that are not in Android; it would be impossible to list them all.
More generally, Google faces pressure to keep a lid on firmware size, as the bigger the firmware, the more expensive things get (required storage, OTA update costs, etc.). Hence, they only include a subset of the Java SE SDK as one way of helping reduce firmware bloat.
Why is JMF supposed to be not working on Android?
Because it was not included in the Android SDK. I have no idea if it is possible, let alone practical, to create a fork of JMF that offers a JMF-like API but uses Android media capabilities under the covers.

Categories