X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=coreapi%2Flinphonecore_jni.cc;h=02ac62c7a8498c546a1d49f557b7fe1cca97dabc;hb=e1830ee3077b47d1557a1292e8c8b80cd01fc403;hp=d5835fe34c5560a3fdf5763070ff1a739407510b;hpb=1e75dc40229e1f8e6e5c6c121957722f11c03a3e;p=linphone diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d5835fe3..02ac62c7 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore_utils.h" #include -#ifdef TUNNEL_ENABLED -#include "linphone_tunnel.h" -#endif extern "C" { #include "mediastreamer2/mediastream.h" @@ -34,6 +31,8 @@ extern "C" { #include "private.h" #include +#include "lpconfig.h" + #ifdef ANDROID #include extern "C" void libmsilbc_init(); @@ -52,13 +51,31 @@ 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){ - int prio; - char str[4096]; +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; case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break; @@ -67,19 +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; } - vsnprintf(str, sizeof(str) - 1, fmt, args); - str[sizeof(str) - 1] = '\0'; - if (strlen(str) < 512) { - __android_log_write(prio, LOG_DOMAIN, str); - } else { - current = str; - while ((next = strchr(current, '\n')) != NULL) { - *next = '\0'; - __android_log_write(prio, LOG_DOMAIN, current); - current = next + 1; - } - __android_log_write(prio, LOG_DOMAIN, current); - } + linphone_android_log_handler(prio, fmt, args); } int dumbMethodForAllowingUsageOfCpuFeaturesFromStaticLibMediastream() { @@ -100,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(); } @@ -525,10 +532,6 @@ 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); @@ -647,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) { @@ -986,10 +996,24 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNI ,jobject data) { return (jint)linphone_core_start_echo_calibration((LinphoneCore*)lc , LinphoneCoreData::ecCalibrationStatus + , NULL + , NULL , data?env->NewGlobalRef(data):NULL); } +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 @@ -1124,6 +1148,12 @@ extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso( 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) { @@ -1159,33 +1189,150 @@ extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnable //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* userid = env->GetStringUTFChars(juserid, NULL); - const char* password = env->GetStringUTFChars(jpassword, NULL); - const char* ha1 = env->GetStringUTFChars(jha1, NULL); - const char* realm = env->GetStringUTFChars(jrealm, NULL); - jlong auth = (jlong)linphone_auth_info_new(username,userid,password,ha1,realm); - - env->ReleaseStringUTFChars(jusername, username); - env->ReleaseStringUTFChars(juserid, userid); - env->ReleaseStringUTFChars(jpassword, password); - env->ReleaseStringUTFChars(jha1, ha1); - env->ReleaseStringUTFChars(jrealm, realm); - 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 @@ -1294,6 +1441,11 @@ 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 (((LinphoneCallLog*)ptr)->start_date_time); +} extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEnv* env ,jobject thiz ,jlong ptr) { @@ -1349,7 +1501,7 @@ 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; + LinphoneCall *call = (LinphoneCall *)call_ptr; const LinphoneCallParams *params; const PayloadType *pt; const report_block_t *srb = NULL; @@ -1378,7 +1530,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr } 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; + LinphoneCall *call = (LinphoneCall *)call_ptr; const LinphoneCallParams *params; const PayloadType *pt; const report_block_t *rrb = NULL; @@ -1428,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; @@ -1490,7 +1659,17 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEn extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) { LinphoneCall *call = (LinphoneCall *)ptr; - jstring jvalue = env->NewStringUTF(linphone_call_get_remote_user_agent(call)); + 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; } @@ -1542,7 +1721,6 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getAverageQuality( JNI return (jfloat)linphone_call_get_average_quality((LinphoneCall*)ptr); } - //LinphoneFriend extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env ,jobject thiz @@ -1643,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) { @@ -1668,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 @@ -1773,8 +1979,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv } //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_LinphoneCallImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { +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); } @@ -1816,6 +2025,29 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenc 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){ return linphone_call_params_destroy((LinphoneCallParams*)lc); } @@ -1842,6 +2074,14 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_cameraEnabled(JNIEnv 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){ LinphoneCoreData *lcd=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc); return lcd->getCall(env,linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params)); @@ -1905,6 +2145,14 @@ extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env 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) { LCSipTransports tr; linphone_core_get_sip_transports((LinphoneCore *) ptr, &tr); @@ -1961,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); } @@ -1974,6 +2224,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateConference(JNIE extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv *env,jobject thiz,jlong 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); } @@ -2104,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); } @@ -2127,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) { @@ -2160,6 +2431,12 @@ 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); } @@ -2180,6 +2457,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPortRange(JNIEnv 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); } @@ -2192,3 +2485,47 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* e 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); +} +