]> sjero.net Git - linphone/blobdiff - coreapi/linphonecore_jni.cc
Add callbacks for audio (un)initialization in the echo canceller calibrator.
[linphone] / coreapi / linphonecore_jni.cc
index a11c158c895382c8e3934eaa9276b1df83ac13f0..02ac62c7a8498c546a1d49f557b7fe1cca97dabc 100644 (file)
@@ -17,12 +17,12 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 #include <jni.h>
+#ifdef USE_JAVAH
+#include "linphonecore_jni.h"
+#endif
 #include "linphonecore_utils.h"
 #include <ortp/zrtp.h>
 
-#ifdef TUNNEL_ENABLED
-#include "linphone_tunnel.h"
-#endif
 
 extern "C" {
 #include "mediastreamer2/mediastream.h"
@@ -31,6 +31,8 @@ extern "C" {
 #include "private.h"
 #include <cpu-features.h>
 
+#include "lpconfig.h"
+
 #ifdef ANDROID
 #include <android/log.h>
 extern "C" void libmsilbc_init();
@@ -49,9 +51,30 @@ extern "C" void libmsbcg729_init();
 #endif /*ANDROID*/
 
 static JavaVM *jvm=0;
+static const char* LogDomain = "Linphone";
 
 #ifdef ANDROID
-static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
+void linphone_android_log_handler(int prio, const char *fmt, va_list args) {
+       char str[4096];
+       char *current;
+       char *next;
+
+       vsnprintf(str, sizeof(str) - 1, fmt, args);
+       str[sizeof(str) - 1] = '\0';
+       if (strlen(str) < 512) {
+               __android_log_write(prio, LogDomain, str);
+       } else {
+               current = str;
+               while ((next = strchr(current, '\n')) != NULL) {
+                       *next = '\0';
+                       __android_log_write(prio, LogDomain, current);
+                       current = next + 1;
+               }
+               __android_log_write(prio, LogDomain, current);
+       }
+}
+
+static void linphone_android_ortp_log_handler(OrtpLogLevel lev, const char *fmt, va_list args) {
        int prio;
        switch(lev){
        case ORTP_DEBUG:        prio = ANDROID_LOG_DEBUG;       break;
@@ -61,7 +84,7 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l
        case ORTP_FATAL:        prio = ANDROID_LOG_FATAL;       break;
        default:                prio = ANDROID_LOG_DEFAULT;     break;
        }
-       __android_log_vprint(prio, LOG_DOMAIN, fmt, args);
+       linphone_android_log_handler(prio, fmt, args);
 }
 
 int dumbMethodForAllowingUsageOfCpuFeaturesFromStaticLibMediastream() {
@@ -82,9 +105,11 @@ JNIEXPORT jint JNICALL  JNI_OnLoad(JavaVM *ajvm, void *reserved)
 //LinphoneFactory
 extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv*  env
                ,jobject  thiz
-               ,jboolean isDebug) {
+               ,jboolean isDebug
+               ,jstring  jdebugTag) {
        if (isDebug) {
-               linphone_core_enable_logs_with_cb(linphone_android_log_handler);
+               LogDomain = env->GetStringUTFChars(jdebugTag, NULL);
+               linphone_core_enable_logs_with_cb(linphone_android_ortp_log_handler);
        } else {
                linphone_core_disable_logs();
        }
@@ -110,6 +135,7 @@ public:
                vTable.call_encryption_changed = callEncryptionChange;
                vTable.text_received = text_received;
                vTable.message_received = message_received;
+               vTable.dtmf_received = dtmf_received;
                vTable.new_subscription_request = new_subscription_request;
                vTable.notify_presence_recv = notify_presence_recv;
                vTable.call_stats_updated = callStatsUpdated;
@@ -157,6 +183,7 @@ public:
                /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
                textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
                messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V");
+               dtmfReceivedId = env->GetMethodID(listenerClass,"dtmfReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;I)V");
 
                proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
                proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
@@ -211,6 +238,7 @@ public:
        jmethodID notifyPresenceReceivedId;
        jmethodID textReceivedId;
        jmethodID messageReceivedId;
+       jmethodID dtmfReceivedId;
        jmethodID callStatsUpdatedId;
 
        jclass globalStateClass;
@@ -390,6 +418,20 @@ public:
                                                        ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend)
                                                        ,url ? env->NewStringUTF(url) : NULL);
        }
+       static void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
+               JNIEnv *env = 0;
+               jint result = jvm->AttachCurrentThread(&env,NULL);
+               if (result != 0) {
+                       ms_error("cannot attach VM\n");
+                       return;
+               }
+               LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
+               env->CallVoidMethod(lcData->listener
+                                                       ,lcData->dtmfReceivedId
+                                                       ,lcData->core
+                                                       ,lcData->getCall(env,call)
+                                                       ,dtmf);
+       }
        static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
                JNIEnv *env = 0;
                jint result = jvm->AttachCurrentThread(&env,NULL);
@@ -490,16 +532,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
                        ,userConfig
                        ,factoryConfig
                        ,ldata);
-       //clear auth info list
-       linphone_core_clear_all_auth_info((LinphoneCore*) nativePtr);
-       //clear existing proxy config
-       linphone_core_clear_proxy_config((LinphoneCore*) nativePtr);
 
        if (userConfig) env->ReleaseStringUTFChars(juserConfig, userConfig);
        if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
        return nativePtr;
 }
-extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv*  env
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
        LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc);
@@ -507,7 +545,23 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv*  env
        delete lcData;
 }
 
-extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject  thiz, jlong lc, jstring jdisplayname, jstring jusername) {
+       const char* displayname = env->GetStringUTFChars(jdisplayname, NULL);
+       const char* username = env->GetStringUTFChars(jusername, NULL);
+
+       LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc);
+    if (parsed != NULL) {
+        linphone_address_set_display_name(parsed, displayname);
+        linphone_address_set_username(parsed, username);
+        char *contact = linphone_address_as_string(parsed);
+               linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
+       }
+
+       env->ReleaseStringUTFChars(jdisplayname, displayname);
+       env->ReleaseStringUTFChars(jusername, username);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
        linphone_core_clear_proxy_config((LinphoneCore*)lc);
 }
 
@@ -541,7 +595,7 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList
        return jProxies;
 }
 
-extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv*  env
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig(        JNIEnv*  env
                ,jobject  thiz
                ,jobject jproxyCfg
                ,jlong lc
@@ -549,10 +603,10 @@ extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig(    JNIEnv*
        LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)pc;
        linphone_proxy_config_set_user_data(proxy, env->NewGlobalRef(jproxyCfg));
 
-       return linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
+       return (jint)linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
 }
 
-extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
        linphone_core_clear_all_auth_info((LinphoneCore*)lc);
 }
 
@@ -596,6 +650,13 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall(     JNIEnv*
        linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_declineCall(   JNIEnv*  env
+               ,jobject  thiz
+               ,jlong lc
+               ,jlong call, jint reason) {
+       linphone_core_decline_call((LinphoneCore*)lc,(LinphoneCall*)call,(LinphoneReason)reason);
+}
+
 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress(     JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
@@ -605,13 +666,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall(     JNIEnv*  e
                ,jobject  thiz
                ,jlong lc) {
 
-       return linphone_core_in_call((LinphoneCore*)lc);
+       return (jboolean)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);
+       return (jboolean)linphone_core_inc_invite_pending((LinphoneCore*)lc);
 }
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall(    JNIEnv*  env
                ,jobject  thiz
@@ -653,7 +714,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog(        JNIEnv*  en
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs(   JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
-               return ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
+               return (jint)ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
 }
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable(      JNIEnv*  env
                ,jobject  thiz
@@ -665,7 +726,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReachable(   JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
-               return linphone_core_is_network_reachable((LinphoneCore*)lc);
+               return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv*  env
+               ,jobject  thiz
+               ,jlong lc
+               ,jfloat gain) {
+               linphone_core_set_mic_gain_db((LinphoneCore*)lc,gain);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain(       JNIEnv*  env
@@ -675,10 +743,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain(  JNIEnv*
                linphone_core_set_playback_gain_db((LinphoneCore*)lc,gain);
 }
 
-extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain(      JNIEnv*  env
+extern "C" jfloat Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain(     JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
-               return linphone_core_get_playback_gain_db((LinphoneCore*)lc);
+               return (jfloat)linphone_core_get_playback_gain_db((LinphoneCore*)lc);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_muteMic(       JNIEnv*  env
@@ -716,10 +784,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv*  env
        linphone_core_stop_dtmf((LinphoneCore*)lc);
 }
 
-extern "C" void Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv*  env
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong lc) {
-       linphone_core_get_missed_calls_count((LinphoneCore*)lc);
+       return (jint)linphone_core_get_missed_calls_count((LinphoneCore*)lc);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_resetMissedCallsCount(JNIEnv*  env
@@ -742,7 +810,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv*  e
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMicMuted(        JNIEnv*  env
                ,jobject  thiz
                ,jlong lc) {
-       return linphone_core_is_mic_muted((LinphoneCore*)lc);
+       return (jboolean)linphone_core_is_mic_muted((LinphoneCore*)lc);
 }
 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
@@ -791,12 +859,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
        return jCodecs;
 }
 
-extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv*  env
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ,jlong pt
                                                                                                                                                        ,jboolean enable) {
-       return linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable);
+       return (jint)linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable);
 }
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
@@ -814,14 +882,14 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEn
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ) {
-       return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
+       return (jboolean)linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoLimiterEnabled(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ) {
-       return linphone_core_echo_limiter_enabled((LinphoneCore*)lc);
+       return (jboolean)linphone_core_echo_limiter_enabled((LinphoneCore*)lc);
 }
 
 extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv*  env
@@ -850,7 +918,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv*
        if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact);
 }
 
-extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv*  env
+extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ,jstring jto) {
@@ -858,7 +926,7 @@ extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv*
        const char* to = env->GetStringUTFChars(jto, NULL);
        LinphoneChatRoom* lResult = linphone_core_create_chat_room((LinphoneCore*)lc,to);
        env->ReleaseStringUTFChars(jto, to);
-       return (long)lResult;
+       return (jlong)lResult;
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv*  env
@@ -872,7 +940,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv*  env
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isVideoEnabled(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc) {
-       return linphone_core_video_enabled((LinphoneCore*)lc);
+       return (jboolean)linphone_core_video_enabled((LinphoneCore*)lc);
 }
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlayFile(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
@@ -919,59 +987,59 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableKeepAlive(JNIEnv*
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isKeepAliveEnabled(JNIEnv*  env
                                                                                                                                ,jobject  thiz
                                                                                                                                ,jlong lc) {
-       return linphone_core_keep_alive_enabled((LinphoneCore*)lc);
+       return (jboolean)linphone_core_keep_alive_enabled((LinphoneCore*)lc);
 
 }
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNIEnv*  env
                                                                                                                                                                ,jobject  thiz
                                                                                                                                                                ,jlong lc
                                                                                                                                                                ,jobject data) {
-       return linphone_core_start_echo_calibration((LinphoneCore*)lc
+       return (jint)linphone_core_start_echo_calibration((LinphoneCore*)lc
                                                                                                        , LinphoneCoreData::ecCalibrationStatus
+                                                                                                       , NULL
+                                                                                                       , NULL
                                                                                                        , data?env->NewGlobalRef(data):NULL);
 
 }
 
-extern "C" int Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv*  env
+extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration(JNIEnv *env, jobject thiz, jlong lc){
+       MSSndCard *sndcard;
+       MSSndCardManager *m=ms_snd_card_manager_get();
+       const char *card=linphone_core_get_capture_device((LinphoneCore*)lc);
+       sndcard=ms_snd_card_manager_get_card(m,card);
+       if (sndcard == NULL){
+               ms_error("Could not get soundcard.");
+               return TRUE;
+       }
+       return (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) || (ms_snd_card_get_minimal_latency(sndcard)>0);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ) {
-       return (int)linphone_core_get_media_encryption((LinphoneCore*)lc);
+       return (jint)linphone_core_get_media_encryption((LinphoneCore*)lc);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryption(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
-                                                                                                                                                       ,int menc) {
+                                                                                                                                                       ,jint menc) {
        linphone_core_set_media_encryption((LinphoneCore*)lc,(LinphoneMediaEncryption)menc);
 }
 
-extern "C" int Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv*  env
-                                                                                                                                                       ,jobject  thiz
-                                                                                                                                                       ,jlong cp
-                                                                                                                                                       ) {
-       return (int)linphone_call_params_get_media_encryption((LinphoneCallParams*)cp);
-}
-
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_mediaEncryptionSupported(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc, jint menc
                                                                                                                                                        ) {
-       return linphone_core_media_encryption_supported((LinphoneCore*)lc,(LinphoneMediaEncryption)menc);
-}
-
-extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setMediaEncryption(JNIEnv*  env
-                                                                                                                                                       ,jobject  thiz
-                                                                                                                                                       ,jlong cp
-                                                                                                                                                       ,int jmenc) {
-       linphone_call_params_set_media_encryption((LinphoneCallParams*)cp,(LinphoneMediaEncryption)jmenc);
+       return (jboolean)linphone_core_media_encryption_supported((LinphoneCore*)lc,(LinphoneMediaEncryption)menc);
 }
 
-extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryptionMandatory(JNIEnv*  env
+extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMediaEncryptionMandatory(JNIEnv*  env
                                                                                                                                                        ,jobject  thiz
                                                                                                                                                        ,jlong lc
                                                                                                                                                        ) {
-       return linphone_core_is_media_encryption_mandatory((LinphoneCore*)lc);
+       return (jboolean)linphone_core_is_media_encryption_mandatory((LinphoneCore*)lc);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryptionMandatory(JNIEnv*  env
@@ -1005,9 +1073,9 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JN
                return NULL;
        }
 }
-extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
+extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
        const char* proxy = env->GetStringUTFChars(jproxy, NULL);
-       int err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
+       jint err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
        env->ReleaseStringUTFChars(jproxy, proxy);
        return err;
 }
@@ -1024,14 +1092,14 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParamet
        linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params);
        env->ReleaseStringUTFChars(jparams, params);
 }
-extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
+extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
        if (jroute != NULL) {
                const char* route = env->GetStringUTFChars(jroute, NULL);
-               int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
+               jint err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
                env->ReleaseStringUTFChars(jroute, route);
                return err;
        } else {
-               return linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
+               return (jint)linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
        }
 }
 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) {
@@ -1047,10 +1115,10 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enableRegister(JN
        linphone_proxy_config_enable_register((LinphoneProxyConfig*)proxyCfg,enableRegister);
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegistered(JNIEnv* env,jobject thiz,jlong proxyCfg) {
-       return linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg);
+       return (jboolean)linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg);
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegisterEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
-       return linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg);
+       return (jboolean)linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg);
 }
 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_edit(JNIEnv* env,jobject thiz,jlong proxyCfg) {
        linphone_proxy_config_edit((LinphoneProxyConfig*)proxyCfg);
@@ -1074,12 +1142,18 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone
        env->ReleaseStringUTFChars(jnumber, number);
        return normalizedNumber;
 }
-extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jstring jiso) {
+extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring jiso) {
        const char* iso = env->GetStringUTFChars(jiso, NULL);
        int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso);
        env->ReleaseStringUTFChars(jiso, iso);
        return (jint) prefix;
 }
+extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromE164(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring je164) {
+       const char* e164 = env->GetStringUTFChars(je164, NULL);
+       int prefix = linphone_dial_plan_lookup_ccc_from_e164(e164);
+       env->ReleaseStringUTFChars(je164, e164);
+       return (jint) prefix;
+}
 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
                                                                                                                                                        ,jobject thiz
                                                                                                                                                        ,jlong proxyCfg) {
@@ -1109,33 +1183,156 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enablePublish(JNI
        linphone_proxy_config_enable_publish((LinphoneProxyConfig*)proxyCfg,val);
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
-       return linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg);
+       return (jboolean)linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg);
 }
 
 //Auth Info
 
 extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
-               , jobject thiz
-               , jstring jusername
-               , jstring juserid
-               , jstring jpassword
-               , jstring jha1
-               , jstring jrealm) {
-
-       const char* username = env->GetStringUTFChars(jusername, NULL);
-       const char* password = env->GetStringUTFChars(jpassword, NULL);
-       jlong auth = (jlong)linphone_auth_info_new(username,NULL,password,NULL,NULL);
-
-       env->ReleaseStringUTFChars(jusername, username);
-       env->ReleaseStringUTFChars(jpassword, password);
-       return auth;
-
+               , jobject thiz ) {
+       return (jlong)linphone_auth_info_new(NULL,NULL,NULL,NULL,NULL);
 }
 extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_delete(JNIEnv* env
                , jobject thiz
                , jlong ptr) {
        linphone_auth_info_destroy((LinphoneAuthInfo*)ptr);
 }
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    getPassword
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getPassword
+(JNIEnv *env , jobject, jlong auth_info) {
+       const char* passwd = linphone_auth_info_get_passwd((LinphoneAuthInfo*)auth_info);
+       if (passwd) {
+               return env->NewStringUTF(passwd);
+       } else {
+               return NULL;
+       }
+
+}
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    getRealm
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getRealm
+(JNIEnv *env , jobject, jlong auth_info) {
+       const char* realm = linphone_auth_info_get_realm((LinphoneAuthInfo*)auth_info);
+       if (realm) {
+               return env->NewStringUTF(realm);
+       } else {
+               return NULL;
+       }
+
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    getUsername
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getUsername
+(JNIEnv *env , jobject, jlong auth_info) {
+       const char* username = linphone_auth_info_get_username((LinphoneAuthInfo*)auth_info);
+       if (username) {
+               return env->NewStringUTF(username);
+       } else {
+               return NULL;
+       }
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    setPassword
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setPassword
+(JNIEnv *env, jobject, jlong auth_info, jstring jpassword) {
+       const char* password = jpassword?env->GetStringUTFChars(jpassword, NULL):NULL;
+       linphone_auth_info_set_passwd((LinphoneAuthInfo*)auth_info,password);
+       if (password) env->ReleaseStringUTFChars(jpassword, password);
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    setRealm
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setRealm
+(JNIEnv *env, jobject, jlong auth_info, jstring jrealm) {
+       const char* realm = jrealm?env->GetStringUTFChars(jrealm, NULL):NULL;
+       linphone_auth_info_set_realm((LinphoneAuthInfo*)auth_info,realm);
+       if (realm) env->ReleaseStringUTFChars(jrealm, realm);
+}
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    setUsername
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setUsername
+(JNIEnv *env, jobject, jlong auth_info, jstring jusername) {
+       const char* username = jusername?env->GetStringUTFChars(jusername, NULL):NULL;
+       linphone_auth_info_set_username((LinphoneAuthInfo*)auth_info,username);
+       if (username) env->ReleaseStringUTFChars(jusername, username);
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    setAuthUserId
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setUserId
+(JNIEnv *env, jobject, jlong auth_info, jstring juserid) {
+       const char* userid = juserid?env->GetStringUTFChars(juserid, NULL):NULL;
+       linphone_auth_info_set_userid((LinphoneAuthInfo*)auth_info,userid);
+       if (userid) env->ReleaseStringUTFChars(juserid, userid);
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    getAuthUserId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getUserId
+(JNIEnv *env , jobject, jlong auth_info) {
+       const char* userid = linphone_auth_info_get_userid((LinphoneAuthInfo*)auth_info);
+       if (userid) {
+               return env->NewStringUTF(userid);
+       } else {
+               return NULL;
+       }
+}
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    setHa1
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setHa1
+(JNIEnv *env, jobject, jlong auth_info, jstring jha1) {
+       const char* ha1 = jha1?env->GetStringUTFChars(jha1, NULL):NULL;
+       linphone_auth_info_set_ha1((LinphoneAuthInfo*)auth_info,ha1);
+       if (ha1) env->ReleaseStringUTFChars(jha1, ha1);
+}
+
+
+/*
+ * Class:     org_linphone_core_LinphoneAuthInfoImpl
+ * Method:    getHa1
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getHa1
+(JNIEnv *env , jobject, jlong auth_info) {
+       const char* ha1 = linphone_auth_info_get_ha1((LinphoneAuthInfo*)auth_info);
+       if (ha1) {
+               return env->NewStringUTF(ha1);
+       } else {
+               return NULL;
+       }
+}
+
 
 //LinphoneAddress
 
@@ -1167,7 +1364,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDisplayName(JNI
        if (displayName) {
                return env->NewStringUTF(displayName);
        } else {
-               return 0;
+               return NULL;
        }
 }
 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv*  env
@@ -1177,7 +1374,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv
        if (userName) {
                return env->NewStringUTF(userName);
        } else {
-               return 0;
+               return NULL;
        }
 }
 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv*  env
@@ -1187,7 +1384,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv*
        if (domain) {
                return env->NewStringUTF(domain);
        } else {
-               return 0;
+               return NULL;
        }
 }
 
@@ -1223,10 +1420,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv*  env
                                                                                                                                                ,jlong ptr) {
        return (jlong)((LinphoneCallLog*)ptr)->from;
 }
-extern "C" int Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv*  env
+extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getStatus(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return (jlong)((LinphoneCallLog*)ptr)->status;
+       return (jint)((LinphoneCallLog*)ptr)->status;
 }
 extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1244,21 +1441,35 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallLogImpl_getStartDate(JNIEn
        jstring jvalue =env->NewStringUTF(((LinphoneCallLog*)ptr)->start_date);
        return jvalue;
 }
+extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTimestamp(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr) {
+       return static_cast<long> (((LinphoneCallLog*)ptr)->start_date_time);
+}
 extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return ((LinphoneCallLog*)ptr)->duration;
+       return (jint)((LinphoneCallLog*)ptr)->duration;
 }
 
 /* CallStats */
-extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) {
-       return (int)((LinphoneCallStats *)stats_ptr)->type;
+extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jint)((LinphoneCallStats *)stats_ptr)->type;
+}
+extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jint)((LinphoneCallStats *)stats_ptr)->ice_state;
+}
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth;
+}
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jfloat)((LinphoneCallStats *)stats_ptr)->upload_bandwidth;
 }
 extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) {
        const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
        const report_block_t *srb = NULL;
 
-       if (!stats->sent_rtcp)
+       if (!stats || !stats->sent_rtcp)
                return (jfloat)0.0;
        /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
        if (stats->sent_rtcp->b_cont != NULL)
@@ -1275,7 +1486,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa
        const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
        const report_block_t *rrb = NULL;
 
-       if (!stats->received_rtcp)
+       if (!stats || !stats->received_rtcp)
                return (jfloat)0.0;
        /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
        if (stats->received_rtcp->b_cont != NULL)
@@ -1290,12 +1501,15 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa
 }
 extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) {
        LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
-       const LinphoneCall *call = (LinphoneCall *)call_ptr;
-       const LinphoneCallParams *params = linphone_call_get_current_params(call);
+       LinphoneCall *call = (LinphoneCall *)call_ptr;
+       const LinphoneCallParams *params;
        const PayloadType *pt;
        const report_block_t *srb = NULL;
 
-       if (!stats->sent_rtcp)
+       if (!stats || !call || !stats->sent_rtcp)
+               return (jfloat)0.0;
+       params = linphone_call_get_current_params(call);
+       if (!params)
                return (jfloat)0.0;
        /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
        if (stats->sent_rtcp->b_cont != NULL)
@@ -1310,16 +1524,21 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr
                pt = linphone_call_params_get_used_audio_codec(params);
        else
                pt = linphone_call_params_get_used_video_codec(params);
+       if (!pt || (pt->clock_rate == 0))
+               return (jfloat)0.0;
        return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate);
 }
 extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) {
        LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
-       const LinphoneCall *call = (LinphoneCall *)call_ptr;
-       const LinphoneCallParams *params = linphone_call_get_current_params(call);
+       LinphoneCall *call = (LinphoneCall *)call_ptr;
+       const LinphoneCallParams *params;
        const PayloadType *pt;
        const report_block_t *rrb = NULL;
 
-       if (!stats->received_rtcp)
+       if (!stats || !call || !stats->received_rtcp)
+               return (jfloat)0.0;
+       params = linphone_call_get_current_params(call);
+       if (!params)
                return (jfloat)0.0;
        /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
        if (stats->received_rtcp->b_cont != NULL)
@@ -1334,6 +1553,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera
                pt = linphone_call_params_get_used_audio_codec(params);
        else
                pt = linphone_call_params_get_used_video_codec(params);
+       if (!pt || (pt->clock_rate == 0))
+               return (jfloat)0.0;
        return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate);
 }
 extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) {
@@ -1344,6 +1565,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumu
        LinphoneCall *call = (LinphoneCall *)call_ptr;
        rtp_stats_t rtp_stats;
 
+       if (!stats || !call)
+               return (jlong)0;
        memset(&rtp_stats, 0, sizeof(rtp_stats));
        if (stats->type == LINPHONE_CALL_STATS_AUDIO)
                audio_stream_get_local_rtp_stats(call->audiostream, &rtp_stats);
@@ -1357,6 +1580,23 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getJitterBufferSi
        return (jfloat)((LinphoneCallStats *)stats_ptr)->jitter_stats.jitter_buffer_size_ms;
 }
 
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getLocalLossRate(JNIEnv *env, jobject thiz,jlong stats_ptr) {
+       const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
+       return stats->local_loss_rate;
+}
+
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getLocalLateRate(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
+       return stats->local_late_rate;
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallStatsImpl_updateStats(JNIEnv *env, jobject thiz, jlong call_ptr, jint mediatype) {
+       if (mediatype==LINPHONE_CALL_STATS_AUDIO)
+               linphone_call_get_audio_stats((LinphoneCall*)call_ptr);
+       else 
+               linphone_call_get_video_stats((LinphoneCall*)call_ptr);
+}
+
 /*payloadType*/
 extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv*  env,jobject  thiz,jlong ptr) {
        PayloadType* pt = (PayloadType*)ptr;
@@ -1375,7 +1615,7 @@ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv*  env,j
 }
 extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv*  env,jobject  thiz, jlong ptr) {
        PayloadType* pt = (PayloadType*)ptr;
-       return payload_type_get_rate(pt);
+       return (jint)payload_type_get_rate(pt);
 }
 
 //LinphoneCall
