Tuesday 18 November 2014

PJSIP Setup Building for Android (VOIP VideoCall )without Server

PJSIP Setup Building for Android (VOIP VideoCall )without Server
Steps for Building Ubuntu+Android:
Requirements:
1)Install ​Android SDK,
 ​2)Android NDK (minimum version r8b).
3)​SWIG (minimum version 2.0.5)

Build Preparation:
1)   https://trac.pjsip.org/repos/wiki/Getting-Started/Download-Source#GettingfromSubversiontrunk
Download a source code from this link (This tutorial applies to PJSIP version 2.2 and above)
2) After downloaded extract the source and go to the following path
/pjproject-2.3/pjlib/include/pj/config_site.h
Set your config_site.h to the following:
#define PJ_CONFIG_ANDROID 1 #include <pj/config_site_sample.h>

This will activate Android specific settings in the config_site_sample.h.

Building PJSIP
Just run:
$ /pjproject-2.3
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
$ ./configure-android
$ make dep
&& make clean
&& make
Building and running pjsua sample application:
We have pjsua sample application located under pjsip-apps/src/pjsua/android. It is not built by default, and you need ​SWIG to build it.
Follow these steps to build pjsua:
Run ndk-build from directory:
 $PJDIR/pjsip-apps/src/pjsua/android (note that the Android NDK root should be in the PATH),
 e.g:$ /pjproject-2.3
$ cd pjsip-apps/src/pjsua/android
 $ ndk-build(Path of your NDK-Build Setup path)
After given ndk-build give enter it will take setup and if you get any error related (error: exception handling disabled, use -fexceptions to enable)
Just open the Android.mk file in (pjproject-2.3/pjsip-apps/src/pjsua/android/jni)edit that file to add this line of code in
# Android build settings(In Android.mk file)
LOCAL_CPPFLAGS += -fexceptions
After this save this file and again give these
$ cd pjsip-apps/src/pjsua/android
 $ ndk-build(Path of your NDK-Build Setup path)
then you will sucessfully created .so created

After this we get a .so file for android then go to this path
pjproject-2.3/pjsip-apps/src/pjsua/android

Import this project to your eclipse it will get run without error and displays the localhost and port of the device once you will get the localhost and port your sucessfully pjsip configured for Android


Building and running pjsua2 sample application:
Another sample application, which is based on pjsua2 high-level API with SWIG binding, is located under pjsip-apps/src/swig/java/android. It is not built by default, and you need ​SWIG to build it.
Follow these steps to build pjsua2 sample application:

1)Make sure SWIG is in the build environment PATH.
2)Run make from directory $pjproject-2.3/pjsip-apps/src/swig

$ pjproject-2.3
$ cd pjsip-apps/src/swig
$ make

3)Create Android project from pjsua. In Eclipse:
a)From menu: File --> New --> Project
b)Select Android Project from Existing Code, press Next
c)In Root Directory, put the location of pjsua2 source code (i.e. $PJDIR/pjsip-apps/src/swig/java/android) and press Finish

4)You may need to select different Android SDK than what is configured in pjsua2. You can do this from the project's Properties.
5)Run it.

These is the Final setup for PJSIP for building Android in ubuntu .If you want more information just see this link

https://trac.pjsip.org/repos/wiki/Getting-Started/Android