5

I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP. I download the below things to build the PJSIP library:

  1. PJSIP from here

  2. Android NDK

  3. SWIG

...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.

Which Directory do I have to put the Android NDK into?

How to use SWIG to build the PJSIP?!

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Ahmed Gamal
  • 1,666
  • 1
  • 17
  • 25

1 Answers1

2

which Directory i have to put the Android NDK ?

Put it where you want, later you will setup the path to it

$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir 

how to use SWIG to build the PJSIP ?!

You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.

Updated

The steps to build sources are

  1. Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.

  2. Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet

    #define PJ_CONFIG_ANDROID 1
    #include <pj/config_site_sample.h>
    
  3. Open Cmd or Terminal

  4. Go to pjsip root folder (the downloaded sources)

    $ cd /path/to/your/pjsip/dir

  5. Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.

    $ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)

    SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)

  6. Perform build for target armeabi

    $ ./configure-android

If you need to perform build for target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags

target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags

target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags

  1. Compile sources

    $ make dep && make clean && make

nsinvocation
  • 7,559
  • 3
  • 41
  • 46
  • could you mention the steps to build the library ? – Ahmed Gamal Nov 24 '15 at 12:22
  • 1
    export is a linux command and doesn't work on Windows! Is it possible to build pjsip for android using windows based systems? – Muhammad Babar Mar 28 '16 at 11:38
  • SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir – nsinvocation Mar 28 '16 at 12:20
  • Thanks export works as i'm now using cygwin(a windows based linux command prompt). running command `$ ./configure-android ` from pjproject-2.4.5/pjsip. results in following error! -bash: ./configure-android: No such file or directory – Muhammad Babar Mar 28 '16 at 13:39
  • Running the ./configure-android command on root of the project runs the command but gives error `/cygdrive/d/pjproject-2.4.5 $ ./configure-android ./configure-android: line 3: $'\r': command not found ./configure-android: line 5: $'\r': command not found ./configure-android: line 71: syntax error near unexpected token `$'do\r'' '/configure-android: line 71: ` for i in $NDK_OUT; do` – Muhammad Babar Mar 28 '16 at 14:15
  • http://stackoverflow.com/questions/6473766/syntax-error-near-unexpected-token-in-r – nsinvocation Mar 29 '16 at 07:17
  • 2
    thanks, Now i'm stuck on `$ make dep && make clean && make` Please check my logs https://paste.ee/p/O64gr – Muhammad Babar Mar 29 '16 at 10:31