Using pjsip with android

2019-04-09 17:11发布

问题:

I successfully installed and builded the pjsip library and pjsua for android, I ran pjsua on my device and it worked, however I'm still lost on how to use the methods of this library.

I already took a look on the CSipSimple app and I noticed that the jni folders of these 2 projects are very different.

Do I have to convert each .c file of this library in .java files with SWIG? If anyone has an example about how to implement it in a very simple way (a SIP register procedure for instance) it would be helpful.

回答1:

It depends on how you would like to use the library.

The highest level API for pjsip is pjsua2 API, and there is already a java SWIG library build for you in the source code. You can just look at these examples.

http://www.pjsip.org/docs/book-latest/html/intro_pjsua2.html#building-python-and-java-swig-modules

However, if you don't need the sip signaling part, but just the media codecs and transportation part. You might have to design a JNI interfaces by yourself. You write the programs in C/C++ and link the libpjsua.so in the Android.mk file. for pjsua api C programming example: http://www.pjsip.org/docs/latest/pjsip/docs/html/group__PJSUA__LIB__BASE.htm

for pjmedia example: see the testing codes under pjmedia/src/test