fixed hold/unhold native functions

This commit is contained in:
Juha Heinanen
2018-05-25 17:28:05 +03:00
parent 8dcc17033d
commit e0422ee722
+7 -3
View File
@@ -746,8 +746,10 @@ JNIEXPORT jint JNICALL
Java_com_tutpro_baresip_MainActivity_call_1hold(JNIEnv *env, jobject thiz, Java_com_tutpro_baresip_MainActivity_call_1hold(JNIEnv *env, jobject thiz,
jstring javaCall) { jstring javaCall) {
const char *native_call = (*env)->GetStringUTFChars(env, javaCall, 0); const char *native_call = (*env)->GetStringUTFChars(env, javaCall, 0);
struct call *call = (struct call *) strtoul(native_call, NULL, 10);
LOGD("holding call %s\n", native_call); LOGD("holding call %s\n", native_call);
int res = call_hold(ua_call(uag_current()), true); int res = call_hold(call, true);
(*env)->ReleaseStringUTFChars(env, javaCall, native_call); (*env)->ReleaseStringUTFChars(env, javaCall, native_call);
return res; return res;
} }
@@ -756,8 +758,10 @@ JNIEXPORT jint JNICALL
Java_com_tutpro_baresip_MainActivity_call_1unhold(JNIEnv *env, jobject thiz, Java_com_tutpro_baresip_MainActivity_call_1unhold(JNIEnv *env, jobject thiz,
jstring javaCall) { jstring javaCall) {
const char *native_call = (*env)->GetStringUTFChars(env, javaCall, 0); const char *native_call = (*env)->GetStringUTFChars(env, javaCall, 0);
LOGD("holding call %s\n", native_call); struct call *call = (struct call *) strtoul(native_call, NULL, 10);
int res = call_hold(ua_call(uag_current()), false);
LOGD("unholding call %s\n", native_call);
int res = call_hold(call, false);
(*env)->ReleaseStringUTFChars(env, javaCall, native_call); (*env)->ReleaseStringUTFChars(env, javaCall, native_call);
return res; return res;
} }