I want to use G.729
audio codec on my android application. I have did a lot research on this and came to know that pjsip
is most promising solution
To integrate the G.729 codec into your PJSIP project, you just want to get Intel IPP compilers from Intel and you can integrate them into your project easily.
Follow this link.
First step is build pjsip
source code for Android (steps for Ubuntu Linux):
ANDROID_NDK_ROOT
environment variable to your NDK's root folder.pjlib/include/pj/config_site.h
including config_site_sample.h
(#include <pj/config_site_sample.h>
)./configure-android
make clean && make depend && make
After these steps, you will have several static libraries in several folders. I suggest to group them in a same folder (better in your project) by:
mkdir <your_project_path>/pjsip_libs
find . -name *.a | xargs -I % cp % <your_project_path>/pjsip_libs/
Once you've all libraries, you need to add those libraries into your project's Android.mk file, this is done by including a new module section per library. This module section should be something like:
include $(CLEAR_VARS)
LOCAL_MODULE := pjsua-arm-unknown-linux-androideabi
LOCAL_SRC_FILES := $(MY_PJLIB_PATH)/libpjsua-arm-unknown-linux-androideabi.a
include $(PREBUILT_STATIC_LIBRARY)
And, in the section you're actually building your JNI project's source code, add all modules to your static library references:
LOCAL_STATIC_LIBRARIES := pjsua-arm-unknown-linux-androideabi ...
This will include pjsip
references into your JNI library. Now, you need to configure a pjsip
UA instance.
You've a explanation about init and start pjsip
's UA (pjsua) in pjsip/include/pjsua-lib/pjsua.h
but main steps to follow are:
pjsua_create
pj_thread_create
Set default configuration for UA instance:
pjsua_config cfg; pjsua_logging_config log_cfg; pjsua_media_config media_cfg;
pj_cli_cfg_default(&app_config.cli_cfg.cfg); pjsua_logging_config_default(&log_cfg); pjsua_media_config_default(&media_cfg);
Init the stack with pjsua_init
pjsua_start
From here, you've plenty of configuration options (log, media, transport, etc.)
You can find a basic PJSIP tutorial here and, inside pjsip's source root path, you've a basic (but complete enough for a basic SIP usage) at: pjsip-apps/src/samples/simple_pjsua.c
Edit: When building android project in pjsip-apps, you can face a problem because pjsua-app is not generated by default on the general build (more specifically, pjsua: target is not included on all: target at pjsip-apps/build/Makefile). To fix this just go to pjsip-apps/build and run:
make pjsua
This would create proper object files at: pjsip-apps/build/output/pjsua-arm-unknown-linux-androideabi/ (needed when building android sample).
Once you've all corresponding object files, you can run ndk-build again at pjsip-apps/src/pjsua/android