PJSip155 and iPhoneSDK312

Da PiemonteWireless.

Indice

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:


Name (required):

Website:

Comment:

If you want you can write here comments and questions.
Tom said ...
00:09, 7 feb 2010 (CET)
excellent work!


Ravi said ...
07:11, 16 feb 2010 (CET)
Hi, 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


Simone said ...
07:24, 16 feb 2010 (CET)


matelo said ...
21:29, 18 feb 2010 (CET)
hello, thanks for this! I have it successfuly compiled and I found libraries (*.a) which i need. But i have problem to add it to my project in xcode. I added it as existing framework, but when i tried to use it (#include <libpjsua-lib/pjsua.h>) i am getting file not found build error. Can you help me how to add it? thanks


Simone said ...
02:20, 19 feb 2010 (CET)
You need to copy (or symlink) your pjproject directory in <your path>/siphon naming it "pjproject-svn". If you run an ls in your siphon root the result should be:

[...]
SettingsFaults.txt
Siphon
Siphon2
pjproject-svn
[...]

And the right include is:

  1. include <pjsua-lib/pjsua.h>


matelo said ...
18:31, 20 feb 2010 (CET)
thanks, but i have lib copied to my project and added to frameworks in xcode. I see an *.a files in my xcode project. I think that problem could be that when i am building my project I am getting this warning:

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...


Ravi said ...
03:49, 21 feb 2010 (CET)
Hi,
   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


Ravi said ...
03:51, 21 feb 2010 (CET)
Hi,
    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


Jack said ...
12:11, 28 feb 2010 (CET)
Hi,

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)


Jack said ...
12:15, 28 feb 2010 (CET)
Hi,

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)


Jack said ...
22:22, 28 feb 2010 (CET)
I just figured it out.

Thank you so much for this post!!!!!!!!!!

it was very helpful !! :-)
Paul V said ...
15:34, 10 mar 2010 (CET)
How can I configure and compile PjSIP 1.5.5 to work with it and siPhone in iPhone Simulator (3.1.2, etc.)?


Max said ...
00:05, 13 mar 2010 (CET)
please help, I get this error when trying to compile:

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


Brad said ...
18:58, 6 apr 2010 (CEST)
I am running into the same issue as a lot of the others who have posted. The library compiles fine, but there is no sound. The codec that I am using is g711/PCMU. Any ideas would be greatly appreciated.


Simone said ...
19:27, 6 apr 2010 (CEST)


Brad said ...
04:55, 8 apr 2010 (CEST)
Thanks Simone. I just assumed that there might be something that I was missing since GSM and g711/PCM are enabled by default from what I can see.


Oleg said ...
00:20, 11 apr 2010 (CEST)
First of all — thanks for great manual!

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


Alejandro Orellana said ...
15:00, 12 apr 2010 (CEST)
Great guide. i have followed all the steps successfully and compile a simple pjsua example.

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.


ankit said ...
10:27, 14 apr 2010 (CEST)
I got this error during compilation :

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..


ankit said ...
10:59, 14 apr 2010 (CEST)
I got this error during compilation :

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..


alder said ...
13:55, 16 apr 2010 (CEST)
Thanks for this useful guide.

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>?


Tim said ...
17:02, 12 mag 2010 (CEST)
Does this still hold true for pjsip 1.6? Fantastic job btw.


Brad said ...
23:47, 14 mag 2010 (CEST)
So has anyone been able to compile pjsip 1.5.5 with iphone OS 3.1.2 and actually have the sound work?

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.


Rick said ...
09:22, 15 mag 2010 (CEST)
Thanks for this great article. All is working good now!!!


Harris said ...
22:38, 18 mag 2010 (CEST)
Today I tried to compile PJSIP and got the same error like "Max" and "ankit"

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!


kudor gyozo said ...
10:46, 27 mag 2010 (CEST)
Got the following error. How do i solve it? thanks.

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


me said ...
12:18, 27 mag 2010 (CEST)
arm-apple-darwin*)

isn't this supposed to be

  • arm-apple-darwin*)

?

Otherwise it's not working!


me said ...
12:34, 27 mag 2010 (CEST)
that is supposed to be: *arm-apple-darwin*)


ankit said ...
12:43, 4 giu 2010 (CEST)
I tried as Harris said but the error remains the same.... I have checked the whole terminal process then i found that checking stdio.h presence... no

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???


Shakti said ...
13:36, 5 ago 2010 (CEST)
Thanks for the steps.

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'

1603 Rating: 2.8/5 (56 votes cast)

Strumenti personali