#include "linphonecore_utils.h"
#include <ortp/zrtp.h>
-#ifdef TUNNEL_ENABLED
-#include "linphone_tunnel.h"
-#endif
extern "C" {
#include "mediastreamer2/mediastream.h"
#include "private.h"
#include <cpu-features.h>
+#include "lpconfig.h"
+
#ifdef ANDROID
#include <android/log.h>
extern "C" void libmsilbc_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;
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() {
//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();
}
,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);
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) {
}
+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
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) {
//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
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) {
}
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;
}
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;
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;
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;
}
return (jfloat)linphone_call_get_average_quality((LinphoneCall*)ptr);
}
-
//LinphoneFriend
extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
,jobject thiz
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) {
,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
}
//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);
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);
}
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));
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;
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);
}
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);
}
// 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
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);
}
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) {
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);
}
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);
}
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);
+}
+