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"
24 #include <cpu-features.h>
27 #include <android/log.h>
28 extern "C" void libmsilbc_init();
30 extern "C" void libmsx264_init();
33 extern "C" void libmsamr_init();
40 static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
43 case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break;
44 case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break;
45 case ORTP_WARNING: prio = ANDROID_LOG_WARN; break;
46 case ORTP_ERROR: prio = ANDROID_LOG_ERROR; break;
47 case ORTP_FATAL: prio = ANDROID_LOG_FATAL; break;
48 default: prio = ANDROID_LOG_DEFAULT; break;
50 __android_log_vprint(prio, LOG_DOMAIN, fmt, args);
54 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
60 return JNI_VERSION_1_2;
65 extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv* env
69 linphone_core_enable_logs_with_cb(linphone_android_log_handler);
71 linphone_core_disable_logs();
76 class LinphoneCoreData {
78 LinphoneCoreData(JNIEnv* env, jobject lc,jobject alistener, jobject auserdata) {
80 core = env->NewGlobalRef(lc);
81 listener = env->NewGlobalRef(alistener);
82 userdata = auserdata?env->NewGlobalRef(auserdata):0;
83 memset(&vTable,0,sizeof(vTable));
84 vTable.show = showInterfaceCb;
85 vTable.auth_info_requested = authInfoRequested;
86 vTable.display_status = displayStatusCb;
87 vTable.display_message = displayMessageCb;
88 vTable.display_warning = displayMessageCb;
89 vTable.global_state_changed = globalStateChange;
90 vTable.registration_state_changed = registrationStateChange;
91 vTable.call_state_changed = callStateChange;
92 vTable.text_received = text_received;
93 vTable.new_subscription_request = new_subscription_request;
94 vTable.notify_presence_recv = notify_presence_recv;
96 listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
97 /*displayStatus(LinphoneCore lc,String message);*/
98 displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
99 /*void generalState(LinphoneCore lc,int state); */
100 globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
101 globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
102 globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
103 /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
104 registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
105 registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
106 registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
107 /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
108 callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
109 callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
110 callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
111 /*void ecCalibrationStatus(LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);*/
112 ecCalibrationStatusId = env->GetMethodID(listernerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V");
113 ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus"));
114 ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;");
115 /*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
116 newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
118 /*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
119 notifyPresenceReceivedId = env->GetMethodID(listernerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
121 /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
122 textReceivedId = env->GetMethodID(listernerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
124 proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
125 proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
127 callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
128 callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
130 chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl"));
131 chatRoomCtrId = env->GetMethodID(chatRoomClass,"<init>", "(J)V");
133 friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));;
134 friendCtrId =env->GetMethodID(friendClass,"<init>", "(J)V");
136 addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl"));
137 addressCtrId =env->GetMethodID(addressClass,"<init>", "(J)V");
141 ~LinphoneCoreData() {
143 jvm->AttachCurrentThread(&env,NULL);
144 env->DeleteGlobalRef(core);
145 env->DeleteGlobalRef(listener);
146 if (userdata) env->DeleteGlobalRef(userdata);
147 env->DeleteGlobalRef(listernerClass);
148 env->DeleteGlobalRef(globalStateClass);
149 env->DeleteGlobalRef(registrationStateClass);
150 env->DeleteGlobalRef(callStateClass);
151 env->DeleteGlobalRef(proxyClass);
152 env->DeleteGlobalRef(callClass);
153 env->DeleteGlobalRef(chatRoomClass);
154 env->DeleteGlobalRef(friendClass);
161 jclass listernerClass;
162 jmethodID displayStatusId;
163 jmethodID newSubscriptionRequestId;
164 jmethodID notifyPresenceReceivedId;
165 jmethodID textReceivedId;
167 jclass globalStateClass;
168 jmethodID globalStateId;
169 jmethodID globalStateFromIntId;
171 jclass registrationStateClass;
172 jmethodID registrationStateId;
173 jmethodID registrationStateFromIntId;
175 jclass callStateClass;
176 jmethodID callStateId;
177 jmethodID callStateFromIntId;
179 jclass ecCalibratorStatusClass;
180 jmethodID ecCalibrationStatusId;
181 jmethodID ecCalibratorStatusFromIntId;
184 jmethodID proxyCtrId;
189 jclass chatRoomClass;
190 jmethodID chatRoomCtrId;
193 jmethodID friendCtrId;
196 jmethodID addressCtrId;
198 LinphoneCoreVTable vTable;
200 static void showInterfaceCb(LinphoneCore *lc) {
203 static void byeReceivedCb(LinphoneCore *lc, const char *from) {
206 static void displayStatusCb(LinphoneCore *lc, const char *message) {
208 jint result = jvm->AttachCurrentThread(&env,NULL);
210 ms_error("cannot attach VM\n");
213 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
214 env->CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,env->NewStringUTF(message));
216 static void displayMessageCb(LinphoneCore *lc, const char *message) {
219 static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username) {
222 static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
224 jint result = jvm->AttachCurrentThread(&env,NULL);
226 ms_error("cannot attach VM\n");
229 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
230 env->CallVoidMethod(lcData->listener
231 ,lcData->globalStateId
233 ,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,(jint)gstate),
234 message ? env->NewStringUTF(message) : NULL);
236 static void registrationStateChange(LinphoneCore *lc, LinphoneProxyConfig* proxy,LinphoneRegistrationState state,const char* message) {
238 jint result = jvm->AttachCurrentThread(&env,NULL);
240 ms_error("cannot attach VM\n");
243 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
244 env->CallVoidMethod(lcData->listener
245 ,lcData->registrationStateId
247 ,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,(jlong)proxy)
248 ,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
249 message ? env->NewStringUTF(message) : NULL);
251 static void callStateChange(LinphoneCore *lc, LinphoneCall* call,LinphoneCallState state,const char* message) {
253 jint result = jvm->AttachCurrentThread(&env,NULL);
255 ms_error("cannot attach VM\n");
258 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
259 env->CallVoidMethod(lcData->listener
262 ,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call)
263 ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
264 message ? env->NewStringUTF(message) : NULL);
266 static void notify_presence_recv (LinphoneCore *lc, LinphoneFriend *my_friend) {
268 jint result = jvm->AttachCurrentThread(&env,NULL);
270 ms_error("cannot attach VM\n");
273 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
274 env->CallVoidMethod(lcData->listener
275 ,lcData->notifyPresenceReceivedId
277 ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend));
279 static void new_subscription_request (LinphoneCore *lc, LinphoneFriend *my_friend, const char* url) {
281 jint result = jvm->AttachCurrentThread(&env,NULL);
283 ms_error("cannot attach VM\n");
286 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
287 env->CallVoidMethod(lcData->listener
288 ,lcData->newSubscriptionRequestId
290 ,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend)
291 ,url ? env->NewStringUTF(url) : NULL);
293 static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
295 jint result = jvm->AttachCurrentThread(&env,NULL);
297 ms_error("cannot attach VM\n");
300 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
301 env->CallVoidMethod(lcData->listener
302 ,lcData->textReceivedId
304 ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
305 ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from)
306 ,message ? env->NewStringUTF(message) : NULL);
308 static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
310 jint result = jvm->AttachCurrentThread(&env,NULL);
312 ms_error("cannot attach VM\n");
315 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
316 env->CallVoidMethod(lcData->listener
317 ,lcData->ecCalibrationStatusId
319 ,env->CallStaticObjectMethod(lcData->ecCalibratorStatusClass,lcData->ecCalibratorStatusFromIntId,(jint)status)
321 ,data ? data : NULL);
322 if (data != NULL &&status !=LinphoneEcCalibratorInProgress ) {
323 //final state, releasing global ref
324 env->DeleteGlobalRef((jobject)data);
331 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
335 ,jstring jfactoryConfig
338 const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
339 const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
340 LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata);
343 libmsilbc_init(); // requires an fpu
351 jlong nativePtr = (jlong)linphone_core_new( &ldata->vTable
355 //clear auth info list
356 linphone_core_clear_all_auth_info((LinphoneCore*) nativePtr);
357 //clear existing proxy config
358 linphone_core_clear_proxy_config((LinphoneCore*) nativePtr);
360 if (userConfig) env->ReleaseStringUTFChars(juserConfig, userConfig);
361 if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
364 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env
367 LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc);
368 linphone_core_destroy((LinphoneCore*)lc);
372 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
373 linphone_core_clear_proxy_config((LinphoneCore*)lc);
376 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDefaultProxyConfig( JNIEnv* env
380 linphone_core_set_default_proxy((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
382 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig( JNIEnv* env
385 LinphoneProxyConfig *config=0;
386 linphone_core_get_default_proxy((LinphoneCore*)lc,&config);
387 return (jlong)config;
390 extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* env
395 LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)pc;
396 linphone_proxy_config_set_user_data(proxy, env->NewGlobalRef(jproxyCfg));
398 return linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
401 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
402 linphone_core_clear_all_auth_info((LinphoneCore*)lc);
405 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addAuthInfo( JNIEnv* env
409 linphone_core_add_auth_info((LinphoneCore*)lc,(LinphoneAuthInfo*)pc);
411 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_iterate( JNIEnv* env
414 linphone_core_iterate((LinphoneCore*)lc);
416 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite( JNIEnv* env
420 const char* uri = env->GetStringUTFChars(juri, NULL);
421 LinphoneCall* lCall = linphone_core_invite((LinphoneCore*)lc,uri);
422 env->ReleaseStringUTFChars(juri, uri);
425 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddress( JNIEnv* env
429 return (jlong) linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
432 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall( JNIEnv* env
436 linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
439 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEnv* env
442 return (jlong)linphone_core_get_current_call_remote_address((LinphoneCore*)lc);
444 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall( JNIEnv* env
448 return linphone_core_in_call((LinphoneCore*)lc);
450 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending( JNIEnv* env
454 return linphone_core_inc_invite_pending((LinphoneCore*)lc);
456 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall( JNIEnv* env
461 linphone_core_accept_call((LinphoneCore*)lc,(LinphoneCall*)call);
464 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* env
468 return (jlong)ms_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position);
470 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs( JNIEnv* env
473 return ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
475 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable( JNIEnv* env
478 ,jboolean isReachable) {
479 linphone_core_set_network_reachable((LinphoneCore*)lc,isReachable);
482 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env
486 linphone_core_set_playback_gain_db((LinphoneCore*)lc,gain);
489 extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getPlaybackGain( JNIEnv* env
492 return linphone_core_get_playback_gain_db((LinphoneCore*)lc);
495 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_muteMic( JNIEnv* env
499 linphone_core_mute_mic((LinphoneCore*)lc,isMuted);
502 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_interpretUrl( JNIEnv* env
506 const char* url = env->GetStringUTFChars(jurl, NULL);
507 jlong result = (jlong)linphone_core_interpret_url((LinphoneCore*)lc,url);
508 env->ReleaseStringUTFChars(jurl, url);
511 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_sendDtmf( JNIEnv* env
515 linphone_core_send_dtmf((LinphoneCore*)lc,dtmf);
517 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_playDtmf( JNIEnv* env
522 linphone_core_play_dtmf((LinphoneCore*)lc,dtmf,duration);
524 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv* env
527 linphone_core_stop_dtmf((LinphoneCore*)lc);
530 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* env
533 linphone_core_clear_call_logs((LinphoneCore*)lc);
535 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isMicMuted( JNIEnv* env
538 return linphone_core_is_mic_muted((LinphoneCore*)lc);
540 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv* env
545 const char* mime = env->GetStringUTFChars(jmime, NULL);
546 jlong result = (jlong)linphone_core_find_payload_type((LinphoneCore*)lc,mime,rate);
547 env->ReleaseStringUTFChars(jmime, mime);
550 extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env
553 const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
554 int codecsCount = ms_list_size(codecs);
555 jlongArray jCodecs = env->NewLongArray(codecsCount);
556 jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
558 for (int i = 0; i < codecsCount; i++ ) {
559 jInternalArray[i] = (unsigned long) (codecs->data);
560 codecs = codecs->next;
563 env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
568 extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
571 const MSList* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc);
572 int codecsCount = ms_list_size(codecs);
573 jlongArray jCodecs = env->NewLongArray(codecsCount);
574 jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
576 for (int i = 0; i < codecsCount; i++ ) {
577 jInternalArray[i] = (unsigned long) (codecs->data);
578 codecs = codecs->next;
581 env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
586 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
591 return linphone_core_enable_payload_type((LinphoneCore*)lc,(PayloadType*)pt,enable);
593 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv* env
597 linphone_core_enable_echo_cancellation((LinphoneCore*)lc,enable);
599 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEnabled(JNIEnv* env
603 return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
606 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env
610 return (jlong)linphone_core_get_current_call((LinphoneCore*)lc);
612 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
617 linphone_core_add_friend((LinphoneCore*)lc,(LinphoneFriend*)aFriend);
619 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv* env
623 ,jstring jalternative_contact
625 const char* alternative_contact = jalternative_contact?env->GetStringUTFChars(jalternative_contact, NULL):NULL;
626 linphone_core_set_presence_info((LinphoneCore*)lc,minute_away,alternative_contact,(LinphoneOnlineStatus)status);
627 if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact);
630 extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* env
635 const char* to = env->GetStringUTFChars(jto, NULL);
636 LinphoneChatRoom* lResult = linphone_core_create_chat_room((LinphoneCore*)lc,to);
637 env->ReleaseStringUTFChars(jto, to);
638 return (long)lResult;
641 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv* env
644 ,jboolean vcap_enabled
645 ,jboolean display_enabled) {
646 linphone_core_enable_video((LinphoneCore*)lc, vcap_enabled,display_enabled);
649 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isVideoEnabled(JNIEnv* env
652 return linphone_core_video_enabled((LinphoneCore*)lc);
654 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRing(JNIEnv* env
658 const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
659 linphone_core_set_ring((LinphoneCore*)lc,path);
660 if (path) env->ReleaseStringUTFChars(jpath, path);
662 extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
666 const char* path = linphone_core_get_ring((LinphoneCore*)lc);
668 return env->NewStringUTF(path);
673 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableKeepAlive(JNIEnv* env
677 linphone_core_enable_keep_alive((LinphoneCore*)lc,enable);
680 extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isKeepAliveEnabled(JNIEnv* env
683 return linphone_core_keep_alive_enabled((LinphoneCore*)lc);
686 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNIEnv* env
690 return linphone_core_start_echo_calibration((LinphoneCore*)lc
691 , LinphoneCoreData::ecCalibrationStatus
692 , data?env->NewGlobalRef(data):NULL);
700 extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) {
701 LinphoneProxyConfig* proxy = linphone_proxy_config_new();
702 return (jlong) proxy;
705 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_delete(JNIEnv* env,jobject thiz,jlong ptr) {
706 linphone_proxy_config_destroy((LinphoneProxyConfig*)ptr);
708 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jidentity) {
709 const char* identity = env->GetStringUTFChars(jidentity, NULL);
710 linphone_proxy_config_set_identity((LinphoneProxyConfig*)proxyCfg,identity);
711 env->ReleaseStringUTFChars(jidentity, identity);
713 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg) {
714 const char* identity = linphone_proxy_config_get_identity((LinphoneProxyConfig*)proxyCfg);
716 return env->NewStringUTF(identity);
721 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
722 const char* proxy = env->GetStringUTFChars(jproxy, NULL);
723 int err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
724 env->ReleaseStringUTFChars(jproxy, proxy);
727 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEnv* env,jobject thiz,jlong proxyCfg) {
728 const char* proxy = linphone_proxy_config_get_addr((LinphoneProxyConfig*)proxyCfg);
730 return env->NewStringUTF(proxy);
735 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
736 if (jroute != NULL) {
737 const char* route = env->GetStringUTFChars(jroute, NULL);
738 int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
739 env->ReleaseStringUTFChars(jroute, route);
742 return linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
745 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) {
746 const char* route = linphone_proxy_config_get_route((LinphoneProxyConfig*)proxyCfg);
748 return env->NewStringUTF(route);
754 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enableRegister(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean enableRegister) {
755 linphone_proxy_config_enable_register((LinphoneProxyConfig*)proxyCfg,enableRegister);
757 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegistered(JNIEnv* env,jobject thiz,jlong proxyCfg) {
758 return linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg);
760 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegisterEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
761 return linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg);
763 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_edit(JNIEnv* env,jobject thiz,jlong proxyCfg) {
764 linphone_proxy_config_edit((LinphoneProxyConfig*)proxyCfg);
766 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_done(JNIEnv* env,jobject thiz,jlong proxyCfg) {
767 linphone_proxy_config_done((LinphoneProxyConfig*)proxyCfg);
769 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhoneNumber(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jnumber) {
771 ms_error("cannot normalized null number");
773 const char* number = env->GetStringUTFChars(jnumber, NULL);
774 int len = env->GetStringLength(jnumber);
776 ms_warning("cannot normalize empty number");
779 char targetBuff[2*len];// returned number can be greater than origin (specially in case of prefix insertion
780 linphone_proxy_config_normalize_number((LinphoneProxyConfig*)proxyCfg,number,targetBuff,sizeof(targetBuff));
781 jstring normalizedNumber = env->NewStringUTF(targetBuff);
782 env->ReleaseStringUTFChars(jnumber, number);
783 return normalizedNumber;
785 extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
788 const char* domain = linphone_proxy_config_get_domain((LinphoneProxyConfig*)proxyCfg);
790 return env->NewStringUTF(domain);
795 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean value) {
796 linphone_proxy_config_set_dial_escape_plus((LinphoneProxyConfig*)proxyCfg,value);
799 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNIEnv* env
803 const char* prefix = env->GetStringUTFChars(jprefix, NULL);
804 linphone_proxy_config_set_dial_prefix((LinphoneProxyConfig*)proxyCfg,prefix);
805 env->ReleaseStringUTFChars(jprefix, prefix);
807 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enablePublish(JNIEnv* env
811 linphone_proxy_config_enable_publish((LinphoneProxyConfig*)proxyCfg,val);
813 extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
814 return linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg);
819 extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
827 const char* username = env->GetStringUTFChars(jusername, NULL);
828 const char* password = env->GetStringUTFChars(jpassword, NULL);
829 jlong auth = (jlong)linphone_auth_info_new(username,NULL,password,NULL,NULL);
831 env->ReleaseStringUTFChars(jusername, username);
832 env->ReleaseStringUTFChars(jpassword, password);
836 extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_delete(JNIEnv* env
839 linphone_auth_info_destroy((LinphoneAuthInfo*)ptr);
844 extern "C" jlong Java_org_linphone_core_LinphoneAddressImpl_newLinphoneAddressImpl(JNIEnv* env
847 ,jstring jdisplayName) {
848 const char* uri = env->GetStringUTFChars(juri, NULL);
849 LinphoneAddress* address = linphone_address_new(uri);
850 if (jdisplayName && address) {
851 const char* displayName = env->GetStringUTFChars(jdisplayName, NULL);
852 linphone_address_set_display_name(address,displayName);
853 env->ReleaseStringUTFChars(jdisplayName, displayName);
855 env->ReleaseStringUTFChars(juri, uri);
857 return (jlong) address;
859 extern "C" void Java_org_linphone_core_LinphoneAddressImpl_delete(JNIEnv* env
862 linphone_address_destroy((LinphoneAddress*)ptr);
865 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDisplayName(JNIEnv* env
868 const char* displayName = linphone_address_get_display_name((LinphoneAddress*)ptr);
870 return env->NewStringUTF(displayName);
875 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getUserName(JNIEnv* env
878 const char* userName = linphone_address_get_username((LinphoneAddress*)ptr);
880 return env->NewStringUTF(userName);
885 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_getDomain(JNIEnv* env
888 const char* domain = linphone_address_get_domain((LinphoneAddress*)ptr);
890 return env->NewStringUTF(domain);
896 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_toString(JNIEnv* env
899 char* uri = linphone_address_as_string((LinphoneAddress*)ptr);
900 jstring juri =env->NewStringUTF(uri);
904 extern "C" jstring Java_org_linphone_core_LinphoneAddressImpl_toUri(JNIEnv* env
907 char* uri = linphone_address_as_string_uri_only((LinphoneAddress*)ptr);
908 jstring juri =env->NewStringUTF(uri);
912 extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setDisplayName(JNIEnv* env
915 ,jstring jdisplayName) {
916 const char* displayName = jdisplayName!= NULL?env->GetStringUTFChars(jdisplayName, NULL):NULL;
917 linphone_address_set_display_name((LinphoneAddress*)address,displayName);
918 if (displayName != NULL) env->ReleaseStringUTFChars(jdisplayName, displayName);
923 extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getFrom(JNIEnv* env
926 return (jlong)((LinphoneCallLog*)ptr)->from;
928 extern "C" jlong Java_org_linphone_core_LinphoneCallLogImpl_getTo(JNIEnv* env
931 return (jlong)((LinphoneCallLog*)ptr)->to;
933 extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv* env
936 return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
940 extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
941 PayloadType* pt = (PayloadType*)ptr;
942 char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
943 ,payload_type_get_mime(pt)
944 ,payload_type_get_rate(pt)
945 ,payload_type_get_bitrate(pt));
946 jstring jvalue =env->NewStringUTF(value);
950 extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv* env,jobject thiz,jlong ptr) {
951 PayloadType* pt = (PayloadType*)ptr;
952 jstring jvalue =env->NewStringUTF(payload_type_get_mime(pt));
955 extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobject thiz, jlong ptr) {
956 PayloadType* pt = (PayloadType*)ptr;
957 return payload_type_get_rate(pt);
961 extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
964 linphone_call_ref((LinphoneCall*)ptr);
967 extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv* env
970 linphone_call_unref((LinphoneCall*)ptr);
973 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* env
976 return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr);
979 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming( JNIEnv* env
982 return linphone_call_get_dir((LinphoneCall*)ptr)==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
985 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEnv* env
988 return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
991 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env
994 return (jint)linphone_call_get_state((LinphoneCall*)ptr);
996 extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoCancellation( JNIEnv* env
1000 linphone_call_enable_echo_cancellation((LinphoneCall*)ptr,value);
1002 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoCancellationEnabled( JNIEnv* env
1005 return linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr);
1008 extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter( JNIEnv* env
1012 linphone_call_enable_echo_limiter((LinphoneCall*)ptr,value);
1014 extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoLimiterEnabled( JNIEnv* env
1017 return linphone_call_echo_limiter_enabled((LinphoneCall*)ptr);
1020 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getReplacedCall( JNIEnv* env
1023 return (jlong)linphone_call_get_replaced_call((LinphoneCall*)ptr);
1028 extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
1030 ,jstring jFriendUri) {
1031 LinphoneFriend* lResult;
1034 const char* friendUri = env->GetStringUTFChars(jFriendUri, NULL);
1035 lResult= linphone_friend_new_with_addr(friendUri);
1036 env->ReleaseStringUTFChars(jFriendUri, friendUri);
1038 lResult = linphone_friend_new();
1040 return (long)lResult;
1042 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* env
1045 ,jlong linphoneAddress) {
1046 linphone_friend_set_addr((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress);
1048 extern "C" long Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* env
1051 return (long)linphone_friend_get_address((LinphoneFriend*)ptr);
1053 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv* env
1057 linphone_friend_set_inc_subscribe_policy((LinphoneFriend*)ptr,(LinphoneSubscribePolicy)policy);
1059 extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getIncSubscribePolicy(JNIEnv* env
1062 return linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr);
1064 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEnv* env
1068 linphone_friend_enable_subscribes((LinphoneFriend*)ptr,value);
1070 extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isSubscribesEnabled(JNIEnv* env
1073 return linphone_friend_subscribes_enabled((LinphoneFriend*)ptr);
1075 extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env
1078 return linphone_friend_get_status((LinphoneFriend*)ptr);
1080 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv* env
1083 return linphone_friend_edit((LinphoneFriend*)ptr);
1085 extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env
1088 linphone_friend_done((LinphoneFriend*)ptr);
1091 extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
1094 return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
1096 extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env
1099 ,jstring jmessage) {
1100 const char* message = env->GetStringUTFChars(jmessage, NULL);
1101 linphone_chat_room_send_message((LinphoneChatRoom*)ptr,message);
1102 env->ReleaseStringUTFChars(jmessage, message);
1106 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env
1110 linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
1114 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
1115 linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
1118 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc){
1119 return linphone_core_get_firewall_policy((LinphoneCore*)lc);
1122 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
1123 const char* server = NULL;
1124 if (jserver) server=env->GetStringUTFChars(jserver, NULL);
1125 linphone_core_set_stun_server((LinphoneCore*)lc,server);
1126 if (server) env->ReleaseStringUTFChars(jserver,server);
1129 extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv *env, jobject thiz, jlong lc){
1130 const char *ret= linphone_core_get_stun_server((LinphoneCore*)lc);
1131 if (ret==NULL) return NULL;
1132 jstring jvalue =env->NewStringUTF(ret);
1136 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){
1137 linphone_call_params_set_audio_bandwidth_limit((LinphoneCallParams*)lcp, bw);
1140 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv *env, jobject thiz, jlong lcp, jboolean b){
1141 linphone_call_params_enable_video((LinphoneCallParams*)lcp, b);
1144 extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){
1145 return linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
1147 extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
1148 return linphone_call_params_destroy((LinphoneCallParams*)lc);
1150 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createDefaultCallParams(JNIEnv *env, jobject thiz, jlong lc){
1151 return (jlong) linphone_core_create_default_call_parameters((LinphoneCore*)lc);
1154 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){
1155 return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc));
1158 extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
1159 linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b);
1162 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
1163 return (jlong) linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params);
1166 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong call, jlong params){
1167 return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (LinphoneCallParams *)params);
1170 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateCall(JNIEnv *env, jobject thiz, jlong lc, jlong call, jlong params){
1171 return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (const LinphoneCallParams *)params);
1175 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc, jint width, jint height){
1177 vsize.width = (int)width;
1178 vsize.height = (int)height;
1179 linphone_core_set_preferred_video_size((LinphoneCore *)lc, vsize);
1182 extern "C" jintArray Java_org_linphone_core_LinphoneCoreImpl_getPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc){
1183 MSVideoSize vsize = linphone_core_get_preferred_video_size((LinphoneCore *)lc);
1184 jintArray arr = env->NewIntArray(2);
1185 int tVsize [2]= {vsize.width,vsize.height};
1186 env->SetIntArrayRegion(arr, 0, 2, tVsize);
1190 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
1191 linphone_core_set_download_bandwidth((LinphoneCore *)lc, (int) bw);
1194 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
1195 linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
1197 extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv* env,jobject thiz,jlong ptr) {
1198 return (int) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr);
1200 extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv* env,jobject thiz,jlong ptr,jint delay) {
1201 linphone_proxy_config_expires((LinphoneProxyConfig *) ptr, (int) delay);
1204 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
1205 linphone_call_get_duration((LinphoneCall *) ptr);
1208 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) {
1210 linphone_core_get_sip_transports((LinphoneCore *) ptr, &tr);
1223 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSignalingTransportPorts(JNIEnv* env,jobject thiz,jlong ptr,jint udp, jint tcp, jint tls) {
1224 LinphoneCore *lc = (LinphoneCore *) ptr;
1230 linphone_core_set_sip_transports(lc, &tr); // tr will be copied
1233 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableIpv6(JNIEnv* env,jobject thiz
1234 ,jlong lc, jboolean enable) {
1235 linphone_core_enable_ipv6((LinphoneCore*)lc,enable);
1238 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_adjustSoftwareVolume(JNIEnv* env,jobject thiz
1239 ,jlong ptr, jint db) {
1240 linphone_core_set_playback_gain_db((LinphoneCore *) ptr, db);
1243 extern "C" jboolean Java_org_linphone_core_Version_nativeHasNeon(JNIEnv *env){
1244 if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0)