Commit c03dd6f3 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Add setNatPolicy to proxy config in JNI

parent df716458
...@@ -2872,6 +2872,10 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getNatP ...@@ -2872,6 +2872,10 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getNatP
return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL; return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL;
} }
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setNatPolicy(JNIEnv* env,jobject thiz,jlong proxyCfg, jlong jnat_policy) {
linphone_proxy_config_set_nat_policy((LinphoneProxyConfig *)proxyCfg, (LinphoneNatPolicy *)jnat_policy);
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) { extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
if (jroute != NULL) { if (jroute != NULL) {
const char* route = GetStringUTFChars(env, jroute); const char* route = GetStringUTFChars(env, jroute);
......
...@@ -90,6 +90,12 @@ public interface LinphoneProxyConfig { ...@@ -90,6 +90,12 @@ public interface LinphoneProxyConfig {
*/ */
public LinphoneNatPolicy getNatPolicy(); public LinphoneNatPolicy getNatPolicy();
/**
* Set nat policy on Linphone proxy config
* @param natpolicy
*/
public void setNatPolicy(LinphoneNatPolicy natpolicy);
/** /**
* normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
* @param number * @param number
......
...@@ -101,6 +101,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { ...@@ -101,6 +101,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
private native int lookupCCCFromE164(long nativePtr, String e164); private native int lookupCCCFromE164(long nativePtr, String e164);
private native Object getNatPolicy(long nativePtr); private native Object getNatPolicy(long nativePtr);
private native void setNatPolicy(long nativePtr, long natpolicy);
public LinphoneProxyConfig enableRegister(boolean value) { public LinphoneProxyConfig enableRegister(boolean value) {
...@@ -127,9 +128,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { ...@@ -127,9 +128,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
} }
public LinphoneNatPolicy getNatPolicy() { public LinphoneNatPolicy getNatPolicy() {
isValid();
return (LinphoneNatPolicy)getNatPolicy(nativePtr); return (LinphoneNatPolicy)getNatPolicy(nativePtr);
} }
public void setNatPolicy(LinphoneNatPolicy natpolicy) {
isValid();
setNatPolicy(nativePtr, ((LinphoneNatPolicyImpl)natpolicy).mNativePtr);
}
public void setIdentity(String identity) throws LinphoneCoreException { public void setIdentity(String identity) throws LinphoneCoreException {
isValid(); isValid();
setIdentity(nativePtr,identity); setIdentity(nativePtr,identity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment