From 01331f08a99297b9fd76494f3eba8c1476ba0494 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 15 Feb 2010 18:02:19 +0100 Subject: [PATCH] add traces + more jni implementation --- coreapi/address.c | 1 + coreapi/linphonecore.c | 2 +- coreapi/linphonecore_jni.cc | 28 ++++++++++++++++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/coreapi/address.c b/coreapi/address.c index 36f6de903..9c69a2641 100644 --- a/coreapi/address.c +++ b/coreapi/address.c @@ -36,6 +36,7 @@ LinphoneAddress * linphone_address_new(const char *uri){ osip_from_init(&from); if (osip_from_parse(from,uri)!=0){ osip_from_free(from); + ms_error("Cannot create LinphoneAddress, bad uri [%s]",uri); return NULL; } return from; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d54b4907e..d5d7e43f1 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1836,7 +1836,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) err=eXosip_call_build_initial_invite(&invite,real_url,from, route,"Phone call"); if (err<0){ - ms_warning("Could not build initial invite"); + ms_warning("Could not build initial invite cause [%i]",err); goto end; } if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 5fd60b1ad..9380c6196 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -222,9 +222,24 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEn ,jlong lc) { return (jlong)linphone_core_get_remote_uri((LinphoneCore*)lc); } +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall( JNIEnv* env + ,jobject thiz + ,jlong lc) { + return linphone_core_in_call((LinphoneCore*)lc); +} +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending( JNIEnv* env + ,jobject thiz + ,jlong lc) { + return linphone_core_inc_invite_pending((LinphoneCore*)lc); +} +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall( JNIEnv* env + ,jobject thiz + ,jlong lc) { + linphone_core_accept_call((LinphoneCore*)lc,NULL); +} //ProxyConfig extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) { @@ -256,9 +271,12 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_done(JNIEnv* env, linphone_proxy_config_done((LinphoneProxyConfig*)proxyCfg); } extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhoneNumber(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jnumber) { + if (jnumber == 0) { + ms_error("cannot normalized null number"); + } const char* number = env->GetStringUTFChars(jnumber, NULL); int len = env->GetStringLength(jnumber); - char targetBuff[len]; + char targetBuff[2*len];// returned number can be greater than origin (specially in case of prefix insertion linphone_proxy_config_normalize_number((LinphoneProxyConfig*)proxyCfg,number,targetBuff,sizeof(targetBuff)); jstring normalizedNumber = env->NewStringUTF(targetBuff); env->ReleaseStringUTFChars(jnumber, number); @@ -274,9 +292,11 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIE return NULL; } } +extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean value) { + linphone_proxy_config_set_dial_escape_plus((LinphoneProxyConfig*)proxyCfg,value); +} - -void Java_org_linphone_core_LinphoneProxyConfigImpl_setPrefix(JNIEnv* env +extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNIEnv* env ,jobject thiz ,jlong proxyCfg ,jstring jprefix) { @@ -318,7 +338,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneAddressImpl_newLinphoneAddressIm ,jstring jdisplayName) { const char* uri = env->GetStringUTFChars(juri, NULL); LinphoneAddress* address = linphone_address_new(uri); - if (jdisplayName) { + if (jdisplayName && address) { const char* displayName = env->GetStringUTFChars(jdisplayName, NULL); linphone_address_set_display_name(address,displayName); env->ReleaseStringUTFChars(jdisplayName, displayName);