Research & Development
Thanks to Samuel who made this possible for iphone, the text below is taken from the following site with few modification to compile it successfully for iphone.
link: http://code.google.com/p/siphon/wiki/CompilationForiPhoneOS2_X
Lets begin, download the 1.0.x release of pjproject from the pjsip website, i have given link below for ease.
link: http://www.pjsip.org/download.htm
(note: GNU Linux/MacOS X/Unix users should use the .tar.bz2 version, so download the .tar.bz2 file else it won’t work)
Follow the following steps to modify few file, please carefully follow it as its a bit different from the one available at the above mentioned website.
note: before you begin, if you are copying directly from the site then be careful as some characters are not copied properly and can cause error when you try to compile pjsip.
Step 1: aconfigure.ac
In aconfigure.ac file add the lines below displayed with ‘+’. Of course copy without ‘+’
if test “$enable_sound” = “no”; then
true;
else
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”
if test “`uname -r`” = “6.8″; then
Step 2: build/rules.mak
In rules.mak modify, remove lines with ‘-’ and add lines with ‘+’:
$(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)
Step 3: pjlib/include/pj/config_site.h
It can be necessary to define some macro. For example :
#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
Step 4: pjmedia/build/os-auto.mak.in
In os-auto.mak.in, add the line with ‘+’
# – ds: Win32 DirectSound (dsound.c)
+# – iphone: iPhone AudioQueue (iphonesound.c)
# – null: Null sound device (nullsound.c)
Add the line below, for example between “Win 32 Direct Sound” and ” Null Sound Device”
#
# iPod/iPhone
#
ifeq ($(AC_PJMEDIA_SND),iphone)
export SOUND_OBJS = iphonesound.o
export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_IPHONE_SOUND
endif
We have defined a new target for sound device.
Step 5: pjmedia/include/pjmedia/config.h
in config.h add the lines below with ‘+’:
/** Constant for Win32 MME sound backend. */
#define PJMEDIA_SOUND_WIN32_MME_SOUND 3
+/** Constant for AudioQueue sound backend. */
+#define PJMEDIA_SOUND_IPHONE_SOUND 4
Almost there few steps more…
Step 6: pjmedia/src/pjmedia
Download iphonesound from the link below, rename it to iphonesound.c and paste it in the above mentioned directory.
link: http://siphon.googlecode.com/files/iphonesound-20091226.c
note: currently sound is disabled, but will get back to this, first follow the next 2 steps to get the lib compiled.
Step 7: Configuration
Generate configuration script
autoconf aconfigure.ac > aconfigure
Step 8: Compilation
iPhone SDK doesn't provide some programs without version number, so we create symbolic link. We should test before create link, but we are very lazy. Copy the lines below in file with name like compile.sh in the root of pjsip.
#!/bin/sh
export DEV=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK=${DEV}/SDKs/iPhoneOS2.1.sdk
pushd ${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
popd
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"
./aconfigure --host=arm-apple-darwin9 --disable-speex-aec \
--disable-speex-codec --disable-l16-codec --disable-g722-codec \
--disable-ilbc-codec --disable-ssl --disable-sound
make dep
make
We must not forget to change access right to allow execution. We can run compile.sh after some minutes pjsip is compiled.
Step 9: Now for Sound
Assume that you have been able to successfully compile the pjsip lib by now.
Now open iphonesound.c that you have pasted a little while back and uncomment and comment the following line(s).
//#if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_IPHONE_SOUND
#if PJMEDIA_AUDIO_LEG_HAS_AUDIOQUEUE
change the above to
#if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_IPHONE_SOUND
//#if PJMEDIA_AUDIO_LEG_HAS_AUDIOQUEUE
secondly search for the following in iphonesound.c
PJMEDIA_AUD_DEFAULT_CAPTURE_DEV
PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV
and replace with -1 and -2 respectively and now remove the ‘–disable-sound’ from the compile.sh you created and recompile.
That’s it … now you should have working pjsip lib and you can add this in the siphon project and you are good to go.
Comments and suggestion are welcome but please be constructive.
P.S. i have tested this on iphone 3Gs, 3G and 2G, sound in 2G is not that good but rest is working fine and in 3Gs and 3G sound is perfect.
Regards
Syed Arsalan Pervez aka SAP
Ravi
February 15th, 2010 at 5:32 am
Hi,
Thanks for the very useful tutorial and I am successfully compiled pjsip and now can you please let me know how should i add this pjsip into siphon and compile it so it can be able to run on simulator as well as device.
Thanks
Ravi Shankar
February 15th, 2010 at 10:52 pm
Hi,
Thanks for the information.
For the following
PJMEDIA_AUD_DEFAULT_CAPTURE_DEV
PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV
and replace with -1 and -2 respectively and now remove the ‘–disable-sound’ from the compile.sh you created and recompile.
Are u saying just replace these enum with -1 and -2 value. Iam trying to build pjsip 1.5.5 on iphone 3.1.2. The sound is not working. Appreciate your help. Thanks.
Ravi
Matt
March 4th, 2010 at 12:46 pm
Thank you very much for this detailed help. Unfortuantly I get an error on make:
for dir in pjlib pjlib-util pjnath third_party pjmedia pjsip; do \
if make -C $dir/build all; then \
true; \
else \
exit 1; \
fi; \
done
make -f /Users/matt/Downloads/pjproject-1.5.5/build/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
Please can you help me?
ZAREMA
March 19th, 2010 at 3:16 pm
Thanks the author for article. The main thing do not forget about users, and continue in the same spirit.
rizwan
March 29th, 2010 at 12:27 pm
Undefined symbols:
“_pjmedia_snd_get_dev_info”, referenced from:
_pjsua_enum_snd_devs in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
_close_snd_dev in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
_close_snd_dev in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
_pjsua_set_snd_dev in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
_pjmedia_conf_create in libpjmedia-arm-apple-darwin9.a(conference.o)
_pjmedia_conf_create in libpjmedia-arm-apple-darwin9.a(conference.o)
“_pjmedia_snd_get_dev_count”, referenced from:
_pjsua_enum_snd_devs in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
“_pjmedia_snd_init”, referenced from:
_pjmedia_endpt_create in libpjmedia-arm-apple-darwin9.a(endpoint.o)
“_pjmedia_snd_stream_start”, referenced from:
_start_sound_device in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_open”, referenced from:
_start_sound_device in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_stream_stop”, referenced from:
_pjmedia_snd_port_destroy in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_deinit”, referenced from:
_pjmedia_endpt_destroy in libpjmedia-arm-apple-darwin9.a(endpoint.o)
_pjmedia_endpt_create in libpjmedia-arm-apple-darwin9.a(endpoint.o)
“_pjmedia_snd_open_rec”, referenced from:
_start_sound_device in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_stream_close”, referenced from:
_start_sound_device in libpjmedia-arm-apple-darwin9.a(sound_port.o)
_pjmedia_snd_port_destroy in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_stream_get_info”, referenced from:
_pjsua_set_snd_dev in libpjsua-arm-apple-darwin9.a(pjsua_media.o)
_pjmedia_conf_create in libpjmedia-arm-apple-darwin9.a(conference.o)
_pjmedia_snd_port_set_ec in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_open_player”, referenced from:
_start_sound_device in libpjmedia-arm-apple-darwin9.a(sound_port.o)
“_pjmedia_snd_set_latency”, referenced from:
_app_init in pjsua_app.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [../bin/pjsua-arm-apple-darwin9] Error 1
make[1]: *** [pjsua] Error 2
make: *** [all] Error 1
rizwan
March 29th, 2010 at 12:29 pm
sorry forgot to write anything with the error code.
Ok now i can compile the libraries with disabled sound. But i when i compile with sound enabled, i get the following errors,,,,please help me out, Thanks
Vedgeorgo
March 30th, 2010 at 3:01 pm
i really enjoy all your writing style, very interesting,
don’t quit as well as keep writing as a result it just truly worth to follow it,
looking forward to browse additional of your own writing, have a great day
Free Samples
April 8th, 2010 at 11:10 pm
I gotta say, you’re blog is good..
ankit
April 14th, 2010 at 4:51 am
“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″
This is the error i have got after running make command. Plz anybody suggest me about this error.
RFID Reader
April 17th, 2010 at 7:20 pm
good share, great article, very usefull for us…thank you Your site is very useful for me .I bookmarked your site!
jordan shoes
April 19th, 2010 at 12:43 am
thank! for this news it’s a good infomation ! cheap jordan shoes
unlock iphone
April 19th, 2010 at 8:23 am
very well
information you write it very clean. I’m very lucky to get this information from you. .I bookmarked your site!unlock iphone
unlock iphone
April 19th, 2010 at 10:31 am
Nice article. Thank you for this info .I bookmarked your site!unlock iphone
Wholesale polo shirts
April 22nd, 2010 at 10:17 pm
Thank you very much for the information great post, found it on Yahoo.
cheap authentic nfl jerseys
April 23rd, 2010 at 1:24 pm
Thank you for your great
content.
seo hat
June 21st, 2010 at 1:14 pm
Thanks for the post!