Add new status in accountcreator + add new stats in call

This commit is contained in:
Erwan Croze 2016-09-29 11:21:37 +02:00
parent 4d20d10786
commit 6caf23eb5c
10 changed files with 71 additions and 1 deletions

View file

@ -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) {

View file

@ -63,6 +63,7 @@ typedef enum _LinphoneAccountCreatorStatus {
LinphoneAccountCreatorRouteInvalid,
LinphoneAccountCreatorDisplayNameInvalid,
LinphoneAccountCreatorTransportNotSupported,
LinphoneAccountCreatorCountryCodeInvalid,
} LinphoneAccountCreatorStatus;
/**

View file

@ -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;
}

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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);
}
}