]> sjero.net Git - linphone/commitdiff
add traces + more jni implementation
authorJehan Monnier <jehan.monnier@linphone.org>
Mon, 15 Feb 2010 17:02:19 +0000 (18:02 +0100)
committerJehan Monnier <jehan.monnier@linphone.org>
Mon, 15 Feb 2010 17:02:19 +0000 (18:02 +0100)
coreapi/address.c
coreapi/linphonecore.c
coreapi/linphonecore_jni.cc

index 36f6de9035a21db954e0906e3f74f81533edf058..9c69a2641385c51a594dc85a0d308a70a733c8e8 100644 (file)
@@ -36,6 +36,7 @@ LinphoneAddress * linphone_address_new(const char *uri){
        osip_from_init(&from);
        if (osip_from_parse(from,uri)!=0){
                osip_from_free(from);
+               ms_error("Cannot create LinphoneAddress, bad uri [%s]",uri);
                return NULL;
        }
        return from;
index d54b4907ee3b94930c13c35380ec038aa9d66b7e..d5d7e43f1e5a7d9d9622512f404165f7d98eda74 100644 (file)
@@ -1836,7 +1836,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
        err=eXosip_call_build_initial_invite(&invite,real_url,from,
                                                route,"Phone call");
        if (err<0){
-               ms_warning("Could not build initial invite");
+               ms_warning("Could not build initial invite cause [%i]",err);
                goto end;
        }
        if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
index 5fd60b1ad0bb3a59dec14091a10f8967c40cae9a..9380c6196d28727e4c9816fd4bb15130c687c533 100644 (file)
@@ -222,9 +222,24 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEn
                ,jlong lc) {
        return (jlong)linphone_core_get_remote_uri((LinphoneCore*)lc);
 }
+extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall(  JNIEnv*  env
+               ,jobject  thiz
+               ,jlong lc) {
 
+       return linphone_core_in_call((LinphoneCore*)lc);
+}
+extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending(   JNIEnv*  env
+               ,jobject  thiz
+               ,jlong lc) {
 
+       return linphone_core_inc_invite_pending((LinphoneCore*)lc);
+}
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall(    JNIEnv*  env
+               ,jobject  thiz
+               ,jlong lc) {
 
+       linphone_core_accept_call((LinphoneCore*)lc,NULL);
+}
 //ProxyConfig
 
 extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv*  env,jobject  thiz) {
@@ -256,9 +271,12 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_done(JNIEnv* env,
        linphone_proxy_config_done((LinphoneProxyConfig*)proxyCfg);
 }
 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhoneNumber(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jnumber) {
+       if (jnumber == 0) {
+               ms_error("cannot normalized null number");
+       }
        const char* number = env->GetStringUTFChars(jnumber, NULL);
        int len = env->GetStringLength(jnumber);
-       char targetBuff[len];
+       char targetBuff[2*len];// returned number can be greater than origin (specially in case of prefix insertion
        linphone_proxy_config_normalize_number((LinphoneProxyConfig*)proxyCfg,number,targetBuff,sizeof(targetBuff));
        jstring normalizedNumber = env->NewStringUTF(targetBuff);
        env->ReleaseStringUTFChars(jnumber, number);
@@ -274,9 +292,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIE
                return NULL;
        }
 }
+extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean value) {
+       linphone_proxy_config_set_dial_escape_plus((LinphoneProxyConfig*)proxyCfg,value);
+}
 
-
-void Java_org_linphone_core_LinphoneProxyConfigImpl_setPrefix(JNIEnv* env
+extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNIEnv* env
                                                                                                                                        ,jobject thiz
                                                                                                                                        ,jlong proxyCfg
                                                                                                                                        ,jstring jprefix) {
@@ -318,7 +338,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneAddressImpl_newLinphoneAddressIm
                                                                                                                                                                        ,jstring jdisplayName) {
        const char* uri = env->GetStringUTFChars(juri, NULL);
        LinphoneAddress* address = linphone_address_new(uri);
-       if (jdisplayName) {
+       if (jdisplayName && address) {
                const char* displayName = env->GetStringUTFChars(jdisplayName, NULL);
                linphone_address_set_display_name(address,displayName);
                env->ReleaseStringUTFChars(jdisplayName, displayName);