Commit c7e98c73 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

JNI method to extract country code from e164 phone number

parent 66537559
......@@ -1132,6 +1132,12 @@ extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(
env->ReleaseStringUTFChars(jiso, iso);
return (jint) prefix;
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromE164(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring je164) {
const char* e164 = env->GetStringUTFChars(je164, NULL);
int prefix = linphone_dial_plan_lookup_ccc_from_e164(e164);
env->ReleaseStringUTFChars(je164, e164);
return (jint) prefix;
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
,jobject thiz
,jlong proxyCfg) {
......
......@@ -145,4 +145,10 @@ public interface LinphoneProxyConfig {
* @param country iso code
*/
public int lookupCCCFromIso(String iso);
/**
* Return the international prefix for the given country
* @param e164 phone number
*/
public int lookupCCCFromE164(String e164);
}
......@@ -78,6 +78,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
private native void setContactParameters(long ptr, String params);
private native int lookupCCCFromIso(long nativePtr, String iso);
private native int lookupCCCFromE164(long nativePtr, String e164);
public void enableRegister(boolean value) {
enableRegister(nativePtr,value);
......@@ -153,4 +154,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
public int lookupCCCFromIso(String iso) {
return lookupCCCFromIso(nativePtr, iso);
}
@Override
public int lookupCCCFromE164(String e164) {
return lookupCCCFromE164(nativePtr, e164);
}
}
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