Android SIP with CSipSimple and pjsip - android

I am writing a custom Android application that allows the user to make VOIP calls using SIP. When the user presses a button, a voice call is initiated with another SIP user. That's it. The only other requirements are that it has to work on 2.3+ Android devices and must not be limited to wifi only.
Android already includes a SIP stack (as of 2.3) and I was able to modify the Walkie-Talkie sample project to work exactly how I wanted it to. Unfortunately I was not able to use this app with certain devices (Casio Commando being one of them), and worse, the application only works over wifi (as I mentioned, unacceptable for my project).
I started searching for another SIP stack with an easy to use API and came across CSimpleSip. I compiled it and ran their demo project (SipHome) and it worked perfectly on my unsupported phones (including the Commando) and it also worked over wifi, satisfying my requirements. I was so excited... until I looked at the source code for CSipSimple. I have no idea how to begin extracting out the actual calls to the underlying pjsip API, nor was I able to get the pjsip demo application working after 10+ hours.
Has anyone deconstructed CSipSimple and separated out the SIP parts from their incredibly complicated UI, or does anyone know of a simpler to use SIP library? With the native SIP API I was able to make a 200 line Android activity that made the call perfectly... how can I accomplish this with a third party SIP stack that supports non-wifi?
Thanks for any input, I know quite a few people have gotten stuck at this same stage.

Instead of going for the more complicated CSipSimple, you should maybe attack the most basic apjsua, which runs the same pjsip stack, so it should hopefully fit your requirements too: http://trac.pjsip.org/repos/wiki/Getting-Started/Android.

I totally agree with Balint, apjsua is the app which helps you for a better understanding, however it may be not obvious to start with it when you're not familiar with C (like I was) but it's much more efficient this way.
You can take a look to www.pjsip.org, take just care about the package you'll download because the tutorial isn't so clear: for instance they talk you a lot about apjsua (the android implementation of pjsua) and this app is not included in the download link they provide, you can see my question here about that:
where's apjsua?
And of course you'll have to watch the tutorial for android in the pjsip website.
Hope this helps.

Use csipsimple as a library project.There is a api in csipsimple project for using it as library.You can bind to csipsimple service and make calls.
Register broadcastrecievers and intent filters for get call back from csipsimple. Analyse Incall activity in csipsimple for more details.

Related

how to integrate VoIP in android application?

I want to make free calling application through net to mobile or land line call using VoIP. I have not much knowledge of VoIP. I get inspiration from using some application like line,Skype,etc. how can I achieve domestic and international call using VoIP in android application. I search lot about but I cannot get direct and easy to understand resource to get this task. so if any one have any idea or resource then most well come to achieve this task of my application.
You can use WebRTC,and here are compiling steps Getting Started, there is an working example project, WebRTCDemo for Android, where you can check how it's working. I used it in the real program, not just googled and answered, and it works perfectly well, also has STUN, TURN support.
You may use the Android SIP API to implement VoIP : http://developer.android.com/guide/topics/connectivity/sip.html
Here is a great tutorial : http://www.basic4ppc.com/android/forum/threads/android-sip-voip-tutorial.13088/
If you want to use 3rd party libraries,this one is good : http://www.sipdroid.org/
You can look at CSipSimple source code

SipApi not supported by some device

I am using native sip apis to implement sip calling in android app and it is working fine but in some devices like CANVAS 3 it was not working .After debugging I found this line of code was returning NULL
**manager = SipManager.newInstance(ctx);**
That measns that device does not support Sip Apis.But on the same device other application for sipcalling like SipDroid etc are working properly.How it is possible ?Are they do not use native sip Apis???
you can go with custom SipLibraries.
Third party open source sip stacks library for Android
Jain sip: http://jsip.java.net/
Pjsip: http://www.pjsip.org/
Mjsip: http://mjsip.org/mjua.html
Doubango: http://www.doubango.org/
There are different open source projects which have used these libraries in their projects.
Jain sip: Not used in a "famous" app.
Sipdroid uses MjSip
Csipsimple uses PjSip
Imsdroid uses doubango.
Open source SIP stacks: Android SDK's default implementation (API > 9)
Advantages : Documentation available. Easy to understand.
Disadvantages : Not all devices are supported due carriers restriction. Works on WiFi only. Can't change codecs.
Third party: JainSIP
Advantages : Oracle (Sun) project ==> Active development. Looks easier than MjSIP (more documentation).
Disadvantages : None
Android 2.3 using external JAIN-SIP(J-SIP) Stack | Classpath
Third party: MjSIP
Advantages : SipDroid is built on it. (source code available) (red5phone is another project)
Disadvantages : Not fully compliant with RFC?. Lack of tutorials (Javadocs available though).Development almost dead
Third party: Doubango framework
Advantages : IMSDroid is built on it. (source code available)
Disadvantages : Generated apk file size tend to be "heavy" (>15MB as mentioned here)
Followed from
Just to complement SilentKiller response I would forward my answer to this question but, please, keep in mind that choosing a stack is a quite complex task and depends of your goals and preferences.
Android SIP Stack relays on an old JAIN SIP version plus some extensions (IMS, supporting RTP, etc.). Main problem with this stack is that, in most devices, it only works via WiFi, no 3G or LTE (note that android.net.sip.SipManager contains method isSipWifiOnly to know if this limitation is enabled).
On the other hand, pjsip is quite complete, like they say, it's not a SIP stack but a full multimedia communications library. It's really versatile: you can use a huge number of configuration or just run it as a simple user agent. It works with any kind of data connection (not limited to WiFi).
Now the comparison: In my opinion, pjsip is more complete and versatile but more difficult to integrate with you project (with Android SIP Stack everything remains in the SDK environment while, with pjsip, you would need to use the NDK and a JNI library).
My opinion: If you plan to create a very simple SIP app and you don't mind the WiFi limitation, I think, the best would be using native SIP API but, if you plan to improve it and do something more "interesting", I would strongly recommend pjsip. I've used both JAIN SIP and pjsip and, again, my vote goes for psip. But this is just my opinion.
There's also another third party stack that worths checking: Linphone. It is also integrated into your project with a JNI (like pjsip) and is also quite complete but, maybe, a bit more complex and heavy.
Hope this helps.

