I am trying to add PJSip to a project that I am working on. I have this method for registering my account, but every time a "Fatal signal 11" error occurs.
Here is the method
public int setRegistration() { int status = pjsuaConstants.PJ_FALSE; int[] accId = new int[1]; accId[0] = 1; String uName = getUserName(); String passwd = getPassword(); String server = getSIPServer(); pjsua_acc_config acc_cfg = new pjsua_acc_config(); pjsua.acc_config_default(acc_cfg); acc_cfg.setId(pjsua.pj_str_copy("sip:" + uName + "@" + server)); acc_cfg.setReg_uri(pjsua.pj_str_copy("sip:" + server)); acc_cfg.setCred_count(1); acc_cfg.getCred_info().setRealm(pjsua.pj_str_copy(server)); acc_cfg.getCred_info().setScheme(pjsua.pj_str_copy("digest")); acc_cfg.getCred_info().setUsername(pjsua.pj_str_copy(uName)); acc_cfg.getCred_info().setData_type(pjsip_cred_data_type.PJSIP_CRED_DATA_PLAIN_PASSWD.swigValue()); acc_cfg.getCred_info().setData(pjsua.pj_str_copy(passwd)); Log.d("status", "acc is adding.."); status = pjsua.acc_add(acc_cfg, pjsuaConstants.PJ_TRUE, accId); Log.d("status", "acc is added"); if (status == pjsuaConstants.PJ_SUCCESS) { status = pjsua.acc_set_online_status(accId[0], 1); Log.d("acc_set_online_status returned stauts=", String.valueOf(status)); } else { Log.d("Error status=", String.valueOf(status)); } return status; }
I get an error in the line status = pjsua.acc_add(acc_cfg, pjsuaConstants.PJ_TRUE, accId); . I know that the username, server and password are not null. I have considered several issues regarding this and am not using it.
How can I register my account?
thanks
***** EDIT ****** After tracking this through blogs and forums, I got this error, but got another. The reason for this error was because pjsua_init never successful. It was successful because it gave me this error
11-04 10:19:20.973: E/AndroidRuntime(2961): FATAL EXCEPTION: main 11-04 10:19:20.973: E/AndroidRuntime(2961): java.lang.UnsatisfiedLinkError: Native method not found: org.pjsip.pjsua.pjsuaJNI.init:(JLorg/pjsip/pjsua/pjsua_config;JLorg/pjsip/pjsua/pjsua_logging_config;JLorg/pjsip/pjsua/pjsua_media_config;)I 11-04 10:19:20.973: E/AndroidRuntime(2961): at org.pjsip.pjsua.pjsuaJNI.init(Native Method) 11-04 10:19:20.973: E/AndroidRuntime(2961): at org.pjsip.pjsua.pjsua.init(pjsua.java:812)
I also received this warning
No implementation found for native Lorg/pjsip/pjsua/pjsuaJNI;.init (JLorg/pjsip/pjsua/pjsua_config;JLorg/pjsip/pjsua/pjsua_logging_config;JLorg/pjsip/pjsua/pjsua_media_config;)I
Why is this not a native method? I look through the libraries that I named, but apart from that I donβt know why this is not working.
Any help on this would be great. Thanks
PJ Code
pjsua.java
public synchronized static int init(pjsua_config ua_cfg, pjsua_logging_config log_cfg, pjsua_media_config media_cfg) { return pjsuaJNI.init(pjsua_config.getCPtr(ua_cfg), ua_cfg, pjsua_logging_config.getCPtr(log_cfg), log_cfg, pjsua_media_config.getCPtr(media_cfg), media_cfg); }
pjsuaJNI.java
public final static native int init(long jarg1, pjsua_config jarg1_, long jarg2, pjsua_logging_config jarg2_, long jarg3, pjsua_media_config jarg3_);
pjsua_wrap.cpp
SWIGEXPORT jint JNICALL Java_org_pjsip_pjsua_pjsuaJNI_init(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jint jresult = 0 ; pjsua_config *arg1 = (pjsua_config *) 0 ; pjsua_logging_config *arg2 = (pjsua_logging_config *) 0 ; pjsua_media_config *arg3 = (pjsua_media_config *) 0 ; pj_status_t result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; (void)jarg3_; arg1 = *(pjsua_config **)&jarg1; arg2 = *(pjsua_logging_config **)&jarg2; arg3 = *(pjsua_media_config **)&jarg3; result = (pj_status_t)pjsua_init((pjsua_config const *)arg1,(pjsua_logging_config const *)arg2,(pjsua_media_config const *)arg3); jresult = (jint)result; return jresult; } {"init", "(JLorg/pjsip/pjsua/pjsua_config;JLorg/pjsip/pjsua/pjsua_logging_config;JLorg/pjsip/pjsua/pjsua_media_config;)I", (void*)& Java_org_pjsip_pjsua_pjsuaJNI_init},
EDIT 2
So, after working on this, I came to disappointment. I donβt see what I'm doing wrong, so I will put my whole process here to find out if anyone has a suggestion.
- I start by getting the pjsip library:
svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject - run `./configure --prefix = / usr / local
- make dep and make
sudo make install
Then I get the code pjjni svn checkout svn://svn.code.sf.net/p/pjsip-jni/code/ pjsip-jni-code
- I follow the makefile instructions
- After executing the Makefile (after some code cleaning) I have 2 .so files (libpjsua_jni.so and libpjsua_jni_x64.so)
- Create jni folder with Android.mk and .so files
- Run ndk-build ( How to load another .so file into an Android project? )
- Add to ADT
- Close the project. Change your native support from Java to Android. Open project ( Convert existing project to Android project in Eclipse? )
- Add this project to the TestPJ project (
Android -> Library -> Add ) - Call
System.loadLibrary("pjsualib") - The name of the new lib.so Error receiving
11-22 13: 55: 44.784: W / dalvikvm (11464): implementation not found for native Lorg / pjsip / pjsua / pjsuaJNI; .swig_module_init :() V 11-22 13: 55: 48.792: W / dalvikvm (11464) : Ljava / lang / UnsatisfiedLinkError exception; throws when initializing Lorg / pjsip / pjsua / pjsuaJNI; 11-22 13: 55: 51.417: E / AndroidRuntime (11464): java.lang.UnsatisfiedLinkError: native method not found: org.pjsip.pjsua.pjsuaJNI.swig_module_init :() V 11-22 13: 55: 51.417: E / AndroidRuntime (11464): at org.pjsip.pjsua.pjsuaJNI.swig_module_init (native method) 11-22 13: 55: 51.417: E / AndroidRuntime (11464): at org.pjsip.pjsua.pjsuaJNI. (PjsuaJNI.java:1450)
Any help would be great. Thanks!