From c62793c2801b8ba30b7d9a31c39b5e39ce4063cc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 1 Jun 2016 19:44:50 +0200 Subject: [PATCH] merge patch adding java wrapper for linphone_proxy_config_set/get_customer_header() --- coreapi/linphonecore_jni.cc | 16 ++++++++++++++ .../linphone/core/LinphoneProxyConfig.java | 16 ++++++++++++++ .../core/LinphoneProxyConfigImpl.java | 21 ++++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e0b8ef53f..3feeda4eb 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -4697,6 +4697,22 @@ JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_isPhon } } +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setCustomHeader(JNIEnv *env, jobject thiz, jlong prt, jstring jname, jstring jvalue) { + const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL; + const char *value = jvalue ? env->GetStringUTFChars(jvalue, NULL) : NULL; + linphone_proxy_config_set_custom_header((LinphoneProxyConfig*) prt, name, value); + if (jname) env->ReleaseStringUTFChars(jname, name); + if (jvalue) env->ReleaseStringUTFChars(jvalue, value); +} + +JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong ptr, jstring jname) { + const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL; + jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_custom_header((LinphoneProxyConfig *)ptr, name)); + if (jname) env->ReleaseStringUTFChars(jname, name); + return jvalue; +} + + extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) { return (jint)linphone_call_get_duration((LinphoneCall *) ptr); } diff --git a/java/common/org/linphone/core/LinphoneProxyConfig.java b/java/common/org/linphone/core/LinphoneProxyConfig.java index 12c6b1c1b..c022f6245 100644 --- a/java/common/org/linphone/core/LinphoneProxyConfig.java +++ b/java/common/org/linphone/core/LinphoneProxyConfig.java @@ -335,4 +335,20 @@ public interface LinphoneProxyConfig { * @return an Object. */ Object getUserData(); + + /** + * Set a custom header + * @param a string containing the name of the header + * @param a string containing the value of the header + **/ + public void setCustomHeader(String name, String value); + + /** + * Return the value of a header + * @param name a string containing the name of the header + * @retur the value of the header + **/ + public String getCustomHeader(String name); + + } diff --git a/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java b/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java index e887f4eac..3c6f95b94 100644 --- a/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java +++ b/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java @@ -99,7 +99,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native int lookupCCCFromIso(long nativePtr, String iso); private native int lookupCCCFromE164(long nativePtr, String e164); - + + public LinphoneProxyConfig enableRegister(boolean value) { isValid(); enableRegister(nativePtr,value); @@ -402,4 +403,22 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public Object getUserData() { return userData; } + + + private native void setCustomHeader(long ptr, String name, String value); + @Override + public void setCustomHeader(String name, String value){ + setCustomHeader(nativePtr, name, value); + } + + + private native String getCustomHeader(long ptr, String name); + @Override + public String getCustomHeader(String name){ + return getCustomHeader(nativePtr, name); + } + + + + }