Questions for VoIP app development (SIP etc.)

I am looking for general advice (technologies, best practice etc.) regarding the development of a VoIP application for Android. Similar questions have been posted, but I included specific questions.
I did quite some research and I noticed that there are several possible solutions (of course I know about the SIP stack in the SDK (also that it includes even voice transmission), but since it's not available on most devices, I don't intend to use it. Also, I read about Adobe Flex implementations but I would like to stick to something native).
What stuck to my mind is the following:
initiate the session using SIP (the server exists). Use SDP in the messages to discribe the session.
establish p2p connection (firewalls/routing may be a problem - STUN could be used - DNS may be involced than)
make actual transmission, I believe that the packets/procols involved are (payload) in -> RTP in -> UDP in -> IP.
This seems quite complicated at the moment so my first question is:
1)is this a standard approach? Is it best practice? I got some hints that, instead, MSRP could be used to transmit content, but I have read that it is only for IM, files etc.
2) Which SIP stack should I use for the best results/performance? I can use Java/Eclipse for development. I was thiking to choose JSIP (or tinysip, based on jsip) but am not sure.
3) Please give me a few hints about how to implement the data transmission in Java for Android (RTP)
As a last note, I am not excluding at all pjsip. I am thinking that it may be actually faster since it uses the NDK (I could switch to C++, np) . I also read that it already includes audio/video transmission.
I just don't know how easy it is to use and extend it and how good it really is. If you have used it, please let me know!
Thank you.
PS: Although not urgent or certain, portability may be an important factor for future.
I will need video transmission as well in the near future.
You should check out the IMSDROID project. It uses Doubango Framework which is written in C and is highly portable. What more, it is open sourced too so you can play around with their code and possibly contribute towards the community.
http://code.google.com/p/imsdroid/
cheers :)
Take a look at teamSpeak. They provide native sdk-s. But they aren't free.
It's not P2P, requires a server (at least as I know)
May worth a minute.
http://www.teamspeak.com/?page=teamspeak3sdk
Writing your own SIP stack takes a few months with only basic features.
I would recommend to use an existing sip stack. There are a few opensource discussed here.

What is the best way to add "Tweet" button to a C++ application for Android

I want to add a "Tweet" button to a C++ application without use of heavy libraries and frameworks. The application is portable and runs on Android and Windows.
I am not sure if I understand your setup. If you have implemented a native part of an Android app you can still write some java UI code and call your c++ code from there.
If you want to have a full portable solution though I would render simple button with help of OpenGL.
UPDATE Oh I see what you meant, so this is actually quite simple. For Android many people use Twitter4j which is not that "heavy". You can also implement API calls on your own, see the official docs. Besides, there are a couple of more possibilities on SO with links to some tutorials.
As for portability, it gets a bit trickier. I would stick with twitter API and implement HTTP calls directly. The quickest way to get it done in a portable way is to write a thin wrapper around the socket calls as someone here suggested.
You could also use Boost.Asio or cURL library, but I have not checked them personally. The latter is available for windows and has recently been ported to Android.
Hope that helps!

video call using android

I want to develop a app which uses 3G for video calling where secondary camera will be use for video call.
Is that possible to make video call? If it is possible please give me some reference or tutorial.
you should look for SIP protocol stack in android. There are various open source projects out there. look for SipDroid, IMSDroid is also a good example. And Sip Api is also available in Android after API level 9.
Another one worth looking at is the CSipSimple project. It is using pjsua as SIP library. The video call is developed in a branch of the project.
I have not tested it yet but it seems to work according to an issue. The issue starts getting interesting from comment 27 onwards since after that video calls seem to be working.
Check it out and look into it. It will probably take some time to find your way around the code at first.

Categories

Resources