From 936920203a4fa75c798ba142a8bd7407497deea5 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 17 May 2010 17:08:56 +0200 Subject: [PATCH 1/2] add ilbc for android + add keep alive parameter for sal --- build/android/Android.mk | 2 +- coreapi/linphonecore.c | 3 +++ coreapi/linphonecore_jni.cc | 3 +++ coreapi/private.h | 1 + coreapi/sal.h | 2 ++ coreapi/sal_eXosip2.c | 3 +++ mediastreamer2 | 2 +- 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index 529fc02ee..50ad5bef2 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -78,7 +78,7 @@ LOCAL_STATIC_LIBRARIES := \ libeXosip2 \ libosip2 \ libgsm - +# libmsilbc \ LOCAL_MODULE_CLASS = SHARED_LIBRARIES include $(BUILD_SHARED_LIBRARY) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6247f39b8..3d5cb9a4e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -688,6 +688,8 @@ static void sip_config_read(LinphoneCore *lc) lp_config_get_int(lc->config,"sip","register_only_when_network_is_up",1); lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",1); lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1); + lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000); + sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period); } static void rtp_config_read(LinphoneCore *lc) @@ -3385,6 +3387,7 @@ void sip_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled); lp_config_set_int(lc->config,"sip","register_only_when_network_is_up",config->register_only_when_network_is_up); + lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL)); for(elem=config->proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 390c56232..7efc94ff5 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" #ifdef ANDROID #include +extern "C" void libmsilbc_init(); #endif /*ANDROID*/ extern "C" void ms_andsnd_register_card(JavaVM *jvm) ; @@ -160,7 +161,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata); #ifdef ANDROID ms_andsnd_register_card(jvm); + // requires an fpu libmsilbc_init(); #endif /*ANDROID*/ + jlong nativePtr = (jlong)linphone_core_new( &ldata->vTable ,userConfig ,factoryConfig diff --git a/coreapi/private.h b/coreapi/private.h index 4a3c1dbaa..c3e2960a3 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -260,6 +260,7 @@ typedef struct sip_config bool_t register_only_when_network_is_up; bool_t ping_with_options; bool_t auto_net_state_mon; + unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/ } sip_config_t; typedef struct rtp_config diff --git a/coreapi/sal.h b/coreapi/sal.h index 882761ffb..d3943a64d 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -226,6 +226,8 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs); int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure); ortp_socket_t sal_get_socket(Sal *ctx); void sal_set_user_agent(Sal *ctx, const char *user_agent); +/*keepalive period in ms*/ +void sal_set_keepalive_period(Sal *ctx,unsigned int value); void sal_use_session_timers(Sal *ctx, int expires); int sal_iterate(Sal *sal); MSList * sal_get_pending_auths(Sal *sal); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index d1ade9af2..ba5730139 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1690,4 +1690,7 @@ char *sal_address_as_string_uri_only(const SalAddress *u){ void sal_address_destroy(SalAddress *u){ osip_from_free((osip_from_t*)u); } +void sal_set_keepalive_period(Sal *ctx,unsigned int value) { + eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value); +} diff --git a/mediastreamer2 b/mediastreamer2 index 488263428..166db20a4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4882634280c82ca495d5bebec482d2744ddb7f61 +Subproject commit 166db20a49a308e161d7b5c74fdc5aff000db9a2 From 2cb7be8f7d16f5174cd3651a73c6f5c7cfec98d2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 18 May 2010 17:50:14 +0200 Subject: [PATCH 2/2] add external log handler --- .../linphone/core/LinphoneCoreFactory.java | 3 +- .../org/linphone/core/LinphoneLogHandler.java | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 java/common/org/linphone/core/LinphoneLogHandler.java diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index b267373a3..b3e2952fb 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -60,5 +60,6 @@ abstract public class LinphoneCoreFactory { * @param enable */ abstract public void setDebugMode(boolean enable); - + + abstract public void setLogHandler(LinphoneLogHandler handler); } diff --git a/java/common/org/linphone/core/LinphoneLogHandler.java b/java/common/org/linphone/core/LinphoneLogHandler.java new file mode 100644 index 000000000..d1330a400 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneLogHandler.java @@ -0,0 +1,29 @@ +/* +LinphoneLogHandler.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneLogHandler { + public static final int Fatal=1<<4; + public static final int Error=1<<3|Fatal; + public static final int Warn=1<<2|Error; + public static final int Info=1<<1|Warn; + public static final int Debug=1|Info; + + public void log(String loggerName, int level, String levelString, String msg, Throwable e); +}