merge patch adding java wrapper for linphone_proxy_config_set/get_customer_header()

This commit is contained in:
Simon Morlat 2016-06-01 19:44:50 +02:00
parent 5b3f085121
commit c62793c280
3 changed files with 52 additions and 1 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}
}