How to build and run PJSIP 2.2 and higher versions with bdIMAD for Apple iOS

This chapter will describe how to compile PJSIP with bdIMAD and test it with PJSUA in Apple iOS environment (iPhone, iPad, iPod).

PJSIP

Once the PJSIP project has been downloaded from the PJSIP website, it is necessary to follow these additional steps to compile PJSIP and PJSUA with bdIMAD support. For general PJSIP compilation issues please refers to PJSIP wiki.

1] Create (or modify if present) the file config_site.h in the directory /pjlib/include/pj as below, in order to enable bdIMAD support and disable other I/O audio libraries:

1
2
3
4
5
6
7
8
9
10
11
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>
 
#undef PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
#undef PJMEDIA_AUDIO_DEV_HAS_WMME
#undef PJMEDIA_AUDIO_DEV_HAS_COREAUDIO
 
#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
#define PJMEDIA_AUDIO_DEV_HAS_WMME 0
#define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 0
#define PJMEDIA_AUDIO_DEV_HAS_BDIMAD 1
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>

#undef PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
#undef PJMEDIA_AUDIO_DEV_HAS_WMME
#undef PJMEDIA_AUDIO_DEV_HAS_COREAUDIO

#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO	0
#define PJMEDIA_AUDIO_DEV_HAS_WMME 0
#define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO	0
#define PJMEDIA_AUDIO_DEV_HAS_BDIMAD 1

2] Copy libbdIMADpj.a e libbdClientValidation.a libraries in PJDIR/third_party/lib.

Only for bdIMAD 2.0.0-beta:
– replace bdimad.h in PJDIR/third_party/bdsound/include getting the one from the Modified_Files/pjsip folder of the downloaded package.
– replace bdimad_dev.c in PJDIR/pjmedia/src/pjmedia-audiodev getting the one from the Modified_Files/pjsip folder of the downloaded package.

3] Create (or edit) in pjsip project directory PJDIR a file user.mak with the following lines:

1
LDFLAGS += -lstdc++ -lbdIMADpj -lbdClientValidation
LDFLAGS += -lstdc++ -lbdIMADpj -lbdClientValidation

4] Open a shell in pjsip project directory and launch this command line:

1
2
3
4
./configure-iphone 
make dep
make clean
make
./configure-iphone 
make dep
make clean
make

iPJSUA

1] Add this option lines to pjsua_app_config.h in PJDIR/pjsip-apps/src/pjsua:

1
2
3
4
5
"--auto-answer=200",
"--capture-lat=0",
"--playback-lat=0",
"--no-vad",
"--ec-tail=0",
"--auto-answer=200",
"--capture-lat=0",
"--playback-lat=0",
"--no-vad",
"--ec-tail=0",

2] Open ipjsua.xcodeproj using Xcode in PJDIR/pjsip-apps/src/pjsua/ios and add to linker option the following libraries:

1
-lbdIMADpj -lbdClientValidation -lstdc++
-lbdIMADpj -lbdClientValidation -lstdc++

3] Build the project and run it.

Fabio Cagnetti has written 15 articles