@@ -1417,6 +1657,22 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress(       JNIEn
        return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
 }
 
+extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) {
+       LinphoneCall *call = (LinphoneCall *)ptr;
+       const char *value=linphone_call_get_remote_user_agent(call);
+       jstring jvalue=NULL;
+       if (value) jvalue=env->NewStringUTF(value);
+       return jvalue;
+}
+
+extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteContact(JNIEnv *env, jobject thiz, jlong ptr) {
+       LinphoneCall *call = (LinphoneCall *)ptr;
+       const char *value=linphone_call_get_remote_contact(call);
+       jstring jvalue = NULL;
+       if (value) jvalue=env->NewStringUTF(value);
+       return jvalue;
+}
+
 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState(      JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
@@ -1431,7 +1687,7 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoCancellation(
 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoCancellationEnabled( JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr);
+       return (jboolean)linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter(     JNIEnv*  env
@@ -1443,7 +1699,7 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter(        JNIEn
 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoLimiterEnabled(      JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return linphone_call_echo_limiter_enabled((LinphoneCall*)ptr);
+       return (jboolean)linphone_call_echo_limiter_enabled((LinphoneCall*)ptr);
 }
 
 extern "C" jobject Java_org_linphone_core_LinphoneCallImpl_getReplacedCall(    JNIEnv*  env
@@ -1465,9 +1721,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getAverageQuality(      JNI
        return (jfloat)linphone_call_get_average_quality((LinphoneCall*)ptr);
 }
 
-
 //LinphoneFriend
-extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv*  env
+extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jstring jFriendUri) {
        LinphoneFriend* lResult;
@@ -1479,7 +1734,7 @@ extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIE
        } else {
                lResult = linphone_friend_new();
        }
-       return (long)lResult;
+       return (jlong)lResult;
 }
 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1487,10 +1742,10 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv*  en
                                                                                                                                                ,jlong linphoneAddress) {
        linphone_friend_set_addr((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress);
 }
-extern "C" long Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv*  env
+extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return (long)linphone_friend_get_address((LinphoneFriend*)ptr);
+       return (jlong)linphone_friend_get_address((LinphoneFriend*)ptr);
 }
 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1501,7 +1756,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(
 extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getIncSubscribePolicy(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr);
+       return (jint)linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr);
 }
 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1512,12 +1767,12 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEn
 extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isSubscribesEnabled(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return linphone_friend_subscribes_enabled((LinphoneFriend*)ptr);
+       return (jboolean)linphone_friend_subscribes_enabled((LinphoneFriend*)ptr);
 }
-extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv*  env
+extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return linphone_friend_get_status((LinphoneFriend*)ptr);
+       return (jint)linphone_friend_get_status((LinphoneFriend*)ptr);
 }
 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1529,11 +1784,26 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv*  env
                                                                                                                                                ,jlong ptr) {
         linphone_friend_done((LinphoneFriend*)ptr);
 }
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFriend(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr
+                                                                                                                                               ,jlong lf) {
+       linphone_core_remove_friend((LinphoneCore*)ptr, (LinphoneFriend*)lf);
+}
+extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr
+                                                                                                                                               ,jstring jaddress) {
+       const char* address = env->GetStringUTFChars(jaddress, NULL);
+       LinphoneFriend *lf = linphone_core_get_friend_by_address((LinphoneCore*)ptr, address);
+       env->ReleaseStringUTFChars(jaddress, address);
+       return (jlong) lf;
+}
 //LinphoneChatRoom
-extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv*  env
+extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
+       return (jlong) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
 }
 extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
@@ -1551,12 +1821,32 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setUserData(JNIEn
        jobject ud = env->NewGlobalRef(thiz);
        linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr,(void*) ud);
 }
-extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getMessage(JNIEnv*  env
+extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getText(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
-       jstring jvalue =env->NewStringUTF(linphone_chat_message_get_message((LinphoneChatMessage*)ptr));
+       jstring jvalue =env->NewStringUTF(linphone_chat_message_get_text((LinphoneChatMessage*)ptr));
        return jvalue;
 }
+
+extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getCustomHeader(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr, jstring jheader_name) {
+       const char *name=env->GetStringUTFChars(jheader_name,NULL);
+       const char *value=linphone_chat_message_get_custom_header((LinphoneChatMessage*)ptr,name);
+       env->ReleaseStringUTFChars(jheader_name, name);
+       return value ? env->NewStringUTF(value) : NULL;
+}
+
+extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_addCustomHeader(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr, jstring jheader_name, jstring jheader_value) {
+       const char *name=env->GetStringUTFChars(jheader_name,NULL);
+       const char *value=env->GetStringUTFChars(jheader_value,NULL);
+       linphone_chat_message_add_custom_header((LinphoneChatMessage*)ptr,name,value);
+       env->ReleaseStringUTFChars(jheader_name, name);
+       env->ReleaseStringUTFChars(jheader_value, value);
+}
+
 extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getExternalBodyUrl(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
@@ -1576,11 +1866,19 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getFrom(JNIEnv*
                                                                                                                                                ,jlong ptr) {
        return (jlong) linphone_chat_message_get_from((LinphoneChatMessage*)ptr);
 }
+
 extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getPeerAddress(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr) {
        return (jlong) linphone_chat_message_get_peer_address((LinphoneChatMessage*)ptr);
 }
+
+extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getTime(JNIEnv*  env
+                                                                                                                                               ,jobject  thiz
+                                                                                                                                               ,jlong ptr) {
+       return (jlong) linphone_chat_message_get_time((LinphoneChatMessage*)ptr);
+}
+
 extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
                                                                                                                                                ,jlong ptr
@@ -1658,12 +1956,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDeviceRotation(JNIEnv
 }
 
 
-extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, jint enum_value){
        linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
 }
 
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc){
-       return linphone_core_get_firewall_policy((LinphoneCore*)lc);
+       return (jint)linphone_core_get_firewall_policy((LinphoneCore*)lc);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
@@ -1680,6 +1978,37 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv
        return jvalue;
 }
 
+//CallParams
+extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_isLowBandwidthEnabled(JNIEnv *env, jobject thiz, jlong cp) {
+       return (jboolean) linphone_call_params_low_bandwidth_enabled((LinphoneCallParams *)cp);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) {
+       linphone_call_params_enable_low_bandwidth((LinphoneCallParams *)cp, enable);
+}
+
+extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) {
+       return (jlong)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp);
+}
+
+extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_getUsedVideoCodec(JNIEnv *env, jobject thiz, jlong cp) {
+       return (jlong)linphone_call_params_get_used_video_codec((LinphoneCallParams *)cp);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv*  env
+                                                                                                                                                       ,jobject  thiz
+                                                                                                                                                       ,jlong cp
+                                                                                                                                                       ) {
+       return (jint)linphone_call_params_get_media_encryption((LinphoneCallParams*)cp);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setMediaEncryption(JNIEnv*  env
+                                                                                                                                                       ,jobject  thiz
+                                                                                                                                                       ,jlong cp
+                                                                                                                                                       ,jint jmenc) {
+       linphone_call_params_set_media_encryption((LinphoneCallParams*)cp,(LinphoneMediaEncryption)jmenc);
+}
+
 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){
        linphone_call_params_set_audio_bandwidth_limit((LinphoneCallParams*)lcp, bw);
 }
@@ -1689,11 +2018,34 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){
-       return linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
+       return (jboolean)linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenceMode(JNIEnv *env, jobject thiz, jlong lcp){
-       return linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp);
+       return (jboolean)linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp);
+}
+
+extern "C" jstring Java_org_linphone_core_LinphoneCallParamsImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name){
+       const char* header_name=env->GetStringUTFChars(jheader_name, NULL);
+       const char *header_value=linphone_call_params_get_custom_header((LinphoneCallParams*)lcp,header_name);
+       env->ReleaseStringUTFChars(jheader_name, header_name);
+       return header_value ? env->NewStringUTF(header_value) : NULL;
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_addCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name, jstring jheader_value){
+       const char* header_name=env->GetStringUTFChars(jheader_name, NULL);
+       const char* header_value=env->GetStringUTFChars(jheader_value, NULL);
+       linphone_call_params_add_custom_header((LinphoneCallParams*)lcp,header_name,header_value);
+       env->ReleaseStringUTFChars(jheader_name, header_name);
+       env->ReleaseStringUTFChars(jheader_value, header_value);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setRecordFile(JNIEnv *env, jobject thiz, jlong lcp, jstring jrecord_file){
+       if (jrecord_file){
+               const char* record_file=env->GetStringUTFChars(jrecord_file, NULL);
+               linphone_call_params_set_record_file((LinphoneCallParams*)lcp,record_file);
+               env->ReleaseStringUTFChars(jrecord_file, record_file);
+       }else linphone_call_params_set_record_file((LinphoneCallParams*)lcp,NULL);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
@@ -1714,12 +2066,20 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JN
        return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc));
 }
 
-extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
+extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
        linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b);
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_cameraEnabled(JNIEnv *env, jobject thiz, jlong lc){
-       linphone_call_camera_enabled((LinphoneCall *)lc);
+       return (jboolean)linphone_call_camera_enabled((LinphoneCall *)lc);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallImpl_startRecording(JNIEnv *env, jobject thiz, jlong lc){
+       linphone_call_start_recording((LinphoneCall *)lc);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCallImpl_stopRecording(JNIEnv *env, jobject thiz, jlong lc){
+       linphone_call_stop_recording((LinphoneCall *)lc);
 }
 
 extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
@@ -1735,7 +2095,6 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateCall(JNIEnv *env,
        return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (const LinphoneCallParams *)params);
 }
 
-
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc, jint width, jint height){
        MSVideoSize vsize;
        vsize.width = (int)width;
@@ -1759,6 +2118,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn
        linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){
+       linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){
+       linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use);
+}
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadPtime(JNIEnv *env, jobject thiz, jlong lc, jint ptime){
        linphone_core_set_download_ptime((LinphoneCore *)lc, (int) ptime);
 }
@@ -1767,15 +2134,23 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadPtime(JNIEnv *e
        linphone_core_set_upload_ptime((LinphoneCore *)lc, (int) ptime);
 }
 
-extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv*  env,jobject thiz,jlong ptr) {
-       return (int) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr);
+extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv*  env,jobject thiz,jlong ptr) {
+       return (jint) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr);
 }
 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv*  env,jobject thiz,jlong ptr,jint delay) {
        linphone_proxy_config_expires((LinphoneProxyConfig *) ptr, (int) delay);
 }
 
 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv*  env,jobject thiz,jlong ptr) {
-       linphone_call_get_duration((LinphoneCall *) ptr);
+       return (jint)linphone_call_get_duration((LinphoneCall *) ptr);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSipDscp(JNIEnv* env,jobject thiz,jlong ptr, jint dscp){
+       linphone_core_set_sip_dscp((LinphoneCore*)ptr,dscp);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSipDscp(JNIEnv* env,jobject thiz,jlong ptr){
+       return linphone_core_get_sip_dscp((LinphoneCore*)ptr);
 }
 
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) {
@@ -1814,19 +2189,19 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_adjustSoftwareVolume(JNI
 }
 
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
-       return linphone_core_pause_call((LinphoneCore *) pCore, (LinphoneCall *) pCall);
+       return (jint)linphone_core_pause_call((LinphoneCore *) pCore, (LinphoneCall *) pCall);
 }
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseAllCalls(JNIEnv *env,jobject thiz,jlong pCore) {
-       return linphone_core_pause_all_calls((LinphoneCore *) pCore);
+       return (jint)linphone_core_pause_all_calls((LinphoneCore *) pCore);
 }
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_resumeCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
-       return linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall);
+       return (jint)linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall);
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInConference(JNIEnv *env,jobject thiz,jlong pCore) {
-       return linphone_core_is_in_conference((LinphoneCore *) pCore);
+       return (jboolean)linphone_core_is_in_conference((LinphoneCore *) pCore);
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_enterConference(JNIEnv *env,jobject thiz,jlong pCore) {
-       return 0 == linphone_core_enter_conference((LinphoneCore *) pCore);
+       return (jboolean)(0 == linphone_core_enter_conference((LinphoneCore *) pCore));
 }
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_leaveConference(JNIEnv *env,jobject thiz,jlong pCore) {
        linphone_core_leave_conference((LinphoneCore *) pCore);
@@ -1834,9 +2209,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_leaveConference(JNIEnv *
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addAllToConference(JNIEnv *env,jobject thiz,jlong pCore) {
        linphone_core_add_all_to_conference((LinphoneCore *) pCore);
 }
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addToConference(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
        linphone_core_add_to_conference((LinphoneCore *) pCore, (LinphoneCall *) pCall);
 }
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFromConference(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
        linphone_core_remove_from_conference((LinphoneCore *) pCore, (LinphoneCall *) pCall);
 }
@@ -1845,8 +2222,24 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateConference(JNIE
        linphone_core_terminate_conference((LinphoneCore *) pCore);
 }
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv *env,jobject thiz,jlong pCore) {
-       return linphone_core_get_conference_size((LinphoneCore *) pCore);
+       return (jint)linphone_core_get_conference_size((LinphoneCore *) pCore);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startConferenceRecording(JNIEnv *env,jobject thiz,jlong pCore, jstring jpath){
+       int err=-1;
+       if (jpath){
+               const char *path=env->GetStringUTFChars(jpath, NULL);
+               err=linphone_core_start_conference_recording((LinphoneCore*)pCore,path);
+               env->ReleaseStringUTFChars(jpath,path);
+       }
+       return err;
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_stopConferenceRecording(JNIEnv *env,jobject thiz,jlong pCore){
+       int err=linphone_core_stop_conference_recording((LinphoneCore*)pCore);
+       return err;
 }
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv *env,jobject thiz,jlong pCore) {
        linphone_core_terminate_all_calls((LinphoneCore *) pCore);
 }
@@ -1856,16 +2249,17 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,j
        return lcd->getCall(env,lCall);
 }
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) {
-       return ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore));
+       return (jint)ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore));
 }
 
-extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) {
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) {
        const char* cReferTo=env->GetStringUTFChars(jReferTo, NULL);
-       linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo);
+       jint err = linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo);
        env->ReleaseStringUTFChars(jReferTo, cReferTo);
+       return err;
 }
-extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) {
-       linphone_core_transfer_call_to_another((LinphoneCore *) pCore, (LinphoneCall *) pCall, (LinphoneCall *) pDestCall);
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) {
+       return (jint)linphone_core_transfer_call_to_another((LinphoneCore *) pCore, (LinphoneCall *) pCall, (LinphoneCall *) pDestCall);
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) {
@@ -1900,7 +2294,7 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_setVideoDevice(JNIEnv *e
                        break;
                ms_message("Existing device %d : %s\n", i, devices[i]);
                if (i==id) {
-                       return linphone_core_set_video_device(lc, devices[i]);
+                       return (jint)linphone_core_set_video_device(lc, devices[i]);
                }
        }
        return -1;
@@ -1936,7 +2330,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getAuthenticationToke
 }
 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isAuthenticationTokenVerified(JNIEnv*  env,jobject thiz,jlong ptr) {
        LinphoneCall *call = (LinphoneCall *) ptr;
-       return linphone_call_get_authentication_token_verified(call);
+       return (jboolean)linphone_call_get_authentication_token_verified(call);
 }
 extern "C" void Java_org_linphone_core_LinphoneCallImpl_setAuthenticationTokenVerified(JNIEnv*  env,jobject thiz,jlong ptr,jboolean verified) {
        LinphoneCall *call = (LinphoneCall *) ptr;
@@ -1945,19 +2339,22 @@ extern "C" void Java_org_linphone_core_LinphoneCallImpl_setAuthenticationTokenVe
 
 extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getPlayVolume(JNIEnv* env, jobject thiz, jlong ptr) {
        LinphoneCall *call = (LinphoneCall *) ptr;
-       return linphone_call_get_play_volume(call);
+       return (jfloat)linphone_call_get_play_volume(call);
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_soundResourcesLocked(JNIEnv* env,jobject thiz,jlong ptr){
-       return linphone_core_sound_resources_locked((LinphoneCore *) ptr);
+       return (jboolean)linphone_core_sound_resources_locked((LinphoneCore *) ptr);
 }
 
 // Needed by Galaxy S (can't switch to/from speaker while playing and still keep mic working)
 // Implemented directly in msandroid.cpp (sound filters for Android).
-extern "C" void msandroid_hack_speaker_state(bool speakerOn);
-
-extern "C" void Java_org_linphone_LinphoneManager_hackSpeakerState(JNIEnv*  env,jobject thiz,jboolean speakerOn){
-       msandroid_hack_speaker_state(speakerOn);
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_forceSpeakerState(JNIEnv *env, jobject thiz, jlong ptr, jboolean speakerOn) {
+       LinphoneCore *lc = (LinphoneCore *)ptr;
+       LinphoneCall *call = linphone_core_get_current_call(lc);
+       if (call && call->audiostream && call->audiostream->soundread) {
+               bool_t on = speakerOn;
+               ms_filter_call_method(call->audiostream->soundread, MS_AUDIO_CAPTURE_FORCE_SPEAKER_STATE, &on);
+       }
 }
 // End Galaxy S hack functions
 
@@ -1973,8 +2370,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror
                jstring jHost, jint port, jint mirror, jint delay) {
        LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel;
        if (!tunnel) return;
+
        const char* cHost=env->GetStringUTFChars(jHost, NULL);
-       linphone_tunnel_add_server_and_mirror(tunnel, cHost, port, mirror, delay);
+       LinphoneTunnelConfig *tunnelconfig = linphone_tunnel_config_new();
+       linphone_tunnel_config_set_host(tunnelconfig, cHost);
+       linphone_tunnel_config_set_port(tunnelconfig, port);
+       linphone_tunnel_config_set_delay(tunnelconfig, delay);
+       linphone_tunnel_config_set_remote_udp_mirror_port(tunnelconfig, mirror);
+       linphone_tunnel_add_server(tunnel, tunnelconfig);
        env->ReleaseStringUTFChars(jHost, cHost);
 }
 
@@ -1996,7 +2399,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelSetHttpProxy(JNIEn
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAutoDetect(JNIEnv *env,jobject thiz,jlong pCore) {
        LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return;
        linphone_tunnel_auto_detect(tunnel);
-
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelCleanServers(JNIEnv *env,jobject thiz,jlong pCore) {
@@ -2013,13 +2415,13 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){
        const char* cname=env->GetStringUTFChars(name, NULL);
        const char* cversion=env->GetStringUTFChars(version, NULL);
-       linphone_core_set_user_agent(cname,cversion);
+       linphone_core_set_user_agent((LinphoneCore *)pCore,cname,cversion);
        env->ReleaseStringUTFChars(name, cname);
        env->ReleaseStringUTFChars(version, cversion);
 }
 
 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isTunnelAvailable(JNIEnv *env,jobject thiz){
-       return linphone_core_tunnel_available();
+       return (jboolean)linphone_core_tunnel_available();
 }
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *env, jobject thiz, jlong lc, jboolean autoInitiate, jboolean autoAccept){
@@ -2029,11 +2431,101 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e
        linphone_core_set_video_policy((LinphoneCore *)lc, &vpol);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStaticPicture(JNIEnv *env, jobject thiz, jlong lc, jstring path) {
+       const char *cpath = env->GetStringUTFChars(path, NULL);
+       linphone_core_set_static_picture((LinphoneCore *)lc, cpath);
+       env->ReleaseStringUTFChars(path, cpath);
+}
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jint count) {
        ms_set_cpu_count(count);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioPort(JNIEnv *env, jobject thiz, jlong lc, jint port) {
+       linphone_core_set_audio_port((LinphoneCore *)lc, port);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPort(JNIEnv *env, jobject thiz, jlong lc, jint port) {
+       linphone_core_set_video_port((LinphoneCore *)lc, port);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioPortRange(JNIEnv *env, jobject thiz, jlong lc, jint min_port, jint max_port) {
+       linphone_core_set_audio_port_range((LinphoneCore *)lc, min_port, max_port);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPortRange(JNIEnv *env, jobject thiz, jlong lc, jint min_port, jint max_port) {
+       linphone_core_set_video_port_range((LinphoneCore *)lc, min_port, max_port);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioDscp(JNIEnv* env,jobject thiz,jlong ptr, jint dscp){
+       linphone_core_set_audio_dscp((LinphoneCore*)ptr,dscp);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getAudioDscp(JNIEnv* env,jobject thiz,jlong ptr){
+       return linphone_core_get_audio_dscp((LinphoneCore*)ptr);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoDscp(JNIEnv* env,jobject thiz,jlong ptr, jint dscp){
+       linphone_core_set_video_dscp((LinphoneCore*)ptr,dscp);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getVideoDscp(JNIEnv* env,jobject thiz,jlong ptr){
+       return linphone_core_get_video_dscp((LinphoneCore*)ptr);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setIncomingTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) {
+       linphone_core_set_inc_timeout((LinphoneCore *)lc, timeout);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setInCallTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) {
+       linphone_core_set_in_call_timeout((LinphoneCore *)lc, timeout);
+}
+
 extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv*  env,jobject  thiz,jlong ptr) {
        jstring jvalue =env->NewStringUTF(linphone_core_get_version());
        return jvalue;
 }
+
+extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getConfig(JNIEnv *env, jobject thiz, jlong lc) {
+       return (jlong) linphone_core_get_config((LinphoneCore *)lc);
+}
+
+extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_upnpAvailable(JNIEnv *env, jobject thiz, jlong lc) {
+       return (jboolean) linphone_core_upnp_available((LinphoneCore *)lc);
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getUpnpState(JNIEnv *env, jobject thiz, jlong lc) {
+       return (jint) linphone_core_get_upnp_state((LinphoneCore *)lc);
+}
+
+extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getUpnpExternalIpaddress(JNIEnv *env, jobject thiz, jlong lc) {
+       jstring jvalue = env->NewStringUTF(linphone_core_get_upnp_external_ipaddress((LinphoneCore *)lc));
+       return jvalue;
+}
+
+extern "C" jlong Java_org_linphone_core_LpConfigImpl_newLpConfigImpl(JNIEnv *env, jobject thiz, jstring file) {
+        const char *cfile = env->GetStringUTFChars(file, NULL);
+        LpConfig *lp = lp_config_new(cfile);
+       env->ReleaseStringUTFChars(file, cfile);
+       return (jlong) lp;
+}
+
+extern "C" void Java_org_linphone_core_LpConfigImpl_sync(JNIEnv *env, jobject thiz, jlong lpc) {
+       LpConfig *lp = (LpConfig *)lpc;
+       lp_config_sync(lp);
+}
+
+extern "C" void Java_org_linphone_core_LpConfigImpl_delete(JNIEnv *env, jobject thiz, jlong lpc) {
+       LpConfig *lp = (LpConfig *)lpc;
+       lp_config_destroy(lp);
+}
+
+extern "C" void Java_org_linphone_core_LpConfigImpl_setInt(JNIEnv *env, jobject thiz, jlong lpc,
+               jstring section, jstring key, jint value) {
+        const char *csection = env->GetStringUTFChars(section, NULL);
+        const char *ckey = env->GetStringUTFChars(key, NULL);
+        lp_config_set_int((LpConfig *)lpc, csection, ckey, (int) value);
+        env->ReleaseStringUTFChars(section, csection);
+        env->ReleaseStringUTFChars(key, ckey);
+}
+