PJSip155 and iPhoneSDK312
Da PiemonteWireless.
How compile PJSip 1.x (svn trunk or 1.5.5) with iPhone SDK 3.1.2
Thanks to huge work of PJSip team and to Samuel Vinson for iphonesound.c code.
Checkout the latest svn trunk version of PJSip from here:
http://svn.pjsip.org/repos/pjproject/trunk
or download the latest PJSIP from here:
http://www.pjsip.org/download.htm
First step, you need to patches some files in pjproject:
In aconfigure.ac
case $target in
+ arm-apple-darwin*)
+ LIBS=”$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox”
+ ac_pjmedia_snd=iphone
+ AC_MSG_RESULT([Checking sound device backend... AudioQueue])
+ ;;
*darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
In build/rules.mak
$(LIB): $(OBJDIRS) $(OBJS) $($(APP)_EXTRA_DEP)
if test ! -d $(LIBDIR); then $(subst @@,$(subst /,$(HOST_PSEP),$(LIBDIR,$(HOST_MKDIR; fi
-$(AR) $(LIB) $(OBJS)
-$(RANLIB) $(LIB)
+$(RANLIB) -static -o $(LIB) $(OBJS)
Create pjlib/include/pj/config_site.h
#undef PJ_HAS_FLOATING_POINT
#define PJ_HAS_FLOATING_POINT 1
/* SRTP has not been ported to iPhone yet */
#undef PJMEDIA_HAS_SRTP
#define PJMEDIA_HAS_SRTP 0
/* Disable some codecs for now */
#define PJMEDIA_HAS_GSM_CODEC 1
#define PJMEDIA_HAS_L16_CODEC 0
#define PJMEDIA_HAS_ILBC_CODEC 0
#define PJMEDIA_HAS_SPEEX_CODEC 0
#define PJMEDIA_HAS_G722_CODEC 0
#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
In pjmedia/build/os-auto.mak.in
# - ds: Win32 DirectSound (dsound.c)
+# - iphone: iPhone AudioQueue (iphonesound.c)
# - null: Null sound device (nullsound.c)
e
export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
endif
+#
+# iPod/iPhone
+#
+ifeq ($(AC_PJMEDIA_SND),iphone)
+export CFLAGS += -DPJMEDIA_AUDIO_LEG_HAS_AUDIOQUEUE=1 -DPJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE=1
+endif
+
#
# Null sound device
In Makefile
-DIRS = pjlib pjlib-util pjnath third_party pjmedia pjsip pjsip-apps
+DIRS = pjlib pjlib-util pjnath third_party pjmedia pjsip
In pjmedia/build/Makefile
export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
alaw_ulaw.o alaw_ulaw_table.o bidirectional.o clock_thread.o codec.o \
conference.o conf_switch.o delaybuf.o echo_common.o \
echo_port.o echo_suppress.o endpoint.o errno.o \
g711.o jbuf.o master_port.o mem_capture.o mem_player.o \
null_port.o plc_common.o port.o splitcomb.o \
resample_resample.o resample_libsamplerate.o \
resample_port.o rtcp.o rtcp_xr.o rtp.o \
sdp.o sdp_cmp.o sdp_neg.o session.o silencedet.o \
- sound_legacy.o sound_port.o stereo_port.o \
+ iphonesound.o sound_port.o stereo_port.o \
stream.o tonegen.o transport_adapter_sample.o \
transport_ice.o transport_loop.o \
transport_srtp.o transport_udp.o \
wav_player.o wav_playlist.o wav_writer.o wave.o \
wsola.o
e
# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
#
-TARGETS := pjmedia pjmedia-audiodev pjmedia-codec pjsdp pjmedia-test
+TARGETS := pjmedia pjmedia-audiodev pjmedia-codec pjsdp
all: $(TARGETS)
In pjmedia/src/pjmedia-audiodev/legacy_dev.c
return status;
}
*p_aud_strm = &strm->base;
+ (*p_aud_strm)->op = &stream_op;
return PJ_SUCCESS;
}
In pjmedia/src/pjmedia-audiodev/audiodev.c
pjmedia_aud_dev_factory* pjmedia_symb_mda_factory(pj_pool_factory *pf);
#endif
+#if PJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE
+pjmedia_aud_dev_factory* pjmedia_legacy_factory(pj_pool_factory *pf);
+#endif
+
#define MAX_DRIVERS 16
#define MAX_DEVS 64
e
#if PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA
aud_subsys.drv[aud_subsys.drv_cnt++].create = &pjmedia_symb_mda_factory;
#endif
+#if PJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE
+ aud_subsys.drv[aud_subsys.drv_cnt++].create = &pjmedia_legacy_factory;
+#endif
/* Initialize each factory and build the device ID list */
for (i=0; i<aud_subsys.drv_cnt; ++i) {
Now you need the bridge between pjsip and iphone sdk:
Download iphonesound.c
Download from http://siphon.googlecode.com/files/iphonesound-20091226.c and rename in pjmedia/src/pjmedia/iphonesound.c
Now setup a develop environment:
Env variables
export DEV=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK=${DEV}/SDKs/iPhoneOS3.1.2.sdk
export PATH=${DEV}/usr/bin:${PATH}
export CFLAGS="-O2 -arch armv6 -isysroot ${SDK}"
export LDFLAGS="-O2 -arch armv6 -isysroot ${SDK}"
export CPP="${DEV}/usr/bin/cpp"
Symb links to arm compiler
cd ${DEV}/usr/bin
ln -s arm-apple-darwin9-gcc-4.0.1 arm-apple-darwin9-gcc
ln -s arm-apple-darwin9-g++-4.0.1 arm-apple-darwin9-g++
ln -s ranlib arm-apple-darwin9-ranlib
It's time to start compilation, finally!!!!
Generate conf
autoconf aconfigure.ac > aconfigure
Compilation
./aconfigure --host=arm-apple-darwin9 --disable-speex-aec \
--disable-speex-codec --disable-l16-codec --disable-g722-codec \
--disable-ilbc-codec --disable-ssl
make dep
make
If you have no errors, you'll find in libs directories the libraries you need.
Riferimenti:
http://www.piemontewireless.net/Compile_available_codecs_in_PJSip_with_iPhoneSDK312
to configure codecs.
[...]
SettingsFaults.txt
Siphon
Siphon2
pjproject-svn
[...]
And the right include is:
- include <pjsua-lib/pjsua.h>
ld: warning: in /Users/matelo/Documents/xcode/sipMobile/lib/libpj-arm-apple-darwin9.a, file is not of required architecture I have built pjsip according to this tutorial...
Thanks for the information. saved me lot of time. I have a problem with the sound. The sound doesnt seem to work. I followed the procedure mentioned above. Is there anything i need to do to make the sound work. Please help. Thanks.Ravi
I tried compiling the codecs as well. Everything is working fine except for the sound. Did you get the sound working. If so, do we need to do anything special to get the sound working with pjsip 1.5.5.Ravi
i really need your help!! i did everything as explained in here, but still no luck. i maneged to create all the *.a files, and i think i did all the linking in the info file of the project right. the problem is that i get 118 errors when compiling the project. (all has to do specifically with the *.a files, and not with the including or something). for example:"_pj_timer_heap_set_lock", referenced from:_pjsip_endpt_create in libpjsip-arm-apple-darwin9.a(sip_endpoint.o)
i really need your help!! i did everything as explained in here, but still no luck. i maneged to create all the *.a files, and i think i did all the linking in the info file of the project right. the problem is that i get 118 errors when compiling the project. (all has to do specifically with the *.a files, and not with the including or something). for example:"_pj_timer_heap_set_lock", referenced from:_pjsip_endpt_create in libpjsip-arm-apple-darwin9.a(sip_endpoint.o)
Thank you so much for this post!!!!!!!!!!
it was very helpful !! :-)
rules.mak APP=PJLIB app=pjlib ../lib/libpj-arm-apple-darwin9.a .pjlib-arm-apple-darwin9.depend:1: *** missing separator. Stop. make[1]: *** [pjlib] Error 2
make: *** [all] Error 1
http://www.piemontewireless.net/Compile_available_codecs_in_PJSip_with_iPhoneSDK312
I have done all steps and have compiled libs. But while building Xcode project with linked libs, I have error:
...../compat/setjmp.h:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pj_jmp_buf'
Screen shot: http://grab.by/3FCO
however when i make a call, i have no audio. the logs are fine. signaling looks good even seems like the rtp streams are good and connected to the proper ports in pjsip, but no audio., nothing.
I see some people here also have the same problem.
any help it would be much appreciated.
ld: framework not found CoreServices collect2: ld returned 1 exit status make[2]: *** [../bin/pjlib-test-arm-apple-darwin9] Error 1 make[1]: *** [pjlib-test] Error 2 make: *** [all] Error 1
please help..
ld: framework not found CoreServices collect2: ld returned 1 exit status make[2]: *** [../bin/pjlib-test-arm-apple-darwin9] Error 1 make[1]: *** [pjlib-test] Error 2 make: *** [all] Error 1
please help..
I was just wondering if these steps work if I have to compile and use the libraries for the iphone simulator and not the iphone device, since i want siphon to work on iphone simulator. Are there any changes to do? I'd like to know if any of you succeeded in doing that.
Also, where exactly you add the include <pjsua-lib/pjsua.h>?
I am able to compile things just fine and connect a call, but I have am not getting any audio. It shouldn't be the case of a wrong codec because both g711 or GSM are both included in the build.
Any feedback, tips and or tricks that you anyone used to get the audio to work after call connection would be greatly appreciated.
I currently have a build of pjsip 1.0.3 that compiles with iphone OS 3.1.2 with sound, but I would like to run pjsip 1.5.5 to take advantage of all of the fixes and new functionality.
Here is how I solved the problem:
After I performed the above instruction I’ve got this error after “make”: make[1]: *** [pjlib] Error 2 make: *** [all] Error 1
I successfully solved the problem by opening the "build/rules.mak" file again and changed the "+$(RANLIB) -static -o $(LIB) $(OBJS) " line to "libtool -static -o $(LIB) $(OBJS)" After that, it compiles well for me!
I hope this will help someone!
ld: framework not found CoreServices collect2: ld returned 1 exit status make[2]: *** [../bin/pjlib-test-arm-apple-darwin9] Error 1 make[1]: *** [pjlib-test] Error 2 make: *** [all] Error 1
isn't this supposed to be
- arm-apple-darwin*)
?
Otherwise it's not working!
aconfigure: WARNING: stdio.h: accepted by the compiler, rejected by the preprocessor! aconfigure: WARNING: stdio.h: proceeding with the compiler's result
may be this will cause error but how to solve that???
I follow all the steps. and got following errors and warnings aconfigure: creating ./config.status ./config.status: line 340: Data/Latest: No such file or directory ./config.status: line 389: Try: command not found ./config.status: line 416: s/./-/g: No such file or directory ./config.status: line 416: s/^.../##: No such file or directory ./config.status: line 416: s/...$/: No such file or directory ./config.status: line 418: _ASBOX: command not found
This file was extended by pjproject config.status 1.x, which was generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = CONFIG_HEADERS = CONFIG_LINKS = CONFIG_COMMANDS = $ ./config.status
on Shakti-iPhone.local
./config.status: line 420: syntax error near unexpected token `}' ./config.status: line 420: `} >&5'

