Wrapper JNI for more LinphoneReason + linphone_core_set_call_error_tone

This commit is contained in:
Sylvain Berfini 2014-03-06 10:52:37 +01:00
parent 1b7a1d9438
commit aad2df16d1
4 changed files with 51 additions and 2 deletions

View file

@ -1334,6 +1334,15 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
return NULL;
}
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallErrorTone(JNIEnv* env
,jobject thiz
,jlong lc
,jint reason
,jstring jpath) {
const char* path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
linphone_core_set_call_error_tone((LinphoneCore *)lc, (LinphoneReason)reason, path);
if (path) env->ReleaseStringUTFChars(jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRootCA(JNIEnv* env
,jobject thiz
,jlong lc

View file

@ -1520,8 +1520,15 @@ public interface LinphoneCore {
public boolean acceptEarlyMediaWithParams(LinphoneCall call, LinphoneCallParams params);
/**
*
* @return
* Creates a proxy config using the default values if they exists
* @return a default proxy config
*/
public LinphoneProxyConfig createProxyConfig();
/**
* Assign an audio file to played locally upon call failure, for a given reason.
* @param reason the #LinphoneReason representing the failure error code.
* @param path a wav file to be played when such call failure happens.
*/
public void setCallErrorTone(Reason reason, String path);
}

View file

@ -56,6 +56,34 @@ public class Reason {
* Operation was rejected by remote due to request unmatched to any context.
*/
static public Reason NoMatch = new Reason(12,"NoMatch");
/**
* Resource moved permanently
*/
static public Reason MovedPermanently = new Reason(13,"MovedPermanently");
/**
* Resource no longer exists
*/
static public Reason Gone = new Reason(14,"Gone");
/**
* Temporarily unavailable
*/
static public Reason TemporarilyUnavailable = new Reason(15,"TemporarilyUnavailable");
/**
* Address incomplete
*/
static public Reason AddressIncomplete = new Reason(16,"AddressIncomplete");
/**
* Not implemented
*/
static public Reason NotImplemented = new Reason(17,"NotImplemented");
/**
* Bad gateway
*/
static public Reason BadGateway = new Reason(18,"BadGateway");
/**
* Server timeout
*/
static public Reason ServerTimeout = new Reason(19,"ServerTimeout");
protected final int mValue;
private final String mStringValue;

View file

@ -146,6 +146,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native long[] getChatRooms(long nativePtr);
private native int migrateToMultiTransport(long nativePtr);
private native long createProxyConfig(long nativePtr);
private native void setCallErrorTone(long nativePtr, int reason, String path);
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig, File factoryConfig, Object userdata) throws IOException {
mListener = listener;
@ -1134,4 +1135,8 @@ class LinphoneCoreImpl implements LinphoneCore {
public LinphoneProxyConfig createProxyConfig() {
return new LinphoneProxyConfigImpl(createProxyConfig(nativePtr));
}
@Override
public void setCallErrorTone(Reason reason, String path) {
setCallErrorTone(nativePtr, reason.mValue, path);
}
}