diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index c1a6fb00e..f98146d07 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -304,6 +304,9 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_phone_number(LinphoneA { const LinphoneDialPlan* plan = linphone_dial_plan_by_ccc(country_code); int size = (int)strlen(phone_number); + if (linphone_dial_plan_is_generic(plan)) { + return LinphoneAccountCreatorCountryCodeInvalid; + } if (size < plan->nnl - 1) { return LinphoneAccountCreatorPhoneNumberTooShort; } else if (size > plan->nnl + 1) { diff --git a/coreapi/account_creator.h b/coreapi/account_creator.h index 32a4cd9ad..09c7523b9 100644 --- a/coreapi/account_creator.h +++ b/coreapi/account_creator.h @@ -63,6 +63,7 @@ typedef enum _LinphoneAccountCreatorStatus { LinphoneAccountCreatorRouteInvalid, LinphoneAccountCreatorDisplayNameInvalid, LinphoneAccountCreatorTransportNotSupported, + LinphoneAccountCreatorCountryCodeInvalid, } LinphoneAccountCreatorStatus; /** diff --git a/coreapi/dial_plan.c b/coreapi/dial_plan.c index 4f23b05e6..bcd9c3ae4 100644 --- a/coreapi/dial_plan.c +++ b/coreapi/dial_plan.c @@ -310,3 +310,9 @@ const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) { const LinphoneDialPlan* linphone_dial_plan_get_all() { return dial_plans; } + +const bool_t linphone_dial_plan_is_generic(const LinphoneDialPlan *ccc) { + if (strcmp(ccc->country, most_common_dialplan.country) == 0) + return TRUE; + return FALSE; +} diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 98dd7859b..2490a2421 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -3346,6 +3346,20 @@ extern "C" void Java_org_linphone_core_LinphoneCallStatsImpl_updateStats(JNIEnv linphone_call_get_video_stats((LinphoneCall*)call_ptr); } +extern "C" jstring Java_org_linphone_core_LinphoneCallStatsImpl_getEncoderName(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr, jlong payload_ptr) { + LinphoneCore *lc = linphone_call_get_core((LinphoneCall*)call_ptr); + PayloadType* jpayload = (PayloadType*)payload_ptr; + jstring jencodername =env->NewStringUTF(ms_factory_get_encoder(linphone_core_get_ms_factory(lc), jpayload->mime_type)->text); + return jencodername; +} + +extern "C" jstring Java_org_linphone_core_LinphoneCallStatsImpl_getDecoderName(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr, jlong payload_ptr) { + LinphoneCore *lc = linphone_call_get_core((LinphoneCall*)call_ptr); + PayloadType* jpayload = (PayloadType*)payload_ptr; + jstring jdecodername =env->NewStringUTF(ms_factory_get_decoder(linphone_core_get_ms_factory(lc), jpayload->mime_type)->text); + return jdecodername; +} + /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { PayloadType* pt = (PayloadType*)ptr; diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index 1eb87893f..30c3f583d 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -134,6 +134,11 @@ LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_get_all(void); **/ LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc); +/** + * Return if given plan is generic +**/ +LINPHONE_PUBLIC const bool_t linphone_dial_plan_is_generic(const LinphoneDialPlan *ccc); + #ifdef __cplusplus } #endif diff --git a/java/common/org/linphone/core/LinphoneAccountCreator.java b/java/common/org/linphone/core/LinphoneAccountCreator.java index 9bf198658..6eeab11fa 100644 --- a/java/common/org/linphone/core/LinphoneAccountCreator.java +++ b/java/common/org/linphone/core/LinphoneAccountCreator.java @@ -62,6 +62,7 @@ public interface LinphoneAccountCreator { public final static Status RouteInvalid = new Status(21, "RouteInvalid"); public final static Status DisplayNameInvalid = new Status(22, "DisplayNameInvalid"); public final static Status TransportNotSupported = new Status(23, "TransportNotSupported"); + public final static Status CountryCodeInvalid = new Status(24, "CountryCodeInvalid"); private Status(int value, String stringValue) { mValue = value; diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java index 20d40185d..4f56f9ec3 100644 --- a/java/common/org/linphone/core/LinphoneCallStats.java +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -177,4 +177,18 @@ public interface LinphoneCallStats { * @return The local late rate percentage. **/ public float getLocalLateRate(); + + /** + * Get the encoder name of specified payload + * @param pl payload + * @return The name of encoder + */ + public String getEncoderName(PayloadType pl); + + /** + * Get the decoder name of specified payload + * @param pl payload + * @return The name of decoder + */ + public String getDecoderName(PayloadType pl); } diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index 80ca5f82c..7b33532d2 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -181,4 +181,9 @@ abstract public class LinphoneCoreFactory { * Create TunnelConfig object, used to configure voip anti blocking extension. */ abstract public TunnelConfig createTunnelConfig(); + + /** + * Create LinphoneAccountCreator object + */ + abstract public LinphoneAccountCreator createAccountCreator(LinphoneCore lc, String url); } diff --git a/java/impl/org/linphone/core/LinphoneCallStatsImpl.java b/java/impl/org/linphone/core/LinphoneCallStatsImpl.java index 3897c03f6..3c68bffd7 100644 --- a/java/impl/org/linphone/core/LinphoneCallStatsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallStatsImpl.java @@ -34,6 +34,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { private float localLossRate; private float localLateRate; private long nativePtr; + private long nativeCPtr; private native int getMediaType(long nativeStatsPtr); private native int getIceState(long nativeStatsPtr); @@ -48,10 +49,13 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { private native float getJitterBufferSize(long nativeStatsPtr); private native float getLocalLossRate(long nativeStatsPtr); private native float getLocalLateRate(long nativeStatsPtr); + private native String getEncoderName(long nativeStatsPtr, long nativeCallPtr, long payloadPtr); + private native String getDecoderName(long nativeStatsPtr, long nativeCallPtr, long payloadPtr); private native void updateStats(long nativeCallPtr, int mediaType); protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) { - nativePtr=nativeStatsPtr; + nativePtr = nativeStatsPtr; + nativeCPtr = nativeCallPtr; mediaType = getMediaType(nativeStatsPtr); iceState = getIceState(nativeStatsPtr); downloadBandwidth = getDownloadBandwidth(nativeStatsPtr); @@ -123,4 +127,16 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { public float getLocalLateRate(){ return localLateRate; } + + public String getEncoderName(PayloadType pl) { + if (pl == null) + return ""; + return getEncoderName(nativePtr, nativeCPtr, ((PayloadTypeImpl)pl).nativePtr); + } + + public String getDecoderName(PayloadType pl) { + if (pl == null) + return ""; + return getDecoderName(nativePtr, nativeCPtr, ((PayloadTypeImpl)pl).nativePtr); + } } diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index 11cb0d87e..3e6a07e22 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -239,4 +239,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public TunnelConfig createTunnelConfig() { return (TunnelConfig)_createTunnelConfig(); } + + @Override + public LinphoneAccountCreator createAccountCreator(LinphoneCore lc, String url) { + return new LinphoneAccountCreatorImpl(lc, url); + } }