3 Copyright (C) 2010 Belledonne Communications, Grenoble, France
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "linphonecore_utils.h"
22 #include "mediastreamer2/msjava.h"
25 #include <android/log.h>
26 extern "C" void libmsilbc_init();
28 extern "C" void libmsx264_init();
31 extern "C" void libmsamr_init();
38 static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
41 case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break;
42 case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break;
43 case ORTP_WARNING: prio = ANDROID_LOG_WARN; break;
44 case ORTP_ERROR: prio = ANDROID_LOG_ERROR; break;
45 case ORTP_FATAL: prio = ANDROID_LOG_FATAL; break;
46 default: prio = ANDROID_LOG_DEFAULT; break;
48 __android_log_vprint(prio, LOG_DOMAIN, fmt, args);
52 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
58 return JNI_VERSION_1_2;
63 extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv* env
67 linphone_core_enable_logs_with_cb(linphone_android_log_handler);
69 linphone_core_disable_logs();
74 class LinphoneCoreData {
76 LinphoneCoreData(JNIEnv* env, jobject lc,jobject alistener, jobject auserdata) {
78 core = env->NewGlobalRef(lc);
79 listener = env->NewGlobalRef(alistener);
80 userdata = auserdata?env->NewGlobalRef(auserdata):0;
81 memset(&vTable,0,sizeof(vTable));
82 vTable.show = showInterfaceCb;
83 vTable.auth_info_requested = authInfoRequested;
84 vTable.display_status = displayStatusCb;
85 vTable.display_message = displayMessageCb;
86 vTable.display_warning = displayMessageCb;
87 vTable.global_state_changed = globalStateChange;
88 vTable.registration_state_changed = registrationStateChange;
89 vTable.call_state_changed = callStateChange;
90 vTable.text_received = text_received;
91 vTable.new_subscription_request = new_subscription_request;
92 vTable.notify_presence_recv = notify_presence_recv;
94 listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
95 /*displayStatus(LinphoneCore lc,String message);*/
96 displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
97 /*void generalState(LinphoneCore lc,int state); */
98 globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
99 globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
100 globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
101 /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
102 registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
103 registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
104 registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
105 /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
106 callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
107 callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
108 callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
109 /*void ecCalibrationStatus(LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);*/
110 ecCalibrationStatusId = env->GetMethodID(listernerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V");
111 ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus"));
112 ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;");
113 /*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
114 newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
116 /*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
117 notifyPresenceReceivedId = env->GetMethodID(listernerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
119 /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
120 textReceivedId = env->GetMethodID(listernerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
122 proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
123 proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
125 callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
126 callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
128 chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl"));
129 chatRoomCtrId = env->GetMethodID(chatRoomClass,"<init>", "(J)V");
131 friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));;
132 friendCtrId =env->GetMethodID(friendClass,"<init>", "(J)V");
134 addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl"));
135 addressCtrId =env->GetMethodID(addressClass,"<init>", "(J)V");
139 ~LinphoneCoreData() {
141 jvm->AttachCurrentThread(&env,NULL);
142 env->DeleteGlobalRef(core);
143 env->DeleteGlobalRef(listener);
144 if (userdata) env->DeleteGlobalRef(userdata);
145 env->DeleteGlobalRef(listernerClass);
146 env->DeleteGlobalRef(globalStateClass);
147 env->DeleteGlobalRef(registrationStateClass);
148 env->DeleteGlobalRef(callStateClass);
149 env->DeleteGlobalRef(proxyClass);
150 env->DeleteGlobalRef(callClass);
151 env->DeleteGlobalRef(chatRoomClass);
152 env->DeleteGlobalRef(friendClass);
159 jclass listernerClass;
160 jmethodID displayStatusId;
161 jmethodID newSubscriptionRequestId;
162 jmethodID notifyPresenceReceivedId;
163 jmethodID textReceivedId;
165 jclass globalStateClass;
166 jmethodID globalStateId;
167 jmethodID globalStateFromIntId;
169 jclass registrationStateClass;
170 jmethodID registrationStateId;
171 jmethodID registrationStateFromIntId;
173 jclass callStateClass;
174 jmethodID callStateId;
175 jmethodID callStateFromIntId;
177 jclass ecCalibratorStatusClass;
178 jmethodID ecCalibrationStatusId;
179 jmethodID ecCalibratorStatusFromIntId;
182 jmethodID proxyCtrId;
187 jclass chatRoomClass;
188 jmethodID chatRoomCtrId;
191 jmethodID friendCtrId;
194 jmethodID addressCtrId;
196 LinphoneCoreVTable vTable;
198 static void showInterfaceCb(LinphoneCore *lc) {
201 static void byeReceivedCb(LinphoneCore *lc, const char *from) {
204 static void displayStatusCb(LinphoneCore *lc, const char *message) {
206 jint result = jvm->AttachCurrentThread(&env,NULL);
208 ms_error("cannot attach VM\n");
211 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
212 env->CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,env->NewStringUTF(message));
214 static void displayMessageCb(LinphoneCore *lc, const char *message) {
217 static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username) {
220 static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
222 jint result = jvm->AttachCurrentThread(&env,NULL);
224 ms_error("cannot attach VM\n");
227 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
228 env->CallVoidMethod(lcData->listener
229 ,lcData->globalStateId
231 ,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,(jint)gstate),
232 message ? env->NewStringUTF(message) : NULL);
234 static void registrationStateChange(LinphoneCore *lc, LinphoneProxyConfig* proxy,LinphoneRegistrationState state,const char* message) {
236 jint result = jvm->AttachCurrentThread(&env,NULL);
238 ms_error("cannot attach VM\n");
241 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
242 env->CallVoidMethod(lcData->listener
243 ,lcData->registrationStateId
245 ,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,(jlong)proxy)
246 ,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
247 message ? env->NewStringUTF(message) : NULL);
249 static void callStateChange(LinphoneCore *lc, LinphoneCall* call,LinphoneCallState state,const char* message) {
251 jint result = jvm->AttachCurrentThread(&env,NULL);
253 ms_error("cannot attach VM\n");
256 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
257 env->CallVoidMethod(lcData->listener
260 ,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call)
261 ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
262 message ? env->NewStringUTF(message) : NULL);
264 static void notify_presence_recv (LinphoneCore *lc, LinphoneFriend *my_friend) {
266 jint result = jvm->AttachCurrentThread(&env,NULL);
268 ms_error("cannot attach VM\n");
271 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
272 env->CallVoidMethod(lcData->listener
273 ,lcData->notifyPresenceReceivedId
275 ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend));
277 static void new_subscription_request (LinphoneCore *lc, LinphoneFriend *my_friend, const char* url) {
279 jint result = jvm->AttachCurrentThread(&env,NULL);
281 ms_error("cannot attach VM\n");
284 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
285 env->CallVoidMethod(lcData->listener
286 ,lcData->newSubscriptionRequestId
288 ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend)
289 ,url ? env->NewStringUTF(url) : NULL);
291 static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
293 jint result = jvm->AttachCurrentThread(&env,NULL);
295 ms_error("cannot attach VM\n");
298 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
299 env->CallVoidMethod(lcData->listener
300 ,lcData->textReceivedId
302 ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
303 ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from)
304 ,message ? env->NewStringUTF(message) : NULL);
306 static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
308 jint result = jvm->AttachCurrentThread(&env,NULL);
310 ms_error("cannot attach VM\n");
313 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
314 env->CallVoidMethod(lcData->listener
315 ,lcData->ecCalibrationStatusId
317 ,env->CallStaticObjectMethod(lcData->ecCalibratorStatusClass,lcData->ecCalibratorStatusFromIntId,(jint)status)
319 ,data ? data : NULL);
320 if (data != NULL &&status !=LinphoneEcCalibratorInProgress ) {
321 //final state, releasing global ref
322 env->DeleteGlobalRef((jobject)data);
329 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
333 ,jstring jfactoryConfig
336 const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
337 const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
338 LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata);
341 libmsilbc_init(); // requires an fpu
349 jlong nativePtr = (jlong)linphone_core_new( &ldata->vTable
353 //clear auth info list
354 linphone_core_clear_all_auth_info((LinphoneCore*) nativePtr);
355 //clear existing proxy config
356 linphone_core_clear_proxy_config((LinphoneCore*) nativePtr);
358 if (userConfig) env->ReleaseStringUTFChars(juserConfig, userConfig);
359 if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
362 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env
365 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc);
366 linphone_core_destroy((LinphoneCore*)lc);
370 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
371 linphone_core_clear_proxy_config((LinphoneCore*)lc);
374 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDefaultProxyConfig( JNIEnv* env
378 linphone_core_set_default_proxy((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
380 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig( JNIEnv* env
383 LinphoneProxyConfig *config=0;
384 linphone_core_get_default_proxy((LinphoneCore*)lc,&config);
385 return (jlong)config;
388 extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* env
393 LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)pc;
394 linphone_proxy_config_set_user_data(proxy, env->NewGlobalRef(jproxyCfg));
396 return linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
399 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
400 linphone_core_clear_all_auth_info((LinphoneCore*)lc);
403 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addAuthInfo( JNIEnv* env
407 linphone_core_add_auth_info((LinphoneCore*)lc,(LinphoneAuthInfo*)pc);
409 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_iterate( JNIEnv* env
412 linphone_core_iterate((LinphoneCore*)lc);
414 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite( JNIEnv* env
418 const char* uri = env->GetStringUTFChars(juri, NULL);
419 LinphoneCall* lCall = linphone_core_invite((LinphoneCore*)lc,uri);
420 env->ReleaseStringUTFChars(juri, uri);
423 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddress( JNIEnv* env
427 return (jlong) linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
430 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall( JNIEnv* env
434 linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
437 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEnv* env
440 return (jlong)linphone_core_get_current_call_remote_address((LinphoneCore*)lc);
442 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall( JNIEnv* env
446 return linphone_core_in_call((LinphoneCore*)lc);
448 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending( JNIEnv* env
452 return linphone_core_inc_invite_pending((LinphoneCore*)lc);
454 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall( JNIEnv* env
459 linphone_core_accept_call((LinphoneCore*)lc,(LinphoneCall*)call);
462 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* env
466 return (jlong)ms_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position);
468 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs( JNIEnv* env
471 return ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
473 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable( JNIEnv* env
476 ,jboolean isReachable) {
477 linphone_core_set_network_reachable((LinphoneCore*)lc,isReachable);
480 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env
484 linphone_core_set_playback_gain_db((LinphoneCore*)lc,gain);
487 extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain( JNIEnv* env
490 return linphone_core_get_playback_gain_db((LinphoneCore*)lc);
493 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_muteMic( JNIEnv* env
497 linphone_core_mute_mic((LinphoneCore*)lc,isMuted);
500 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_interpretUrl( JNIEnv* env
504 const char* url = env->GetStringUTFChars(jurl, NULL);
505 jlong result = (jlong)linphone_core_interpret_url((LinphoneCore*)lc,url);
506 env->ReleaseStringUTFChars(jurl, url);
509 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_sendDtmf( JNIEnv* env
513 linphone_core_send_dtmf((LinphoneCore*)lc,dtmf);
515 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_playDtmf( JNIEnv* env
520 linphone_core_play_dtmf((LinphoneCore*)lc,dtmf,duration);
522 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv* env
525 linphone_core_stop_dtmf((LinphoneCore*)lc);
528 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* env
531 linphone_core_clear_call_logs((LinphoneCore*)lc);
533 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMicMuted( JNIEnv* env
536 return linphone_core_is_mic_muted((LinphoneCore*)lc);
538 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv* env
543 const char* mime = env->GetStringUTFChars(jmime, NULL);
544 jlong result = (jlong)linphone_core_find_payload_type((LinphoneCore*)lc,mime,rate);
545 env->ReleaseStringUTFChars(jmime, mime);
548 extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env
551 const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
552 int codecsCount = ms_list_size(codecs);
553 jlongArray jCodecs = env->NewLongArray(codecsCount);
554 jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
556 for (int i = 0; i < codecsCount; i++ ) {
557 jInternalArray[i] = (unsigned long) (codecs->data);
558 codecs = codecs->next;
561 env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
566 extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
569 const MSList* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc);
570 int codecsCount = ms_list_size(codecs);
571 jlongArray jCodecs = env->NewLongArray(codecsCount);
572 jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
574 for (int i = 0; i < codecsCount; i++ ) {
575 jInternalArray[i] = (unsigned long) (codecs->data);
576 codecs = codecs->next;
579 env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
584 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
589 return linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable);
591 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv* env
595 linphone_core_enable_echo_cancellation((LinphoneCore*)lc,enable);
597 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEnabled(JNIEnv* env
601 return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
604 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env
608 return (jlong)linphone_core_get_current_call((LinphoneCore*)lc);
610 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
615 linphone_core_add_friend((LinphoneCore*)lc,(LinphoneFriend*)aFriend);
617 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv* env
621 ,jstring jalternative_contact
623 const char* alternative_contact = jalternative_contact?env->GetStringUTFChars(jalternative_contact, NULL):NULL;
624 linphone_core_set_presence_info((LinphoneCore*)lc,minute_away,alternative_contact,(LinphoneOnlineStatus)status);
625 if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact);
628 extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* env
633 const char* to = env->GetStringUTFChars(jto, NULL);
634 LinphoneChatRoom* lResult = linphone_core_create_chat_room((LinphoneCore*)lc,to);
635 env->ReleaseStringUTFChars(jto, to);
636 return (long)lResult;
639 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv* env
642 ,jboolean vcap_enabled
643 ,jboolean display_enabled) {
644 linphone_core_enable_video((LinphoneCore*)lc, vcap_enabled,display_enabled);
647 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isVideoEnabled(JNIEnv* env
650 return linphone_core_video_enabled((LinphoneCore*)lc);
652 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRing(JNIEnv* env
656 const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
657 linphone_core_set_ring((LinphoneCore*)lc,path);
658 if (path) env->ReleaseStringUTFChars(jpath, path);
660 extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
664 const char* path = linphone_core_get_ring((LinphoneCore*)lc);
666 return env->NewStringUTF(path);
671 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableKeepAlive(JNIEnv* env
675 linphone_core_enable_keep_alive((LinphoneCore*)lc,enable);
678 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isKeepAliveEnabled(JNIEnv* env
681 return linphone_core_keep_alive_enabled((LinphoneCore*)lc);
684 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNIEnv* env
688 return linphone_core_start_echo_calibration((LinphoneCore*)lc
689 , LinphoneCoreData::ecCalibrationStatus
690 , data?env->NewGlobalRef(data):NULL);
698 extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) {
699 LinphoneProxyConfig* proxy = linphone_proxy_config_new();
700 return (jlong) proxy;
703 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_delete(JNIEnv* env,jobject thiz,jlong ptr) {
704 linphone_proxy_config_destroy((LinphoneProxyConfig*)ptr);
706 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jidentity) {
707 const char* identity = env->GetStringUTFChars(jidentity, NULL);
708 linphone_proxy_config_set_identity((LinphoneProxyConfig*)proxyCfg,identity);
709 env->ReleaseStringUTFChars(jidentity, identity);
711 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg) {
712 const char* identity = linphone_proxy_config_get_identity((LinphoneProxyConfig*)proxyCfg);
714 return env->NewStringUTF(identity);
719 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
720 const char* proxy = env->GetStringUTFChars(jproxy, NULL);
721 int err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
722 env->ReleaseStringUTFChars(jproxy, proxy);
725 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEnv* env,jobject thiz,jlong proxyCfg) {
726 const char* proxy = linphone_proxy_config_get_addr((LinphoneProxyConfig*)proxyCfg);
728 return env->NewStringUTF(proxy);
733 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
734 if (jroute != NULL) {
735 const char* route = env->GetStringUTFChars(jroute, NULL);
736 int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
737 env->ReleaseStringUTFChars(jroute, route);
740 return linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
743 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) {
744 const char* route = linphone_proxy_config_get_route((LinphoneProxyConfig*)proxyCfg);
746 return env->NewStringUTF(route);
752 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enableRegister(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean enableRegister) {
753 linphone_proxy_config_enable_register((LinphoneProxyConfig*)proxyCfg,enableRegister);
755 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegistered(JNIEnv* env,jobject thiz,jlong proxyCfg) {
756 return linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg);
758 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegisterEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
759 return linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg);
761 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_edit(JNIEnv* env,jobject thiz,jlong proxyCfg) {
762 linphone_proxy_config_edit((LinphoneProxyConfig*)proxyCfg);
764 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_done(JNIEnv* env,jobject thiz,jlong proxyCfg) {
765 linphone_proxy_config_done((LinphoneProxyConfig*)proxyCfg);
767 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhoneNumber(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jnumber) {
769 ms_error("cannot normalized null number");
771 const char* number = env->GetStringUTFChars(jnumber, NULL);
772 int len = env->GetStringLength(jnumber);
774 ms_warning("cannot normalize empty number");
777 char targetBuff[2*len];// returned number can be greater than origin (specially in case of prefix insertion
778 linphone_proxy_config_normalize_number((LinphoneProxyConfig*)proxyCfg,number,targetBuff,sizeof(targetBuff));
779 jstring normalizedNumber = env->NewStringUTF(targetBuff);
780 env->ReleaseStringUTFChars(jnumber, number);
781 return normalizedNumber;
783 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
786 const char* domain = linphone_proxy_config_get_domain((LinphoneProxyConfig*)proxyCfg);
788 return env->NewStringUTF(domain);
793 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean value) {
794 linphone_proxy_config_set_dial_escape_plus((LinphoneProxyConfig*)proxyCfg,value);
797 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNIEnv* env
801 const char* prefix = env->GetStringUTFChars(jprefix, NULL);
802 linphone_proxy_config_set_dial_prefix((LinphoneProxyConfig*)proxyCfg,prefix);
803 env->ReleaseStringUTFChars(jprefix, prefix);
805 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enablePublish(JNIEnv* env
809 linphone_proxy_config_enable_publish((LinphoneProxyConfig*)proxyCfg,val);
811 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
812 return linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg);
817 extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
825 const char* username = env->GetStringUTFChars(jusername, NULL);
826 const char* password = env->GetStringUTFChars(jpassword, NULL);
827 jlong auth = (jlong)linphone_auth_info_new(username,NULL,password,NULL,NULL);
829 env->ReleaseStringUTFChars(jusername, username);
830 env->ReleaseStringUTFChars(jpassword, password);
834 extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_delete(JNIEnv* env
837 linphone_auth_info_destroy((LinphoneAuthInfo*)ptr);
842 extern "C" jlong Java_org_linphone_core_LinphoneAddressImpl_newLinphoneAddressImpl(JNIEnv* env
845 ,jstring jdisplayName) {
846 const char* uri = env->GetStringUTFChars(juri, NULL);
847 LinphoneAddress* address = linphone_address_new(uri);
848 if (jdisplayName && address) {
849 const char* displayName = env->GetStringUTFChars(jdisplayName, NULL);
850 linphone_address_set_display_name(address,displayName);
851 env->ReleaseStringUTFChars(jdisplayName, displayName);
853 env->ReleaseStringUTFChars(juri, uri);
855 return (jlong) address;
857 extern "C" void Java_org_linphone_core_LinphoneAddressImpl_delete(JNIEnv* env
860 linphone_address_destroy((LinphoneAddress*)ptr);
863 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDisplayName(JNIEnv* env
866 const char* displayName = linphone_address_get_display_name((LinphoneAddress*)ptr);
868 return env->NewStringUTF(displayName);
873 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv* env
876 const char* userName = linphone_address_get_username((LinphoneAddress*)ptr);
878 return env->NewStringUTF(userName);
883 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv* env
886 const char* domain = linphone_address_get_domain((LinphoneAddress*)ptr);
888 return env->NewStringUTF(domain);
894 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_toString(JNIEnv* env
897 char* uri = linphone_address_as_string((LinphoneAddress*)ptr);
898 jstring juri =env->NewStringUTF(uri);
902 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_toUri(JNIEnv* env
905 char* uri = linphone_address_as_string_uri_only((LinphoneAddress*)ptr);
906 jstring juri =env->NewStringUTF(uri);
910 extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setDisplayName(JNIEnv* env
913 ,jstring jdisplayName) {
914 const char* displayName = jdisplayName!= NULL?env->GetStringUTFChars(jdisplayName, NULL):NULL;
915 linphone_address_set_display_name((LinphoneAddress*)address,displayName);
916 if (displayName != NULL) env->ReleaseStringUTFChars(jdisplayName, displayName);
921 extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv* env
924 return (jlong)((LinphoneCallLog*)ptr)->from;
926 extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv* env
929 return (jlong)((LinphoneCallLog*)ptr)->to;
931 extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv* env
934 return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
938 extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
939 PayloadType* pt = (PayloadType*)ptr;
940 char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
941 ,payload_type_get_mime(pt)
942 ,payload_type_get_rate(pt)
943 ,payload_type_get_bitrate(pt));
944 jstring jvalue =env->NewStringUTF(value);
948 extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv* env,jobject thiz,jlong ptr) {
949 PayloadType* pt = (PayloadType*)ptr;
950 jstring jvalue =env->NewStringUTF(payload_type_get_mime(pt));
953 extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobject thiz, jlong ptr) {
954 PayloadType* pt = (PayloadType*)ptr;
955 return payload_type_get_rate(pt);
959 extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
962 linphone_call_ref((LinphoneCall*)ptr);
965 extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv* env
968 linphone_call_unref((LinphoneCall*)ptr);
971 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* env
974 return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr);
977 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming( JNIEnv* env
980 return linphone_call_get_dir((LinphoneCall*)ptr)==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
983 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEnv* env
986 return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
989 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env
992 return (jint)linphone_call_get_state((LinphoneCall*)ptr);
994 extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoCancellation( JNIEnv* env
998 linphone_call_enable_echo_cancellation((LinphoneCall*)ptr,value);
1000 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoCancellationEnabled( JNIEnv* env
1003 return linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr);
1006 extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter( JNIEnv* env
1010 linphone_call_enable_echo_limiter((LinphoneCall*)ptr,value);
1012 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoLimiterEnabled( JNIEnv* env
1015 return linphone_call_echo_limiter_enabled((LinphoneCall*)ptr);
1018 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getReplacedCall( JNIEnv* env
1021 return (jlong)linphone_call_get_replaced_call((LinphoneCall*)ptr);
1026 extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
1028 ,jstring jFriendUri) {
1029 LinphoneFriend* lResult;
1032 const char* friendUri = env->GetStringUTFChars(jFriendUri, NULL);
1033 lResult= linphone_friend_new_with_addr(friendUri);
1034 env->ReleaseStringUTFChars(jFriendUri, friendUri);
1036 lResult = linphone_friend_new();
1038 return (long)lResult;
1040 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* env
1043 ,jlong linphoneAddress) {
1044 linphone_friend_set_addr((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress);
1046 extern "C" long Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* env
1049 return (long)linphone_friend_get_address((LinphoneFriend*)ptr);
1051 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv* env
1055 linphone_friend_set_inc_subscribe_policy((LinphoneFriend*)ptr,(LinphoneSubscribePolicy)policy);
1057 extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getIncSubscribePolicy(JNIEnv* env
1060 return linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr);
1062 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEnv* env
1066 linphone_friend_enable_subscribes((LinphoneFriend*)ptr,value);
1068 extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isSubscribesEnabled(JNIEnv* env
1071 return linphone_friend_subscribes_enabled((LinphoneFriend*)ptr);
1073 extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env
1076 return linphone_friend_get_status((LinphoneFriend*)ptr);
1078 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv* env
1081 return linphone_friend_edit((LinphoneFriend*)ptr);
1083 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env
1086 linphone_friend_done((LinphoneFriend*)ptr);
1089 extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
1092 return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
1094 extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env
1097 ,jstring jmessage) {
1098 const char* message = env->GetStringUTFChars(jmessage, NULL);
1099 linphone_chat_room_send_message((LinphoneChatRoom*)ptr,message);
1100 env->ReleaseStringUTFChars(jmessage, message);
1104 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env
1108 linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
1112 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
1113 linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
1116 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc){
1117 return linphone_core_get_firewall_policy((LinphoneCore*)lc);
1120 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
1121 const char* server = NULL;
1122 if (jserver) server=env->GetStringUTFChars(jserver, NULL);
1123 linphone_core_set_stun_server((LinphoneCore*)lc,server);
1124 if (server) env->ReleaseStringUTFChars(jserver,server);
1127 extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv *env, jobject thiz, jlong lc){
1128 const char *ret= linphone_core_get_stun_server((LinphoneCore*)lc);
1129 if (ret==NULL) return NULL;
1130 jstring jvalue =env->NewStringUTF(ret);
1134 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){
1135 linphone_call_params_set_audio_bandwidth_limit((LinphoneCallParams*)lcp, bw);
1138 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv *env, jobject thiz, jlong lcp, jboolean b){
1139 linphone_call_params_enable_video((LinphoneCallParams*)lcp, b);
1142 extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){
1143 return linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
1145 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
1146 return linphone_call_params_destroy((LinphoneCallParams*)lc);
1148 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createDefaultCallParams(JNIEnv *env, jobject thiz, jlong lc){
1149 return (jlong) linphone_core_create_default_call_parameters((LinphoneCore*)lc);
1152 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){
1153 return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc));
1156 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
1157 linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b);
1160 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
1161 return (jlong) linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params);
1164 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong call, jlong params){
1165 return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (LinphoneCallParams *)params);
1168 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateCall(JNIEnv *env, jobject thiz, jlong lc, jlong call, jlong params){
1169 return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (const LinphoneCallParams *)params);
1173 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc, jint width, jint height){
1175 vsize.width = (int)width;
1176 vsize.height = (int)height;
1177 linphone_core_set_preferred_video_size((LinphoneCore *)lc, vsize);
1180 extern "C" jintArray Java_org_linphone_core_LinphoneCoreImpl_getPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc){
1181 MSVideoSize vsize = linphone_core_get_preferred_video_size((LinphoneCore *)lc);
1182 jintArray arr = env->NewIntArray(2);
1183 int tVsize [2]= {vsize.width,vsize.height};
1184 env->SetIntArrayRegion(arr, 0, 2, tVsize);
1188 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
1189 linphone_core_set_download_bandwidth((LinphoneCore *)lc, (int) bw);
1192 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
1193 linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
1195 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv* env,jobject thiz,jlong ptr) {
1196 return (int) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr);
1198 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv* env,jobject thiz,jlong ptr,jint delay) {
1199 linphone_proxy_config_expires((LinphoneProxyConfig *) ptr, (int) delay);
1202 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
1203 linphone_call_get_duration((LinphoneCall *) ptr);
1206 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) {
1208 linphone_core_get_sip_transports((LinphoneCore *) ptr, &tr);
1221 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSignalingTransportPorts(JNIEnv* env,jobject thiz,jlong ptr,jint udp, jint tcp, jint tls) {
1222 LinphoneCore *lc = (LinphoneCore *) ptr;
1228 linphone_core_set_sip_transports(lc, &tr); // tr will be copied
1231 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableIpv6(JNIEnv* env,jobject thiz
1232 ,jlong lc, jboolean enable) {
1233 linphone_core_enable_ipv6((LinphoneCore*)lc,enable);
1236 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_adjustSoftwareVolume(JNIEnv* env,jobject thiz
1237 ,jlong ptr, jint db) {
1238 LinphoneCore *lc = (LinphoneCore *) ptr;
1241 linphone_core_set_playback_gain_db(lc, 0);
1245 float gain = linphone_core_get_playback_gain_db(lc) + db;
1246 if (gain > 0) gain = 0;
1248 linphone_core_set_playback_gain_db(lc, gain);