Commit 594774d9 authored by Margaux Clerc's avatar Margaux Clerc
Browse files

Add isPhoneNumber function in JNI

parent ced44d17
......@@ -3863,6 +3863,17 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getReal
return jvalue;
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_isPhoneNumber(JNIEnv *env, jobject thiz, jlong ptr, jstring jusername) {
if(jusername){
const char *username=env->GetStringUTFChars(jusername, NULL);
bool_t res = linphone_proxy_config_is_phone_number((LinphoneProxyConfig *)ptr, username);
env->ReleaseStringUTFChars(jusername,username);
return (jboolean) res;
} else {
return JNI_FALSE;
}
}
extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
return (jint)linphone_call_get_duration((LinphoneCall *) ptr);
}
......
......@@ -306,6 +306,13 @@ public interface LinphoneProxyConfig {
**/
void setUserData(Object obj);
/**
* Detect if the given input is a phone number or not.
* @param username string to parse.
* @return TRUE if input is a phone number, FALSE otherwise.
**/
boolean isPhoneNumber(String username);
/**
* Returns user data from a proxy config. return null if any
* @return an Object.
......
......@@ -362,6 +362,12 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
return getPublishExpires(nativePtr);
}
private native boolean isPhoneNumber(long nativePtr,String username);
@Override
public boolean isPhoneNumber(String username){
return isPhoneNumber(nativePtr,username);
}
@Override
public void setUserData(Object obj) {
userData = obj;
......
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