forked from mirrors/linphone-iphone
Add isPhoneNumber function in JNI
This commit is contained in:
parent
ced44d17eb
commit
594774d991
3 changed files with 24 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue