add jni for contact parameters

This commit is contained in:
Simon Morlat 2013-12-12 11:23:01 +01:00
parent c53381e0b5
commit 4212cc43b8
3 changed files with 62 additions and 5 deletions

View file

@ -1397,10 +1397,25 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEn
}
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
const char* params = env->GetStringUTFChars(jparams, NULL);
const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params);
env->ReleaseStringUTFChars(jparams, params);
if (jparams) env->ReleaseStringUTFChars(jparams, params);
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactUriParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
linphone_proxy_config_set_contact_uri_parameters((LinphoneProxyConfig*)proxyCfg, params);
if (jparams) env->ReleaseStringUTFChars(jparams, params);
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg) {
const char* params = linphone_proxy_config_get_contact_parameters((LinphoneProxyConfig*)proxyCfg);
return params ? env->NewStringUTF(params) : NULL;
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactUriParameters(JNIEnv* env,jobject thiz,jlong proxyCfg) {
const char* params = linphone_proxy_config_get_contact_uri_parameters((LinphoneProxyConfig*)proxyCfg);
return params ? env->NewStringUTF(params) : NULL;
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
if (jroute != NULL) {
const char* route = env->GetStringUTFChars(jroute, NULL);

View file

@ -166,10 +166,34 @@ public interface LinphoneProxyConfig {
/**
* Sets parameters for the contact
* @param parameters to add
* Set optional contact parameters that will be added to the contact information sent in the registration.
* @param contact_params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else"
*
* The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or android push id.
* As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421>;android-push-id=43143-DFE23F-2323-FA2232.
**/
public void setContactParameters(String contact_params);
/**
* Get the contact's parameters.
* @return
*/
public void setContactParameters(String params);
public String getContactParameters();
/**
* Set optional contact parameters that will be added to the contact information sent in the registration, inside the URI.
* @param params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else"
*
* The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id.
* As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421;apple-push-id=43143-DFE23F-2323-FA2232>.
**/
public void setContactUriParameters(String params);
/**
* Get the contact's uri parameters.
* @return
*/
public String getContactUriParameters();
/**
* Return the international prefix for the given country

View file

@ -187,4 +187,22 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
public int getPrivacy() {
return getPrivacy(nativePtr);
}
private native String getContactParameters(long ptr);
@Override
public String getContactParameters() {
return getContactParameters(nativePtr);
}
private native void setContactUriParameters(long ptr, String params);
@Override
public void setContactUriParameters(String params) {
setContactUriParameters(nativePtr,params);
}
private native String getContactUriParameters(long ptr);
@Override
public String getContactUriParameters() {
return getContactUriParameters(nativePtr);
}
}