Avoid unused argumument warnings

This commit is contained in:
Juha Heinanen
2024-05-04 13:21:26 +03:00
parent c839d99b17
commit fb730b92ea
+214 -85
View File
@@ -369,6 +369,7 @@ static struct mqueue *mq;
static void mqueue_handler(int id, void *data, void *arg) static void mqueue_handler(int id, void *data, void *arg)
{ {
(void)arg;
if (id == ID_UA_STOP_ALL) { if (id == ID_UA_STOP_ALL) {
LOGD("calling ua_stop_all with force %u\n", (unsigned)(uintptr_t)data); LOGD("calling ua_stop_all with force %u\n", (unsigned)(uintptr_t)data);
ua_stop_all((bool)(uintptr_t)data); ua_stop_all((bool)(uintptr_t)data);
@@ -382,6 +383,7 @@ static pthread_t loggingThread;
static void *loggingFunction(void *arg) static void *loggingFunction(void *arg)
{ {
(void)arg;
ssize_t readSize; ssize_t readSize;
char buf[128]; char buf[128];
@@ -416,6 +418,8 @@ static int runLoggingThread()
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
{ {
(void)reserved;
LOGD("at JNI_OnLoad\n"); LOGD("at JNI_OnLoad\n");
memset(&g_ctx, 0, sizeof(g_ctx)); memset(&g_ctx, 0, sizeof(g_ctx));
@@ -598,15 +602,18 @@ out:
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_BaresipService_baresipStop( JNIEXPORT void JNICALL Java_com_tutpro_baresip_BaresipService_baresipStop(
JNIEnv *env, jobject thiz, jboolean force) JNIEnv *env, jobject obj, jboolean force)
{ {
(void)env;
(void)obj;
LOGD("ua_stop_all upon baresipStop"); LOGD("ua_stop_all upon baresipStop");
mqueue_push(mq, ID_UA_STOP_ALL, (void *)((long)force)); mqueue_push(mq, ID_UA_STOP_ALL, (void *)((long)force));
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1display_1name( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1display_1name(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *dn = account_display_name((struct account *)acc); const char *dn = account_display_name((struct account *)acc);
if (dn) if (dn)
@@ -618,8 +625,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1display_1name(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1display_1name( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1display_1name(
JNIEnv *env, jobject thiz, jlong acc, jstring jDn) JNIEnv *env, jobject obj, jlong acc, jstring jDn)
{ {
(void)obj;
const char *dn = (*env)->GetStringUTFChars(env, jDn, 0); const char *dn = (*env)->GetStringUTFChars(env, jDn, 0);
int res; int res;
if (strlen(dn) > 0) if (strlen(dn) > 0)
@@ -631,8 +639,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1display_1name(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1aor( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1aor(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) if (acc)
return (*env)->NewStringUTF(env, account_aor((struct account *)acc)); return (*env)->NewStringUTF(env, account_aor((struct account *)acc));
else else
@@ -640,8 +649,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1aor(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1luri( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1luri(
JNIEnv *env, jclass clazz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
const struct uri *uri = account_luri((struct account *)acc); const struct uri *uri = account_luri((struct account *)acc);
char uri_buf[512]; char uri_buf[512];
int l; int l;
@@ -654,8 +664,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1luri(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1user( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1user(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *au = account_auth_user((struct account *)acc); const char *au = account_auth_user((struct account *)acc);
if (au) if (au)
@@ -667,8 +678,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1user(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1user( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1user(
JNIEnv *env, jobject thiz, jlong acc, jstring jUser) JNIEnv *env, jobject obj, jlong acc, jstring jUser)
{ {
(void)obj;
const char *user = (*env)->GetStringUTFChars(env, jUser, 0); const char *user = (*env)->GetStringUTFChars(env, jUser, 0);
int res; int res;
if (strlen(user) > 0) if (strlen(user) > 0)
@@ -680,8 +692,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1user(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1pass( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1pass(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *ap = account_auth_pass((struct account *)acc); const char *ap = account_auth_pass((struct account *)acc);
if (ap) if (ap)
@@ -693,8 +706,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1auth_1pass(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1pass( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1pass(
JNIEnv *env, jobject thiz, jlong acc, jstring jPass) JNIEnv *env, jobject obj, jlong acc, jstring jPass)
{ {
(void)obj;
const char *pass = (*env)->GetStringUTFChars(env, jPass, 0); const char *pass = (*env)->GetStringUTFChars(env, jPass, 0);
int res; int res;
if (strlen(pass) > 0) if (strlen(pass) > 0)
@@ -706,8 +720,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1auth_1pass(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1outbound( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1outbound(
JNIEnv *env, jobject thiz, jlong acc, jint jIx) JNIEnv *env, jobject obj, jlong acc, jint jIx)
{ {
(void)obj;
const uint16_t native_ix = jIx; const uint16_t native_ix = jIx;
const char *outbound; const char *outbound;
if (acc) { if (acc) {
@@ -722,8 +737,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1outbound(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1outbound( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1outbound(
JNIEnv *env, jobject thiz, jlong acc, jstring jOb, jint jIx) JNIEnv *env, jobject obj, jlong acc, jstring jOb, jint jIx)
{ {
(void)obj;
const char *ob = (*env)->GetStringUTFChars(env, jOb, 0); const char *ob = (*env)->GetStringUTFChars(env, jOb, 0);
const uint16_t ix = jIx; const uint16_t ix = jIx;
int res; int res;
@@ -736,8 +752,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1outbound(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1audio_1codec( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1audio_1codec(
JNIEnv *env, jobject thiz, jlong acc, jint ix) JNIEnv *env, jobject obj, jlong acc, jint ix)
{ {
(void)obj;
const struct list *codecl; const struct list *codecl;
char codec_buf[32]; char codec_buf[32];
int len; int len;
@@ -766,8 +783,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1audio_1codec(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1audio_1codecs( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1audio_1codecs(
JNIEnv *env, jobject thiz, jlong acc, jstring jCodecs) JNIEnv *env, jobject obj, jlong acc, jstring jCodecs)
{ {
(void)obj;
const char *codecs = (*env)->GetStringUTFChars(env, jCodecs, 0); const char *codecs = (*env)->GetStringUTFChars(env, jCodecs, 0);
int res = account_set_audio_codecs((struct account *)acc, codecs); int res = account_set_audio_codecs((struct account *)acc, codecs);
(*env)->ReleaseStringUTFChars(env, jCodecs, codecs); (*env)->ReleaseStringUTFChars(env, jCodecs, codecs);
@@ -775,8 +793,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1audio_1codecs(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1video_1codecs( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1video_1codecs(
JNIEnv *env, jobject thiz, jlong acc, jstring jCodecs) JNIEnv *env, jobject obj, jlong acc, jstring jCodecs)
{ {
(void)obj;
const char *codecs = (*env)->GetStringUTFChars(env, jCodecs, 0); const char *codecs = (*env)->GetStringUTFChars(env, jCodecs, 0);
int res = account_set_video_codecs((struct account *)acc, codecs); int res = account_set_video_codecs((struct account *)acc, codecs);
(*env)->ReleaseStringUTFChars(env, jCodecs, codecs); (*env)->ReleaseStringUTFChars(env, jCodecs, codecs);
@@ -784,8 +803,10 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1video_1codecs(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1regint( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1regint(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
if (acc) if (acc)
return (jint)account_regint((struct account *)acc); return (jint)account_regint((struct account *)acc);
else else
@@ -793,15 +814,18 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1regint(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1regint( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1regint(
JNIEnv *env, jobject thiz, jlong acc, jint jRegint) JNIEnv *env, jobject obj, jlong acc, jint jRegint)
{ {
(void)env;
(void)obj;
const uint32_t regint = (uint32_t)jRegint; const uint32_t regint = (uint32_t)jRegint;
return account_set_regint((struct account *)acc, regint); return account_set_regint((struct account *)acc, regint);
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1mediaenc( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1mediaenc(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *mediaenc = account_mediaenc((struct account *)acc); const char *mediaenc = account_mediaenc((struct account *)acc);
if (mediaenc) if (mediaenc)
@@ -811,8 +835,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1mediaenc(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1mediaenc( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1mediaenc(
JNIEnv *env, jobject thiz, jlong acc, jstring jMencid) JNIEnv *env, jobject obj, jlong acc, jstring jMencid)
{ {
(void)obj;
const char *mencid = (*env)->GetStringUTFChars(env, jMencid, 0); const char *mencid = (*env)->GetStringUTFChars(env, jMencid, 0);
int res; int res;
if (strlen(mencid) > 0) if (strlen(mencid) > 0)
@@ -824,8 +849,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1mediaenc(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1medianat( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1medianat(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *medianat = account_medianat((struct account *)acc); const char *medianat = account_medianat((struct account *)acc);
if (medianat) if (medianat)
@@ -835,8 +861,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1medianat(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1medianat( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1medianat(
JNIEnv *env, jobject thiz, jlong acc, jstring jMedNat) JNIEnv *env, jobject obj, jlong acc, jstring jMedNat)
{ {
(void)obj;
const char *mednat = (*env)->GetStringUTFChars(env, jMedNat, 0); const char *mednat = (*env)->GetStringUTFChars(env, jMedNat, 0);
int res; int res;
if (strlen(mednat) > 0) if (strlen(mednat) > 0)
@@ -848,8 +875,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1medianat(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1sipnat( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1sipnat(
JNIEnv *env, jobject thiz, jlong acc, jstring jSipNat) JNIEnv *env, jobject obj, jlong acc, jstring jSipNat)
{ {
(void)obj;
const char *sipnat = (*env)->GetStringUTFChars(env, jSipNat, 0); const char *sipnat = (*env)->GetStringUTFChars(env, jSipNat, 0);
int res; int res;
if (strlen(sipnat) > 0) if (strlen(sipnat) > 0)
@@ -861,8 +889,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1sipnat(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1uri( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1uri(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const struct stun_uri *stun_uri = account_stun_uri((struct account *)acc); const struct stun_uri *stun_uri = account_stun_uri((struct account *)acc);
if (stun_uri) { if (stun_uri) {
@@ -889,8 +918,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1uri(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1uri( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1uri(
JNIEnv *env, jobject thiz, jlong acc, jstring jUri) JNIEnv *env, jobject obj, jlong acc, jstring jUri)
{ {
(void)obj;
const char *uri = (*env)->GetStringUTFChars(env, jUri, 0); const char *uri = (*env)->GetStringUTFChars(env, jUri, 0);
int res; int res;
if (strlen(uri) > 0) if (strlen(uri) > 0)
@@ -902,8 +932,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1uri(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1user( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1user(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *stun_user = account_stun_user((struct account *)acc); const char *stun_user = account_stun_user((struct account *)acc);
if (stun_user) if (stun_user)
@@ -913,8 +944,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1user(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1user( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1user(
JNIEnv *env, jobject thiz, jlong acc, jstring jUser) JNIEnv *env, jobject obj, jlong acc, jstring jUser)
{ {
(void)obj;
const char *user = (*env)->GetStringUTFChars(env, jUser, 0); const char *user = (*env)->GetStringUTFChars(env, jUser, 0);
int res; int res;
if (strlen(user) > 0) if (strlen(user) > 0)
@@ -926,8 +958,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1user(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1pass( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1pass(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *stun_pass = account_stun_pass((struct account *)acc); const char *stun_pass = account_stun_pass((struct account *)acc);
if (stun_pass) if (stun_pass)
@@ -937,8 +970,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1stun_1pass(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1pass( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1pass(
JNIEnv *env, jobject thiz, jlong acc, jstring jPass) JNIEnv *env, jobject obj, jlong acc, jstring jPass)
{ {
(void)obj;
const char *pass = (*env)->GetStringUTFChars(env, jPass, 0); const char *pass = (*env)->GetStringUTFChars(env, jPass, 0);
int res; int res;
if (strlen(pass) > 0) if (strlen(pass) > 0)
@@ -950,14 +984,17 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1stun_1pass(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1mwi( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1mwi(
JNIEnv *env, jobject thiz, jlong acc, jboolean value) JNIEnv *env, jobject obj, jlong acc, jboolean value)
{ {
(void)env;
(void)obj;
return account_set_mwi((struct account *)acc, value); return account_set_mwi((struct account *)acc, value);
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1vm_1uri( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1vm_1uri(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
char uri_buf[256]; char uri_buf[256];
if (acc) { if (acc) {
struct pl pl; struct pl pl;
@@ -974,71 +1011,92 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1vm_1uri(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1answermode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1answermode(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
return account_answermode((struct account *)acc); return account_answermode((struct account *)acc);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1answermode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1answermode(
JNIEnv *env, jobject thiz, jlong acc, jint jMode) JNIEnv *env, jobject obj, jlong acc, jint jMode)
{ {
(void)env;
(void)obj;
const uint32_t mode = (uint32_t)jMode; const uint32_t mode = (uint32_t)jMode;
return account_set_answermode((struct account *)acc, mode); return account_set_answermode((struct account *)acc, mode);
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_account_1sip_1autoredirect( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_account_1sip_1autoredirect(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
return account_sip_autoredirect((struct account *)acc); return account_sip_autoredirect((struct account *)acc);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_account_1set_1sip_1autoredirect( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_account_1set_1sip_1autoredirect(
JNIEnv *env, jobject thiz, jlong acc, jboolean allow) JNIEnv *env, jobject obj, jlong acc, jboolean allow)
{ {
(void)env;
(void)obj;
return account_set_sip_autoredirect((struct account *)acc, allow); return account_set_sip_autoredirect((struct account *)acc, allow);
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_account_1rtcp_1mux( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_account_1rtcp_1mux(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
return account_rtcp_mux((struct account *)acc); return account_rtcp_mux((struct account *)acc);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rtcp_1mux( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rtcp_1mux(
JNIEnv *env, jobject thiz, jlong acc, jboolean value) JNIEnv *env, jobject obj, jlong acc, jboolean value)
{ {
(void)env;
(void)obj;
return account_set_rtcp_mux((struct account *)acc, value); return account_set_rtcp_mux((struct account *)acc, value);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1rel100_1mode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1rel100_1mode(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
return account_rel100_mode((struct account *)acc); return account_rel100_mode((struct account *)acc);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rel100_1mode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rel100_1mode(
JNIEnv *env, jobject thiz, jlong acc, jint jMode) JNIEnv *env, jobject obj, jlong acc, jint jMode)
{ {
(void)env;
(void)obj;
const uint32_t mode = (uint32_t)jMode; const uint32_t mode = (uint32_t)jMode;
return account_set_rel100_mode((struct account *)acc, mode); return account_set_rel100_mode((struct account *)acc, mode);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1dtmfmode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1dtmfmode(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
return account_dtmfmode((struct account *)acc); return account_dtmfmode((struct account *)acc);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1dtmfmode( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1dtmfmode(
JNIEnv *env, jobject thiz, jlong acc, jint jMode) JNIEnv *env, jobject obj, jlong acc, jint jMode)
{ {
(void)env;
(void)obj;
const uint32_t mode = (uint32_t)jMode; const uint32_t mode = (uint32_t)jMode;
return account_set_dtmfmode((struct account *)acc, mode); return account_set_dtmfmode((struct account *)acc, mode);
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1extra( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1extra(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)obj;
if (acc) { if (acc) {
const char *extra = account_extra((struct account *)acc); const char *extra = account_extra((struct account *)acc);
if (extra) if (extra)
@@ -1048,14 +1106,17 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_account_1extra(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_account_1debug( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_account_1debug(
JNIEnv *env, jobject thiz, jlong acc) JNIEnv *env, jobject obj, jlong acc)
{ {
(void)env;
(void)obj;
account_debug_log((struct account *)acc); account_debug_log((struct account *)acc);
} }
JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1alloc( JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1alloc(
JNIEnv *env, jobject thiz, jstring jUri) JNIEnv *env, jobject obj, jstring jUri)
{ {
(void)obj;
const char *uri = (*env)->GetStringUTFChars(env, jUri, 0); const char *uri = (*env)->GetStringUTFChars(env, jUri, 0);
struct ua *ua; struct ua *ua;
LOGD("allocating UA '%s'\n", uri); LOGD("allocating UA '%s'\n", uri);
@@ -1071,8 +1132,10 @@ JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1alloc(
return (jlong)ua; return (jlong)ua;
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_ua_1register(JNIEnv *env, jobject thiz, jlong ua) JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_ua_1register(JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
LOGD("registering UA '%ld'\n", (long)ua); LOGD("registering UA '%ld'\n", (long)ua);
re_thread_enter(); re_thread_enter();
int res = ua_register((struct ua *)ua); int res = ua_register((struct ua *)ua);
@@ -1081,29 +1144,37 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_ua_1register(JNIEnv *env, job
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1unregister( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1unregister(
JNIEnv *env, jobject thiz, jlong ua) JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
re_thread_enter(); re_thread_enter();
ua_unregister((struct ua *)ua); ua_unregister((struct ua *)ua);
re_thread_leave(); re_thread_leave();
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_ua_1isregistered( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_ua_1isregistered(
JNIEnv *env, jobject thiz, jlong ua) JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
return ua_isregistered((struct ua *)ua) ? true : false; return ua_isregistered((struct ua *)ua) ? true : false;
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1destroy(JNIEnv *env, jobject thiz, jlong ua) JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1destroy(JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
LOGD("destroying ua %ld\n", (long)ua); LOGD("destroying ua %ld\n", (long)ua);
re_thread_enter(); re_thread_enter();
(void)ua_destroy((struct ua *)ua); (void)ua_destroy((struct ua *)ua);
re_thread_leave(); re_thread_leave();
} }
JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1account(JNIEnv *env, jobject thiz, jlong ua) JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1account(JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
struct account *acc = 0; struct account *acc = 0;
if (ua) if (ua)
acc = ua_account((struct ua *)ua); acc = ua_account((struct ua *)ua);
@@ -1111,15 +1182,18 @@ JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1account(JNIEnv *env, job
} }
JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1update_1account( JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1update_1account(
JNIEnv *env, jobject thiz, jlong ua) JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
LOGD("updating account of ua %ld\n", (long)ua); LOGD("updating account of ua %ld\n", (long)ua);
return ua_update_account((struct ua *)ua); return ua_update_account((struct ua *)ua);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1hangup( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1hangup(
JNIEnv *env, jobject thiz, jlong ua, jlong call, jint code, jstring reason) JNIEnv *env, jobject obj, jlong ua, jlong call, jint code, jstring reason)
{ {
(void)obj;
const uint16_t native_code = code; const uint16_t native_code = code;
const char *native_reason = (*env)->GetStringUTFChars(env, reason, 0); const char *native_reason = (*env)->GetStringUTFChars(env, reason, 0);
LOGD("hanging up call %ld/%ld\n", (long)ua, (long)call); LOGD("hanging up call %ld/%ld\n", (long)ua, (long)call);
@@ -1133,8 +1207,10 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1hangup(
} }
JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1call_1alloc( JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1call_1alloc(
JNIEnv *env, jobject thiz, jlong ua, jlong xCall, jint vidMode) JNIEnv *env, jobject obj, jlong ua, jlong xCall, jint vidMode)
{ {
(void)env;
(void)obj;
struct call *call = NULL; struct call *call = NULL;
int err; int err;
LOGD("allocating new call for ua %ld xcall %ld\n", (long)ua, (long)xCall); LOGD("allocating new call for ua %ld xcall %ld\n", (long)ua, (long)xCall);
@@ -1148,8 +1224,10 @@ JNIEXPORT jlong JNICALL Java_com_tutpro_baresip_Api_ua_1call_1alloc(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1answer( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1answer(
JNIEnv *env, jobject thiz, jlong ua, jlong call, jint vidMode) JNIEnv *env, jobject obj, jlong ua, jlong call, jint vidMode)
{ {
(void)env;
(void)obj;
LOGD("answering ua/call %ld/%ld with video mode %d\n", (long)ua, (long)call, vidMode); LOGD("answering ua/call %ld/%ld with video mode %d\n", (long)ua, (long)call, vidMode);
re_thread_enter(); re_thread_enter();
ua_answer((struct ua *)ua, (struct call *)call, (enum vidmode)vidMode); ua_answer((struct ua *)ua, (struct call *)call, (enum vidmode)vidMode);
@@ -1157,8 +1235,9 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1answer(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1add_1custom_1header( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1add_1custom_1header(
JNIEnv *env, jobject thiz, jlong ua, jstring jname, jstring jbody) JNIEnv *env, jobject obj, jlong ua, jstring jname, jstring jbody)
{ {
(void)obj;
const char *name = (*env)->GetStringUTFChars(env, jname, 0); const char *name = (*env)->GetStringUTFChars(env, jname, 0);
const char *body = (*env)->GetStringUTFChars(env, jbody, 0); const char *body = (*env)->GetStringUTFChars(env, jbody, 0);
LOGD("adding header to %ld with name/body %s/%s\n", (long)ua, name, body); LOGD("adding header to %ld with name/body %s/%s\n", (long)ua, name, body);
@@ -1174,14 +1253,18 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1add_1custom_1header(
(*env)->ReleaseStringUTFChars(env, jbody, body); (*env)->ReleaseStringUTFChars(env, jbody, body);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1debug(JNIEnv *env, jobject thiz, jlong ua) JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_ua_1debug(JNIEnv *env, jobject obj, jlong ua)
{ {
(void)env;
(void)obj;
ua_debug_log((struct ua *)ua); ua_debug_log((struct ua *)ua);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_calls_1mute( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_calls_1mute(
JNIEnv *env, jobject thiz, jboolean mute) JNIEnv *env, jobject obj, jboolean mute)
{ {
(void)env;
(void)obj;
struct le *ua_le; struct le *ua_le;
struct le *call_le; struct le *call_le;
LOGD("muting calls %d\n", mute); LOGD("muting calls %d\n", mute);
@@ -1197,8 +1280,9 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_calls_1mute(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1connect( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1connect(
JNIEnv *env, jobject thiz, jlong call, jstring jPeer) JNIEnv *env, jobject obj, jlong call, jstring jPeer)
{ {
(void)obj;
const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0); const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0);
LOGD("connecting call %ld to %s\n", (long)call, native_peer); LOGD("connecting call %ld to %s\n", (long)call, native_peer);
re_thread_enter(); re_thread_enter();
@@ -1213,8 +1297,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1connect(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1notify_1sipfrag( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1notify_1sipfrag(
JNIEnv *env, jobject thiz, jlong call, jint code, jstring reason) JNIEnv *env, jobject obj, jlong call, jint code, jstring reason)
{ {
(void)obj;
const uint16_t native_code = code; const uint16_t native_code = code;
const char *native_reason = (*env)->GetStringUTFChars(env, reason, 0); const char *native_reason = (*env)->GetStringUTFChars(env, reason, 0);
LOGD("notifying call %ld/%s\n", (long)call, native_reason); LOGD("notifying call %ld/%s\n", (long)call, native_reason);
@@ -1225,8 +1310,10 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1notify_1sipfrag(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1start_1audio( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1start_1audio(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
LOGD("starting audio of call %ld\n", (long)call); LOGD("starting audio of call %ld\n", (long)call);
re_thread_enter(); re_thread_enter();
struct audio *a = call_audio((struct call *)call); struct audio *a = call_audio((struct call *)call);
@@ -1236,8 +1323,10 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1start_1audio(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1hold( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1hold(
JNIEnv *env, jobject thiz, jlong call, jboolean hold) JNIEnv *env, jobject obj, jlong call, jboolean hold)
{ {
(void)env;
(void)obj;
int err; int err;
if (hold) { if (hold) {
LOGD("holding call %ld\n", (long)call); LOGD("holding call %ld\n", (long)call);
@@ -1256,14 +1345,17 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1hold(
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1ismuted( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1ismuted(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
return audio_ismuted(call_audio((struct call *)call)); return audio_ismuted(call_audio((struct call *)call));
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1transfer( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1transfer(
JNIEnv *env, jobject thiz, jlong call, jstring jPeer) JNIEnv *env, jobject obj, jlong call, jstring jPeer)
{ {
(void)obj;
const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0); const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0);
LOGD("transfering call %ld to %s\n", (long)call, native_peer); LOGD("transfering call %ld to %s\n", (long)call, native_peer);
re_thread_enter(); re_thread_enter();
@@ -1276,8 +1368,10 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1transfer(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1send_1digit( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1send_1digit(
JNIEnv *env, jobject thiz, jlong call, jchar digit) JNIEnv *env, jobject obj, jlong call, jchar digit)
{ {
(void)env;
(void)obj;
const uint16_t native_digit = digit; const uint16_t native_digit = digit;
LOGD("sending DTMF digit '%c' to call %ld\n", (char)native_digit, (long)call); LOGD("sending DTMF digit '%c' to call %ld\n", (char)native_digit, (long)call);
re_thread_enter(); re_thread_enter();
@@ -1289,8 +1383,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1send_1digit(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1audio_1codecs( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1audio_1codecs(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)obj;
const struct aucodec *tx = audio_codec(call_audio((struct call *)call), true); const struct aucodec *tx = audio_codec(call_audio((struct call *)call), true);
const struct aucodec *rx = audio_codec(call_audio((struct call *)call), false); const struct aucodec *rx = audio_codec(call_audio((struct call *)call), false);
char codec_buf[256]; char codec_buf[256];
@@ -1308,14 +1403,17 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1audio_1codecs(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1duration( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1duration(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
return (jint)call_duration((struct call *)call); return (jint)call_duration((struct call *)call);
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1stats( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1stats(
JNIEnv *env, jobject thiz, jlong call, jstring jStream) JNIEnv *env, jobject obj, jlong call, jstring jStream)
{ {
(void)obj;
const char *native_stream = (*env)->GetStringUTFChars(env, jStream, 0); const char *native_stream = (*env)->GetStringUTFChars(env, jStream, 0);
const struct stream *s; const struct stream *s;
if (strcmp(native_stream, "audio") == 0) if (strcmp(native_stream, "audio") == 0)
@@ -1344,20 +1442,26 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1stats(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1state( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_call_1state(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
return call_state((struct call *)call); return call_state((struct call *)call);
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1replaces( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1replaces(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
return call_supported((struct call *)call, REPLACES) ? true : false; return call_supported((struct call *)call, REPLACES) ? true : false;
} }
JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1replace_1transfer( JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1replace_1transfer(
JNIEnv *env, jobject thiz, jlong xferCall, jlong call) JNIEnv *env, jobject obj, jlong xferCall, jlong call)
{ {
(void)env;
(void)obj;
re_thread_enter(); re_thread_enter();
int res = call_replace_transfer((struct call *)xferCall, (struct call *)call); int res = call_replace_transfer((struct call *)xferCall, (struct call *)call);
re_thread_leave(); re_thread_leave();
@@ -1365,8 +1469,9 @@ JNIEXPORT jboolean JNICALL Java_com_tutpro_baresip_Api_call_1replace_1transfer(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1peer_1uri( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1peer_1uri(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)obj;
const char *uri = call_peeruri((struct call *)call); const char *uri = call_peeruri((struct call *)call);
if (uri) if (uri)
return (*env)->NewStringUTF(env, uri); return (*env)->NewStringUTF(env, uri);
@@ -1374,8 +1479,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1peer_1uri(
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1diverter_1uri( JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1diverter_1uri(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)obj;
const char *uri = call_diverteruri((struct call *)call); const char *uri = call_diverteruri((struct call *)call);
if (uri) if (uri)
return (*env)->NewStringUTF(env, uri); return (*env)->NewStringUTF(env, uri);
@@ -1383,8 +1489,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_call_1diverter_1uri(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_message_1send( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_message_1send(
JNIEnv *env, jobject thiz, jlong ua, jstring jPeer, jstring jMsg, jstring jTime) JNIEnv *env, jobject obj, jlong ua, jstring jPeer, jstring jMsg, jstring jTime)
{ {
(void)obj;
const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0); const char *native_peer = (*env)->GetStringUTFChars(env, jPeer, 0);
const char *native_msg = (*env)->GetStringUTFChars(env, jMsg, 0); const char *native_msg = (*env)->GetStringUTFChars(env, jMsg, 0);
const char *native_time = (*env)->GetStringUTFChars(env, jTime, 0); const char *native_time = (*env)->GetStringUTFChars(env, jTime, 0);
@@ -1402,16 +1509,19 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_message_1send(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1destroy( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_call_1destroy(
JNIEnv *env, jobject thiz, jlong call) JNIEnv *env, jobject obj, jlong call)
{ {
(void)env;
(void)obj;
re_thread_enter(); re_thread_enter();
mem_deref((struct call *)call); mem_deref((struct call *)call);
re_thread_leave(); re_thread_leave();
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_cmd_1exec( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_cmd_1exec(
JNIEnv *env, jobject thiz, jstring javaCmd) JNIEnv *env, jobject obj, jstring javaCmd)
{ {
(void)obj;
const char *native_cmd = (*env)->GetStringUTFChars(env, javaCmd, 0); const char *native_cmd = (*env)->GetStringUTFChars(env, javaCmd, 0);
LOGD("processing command '%s'\n", native_cmd); LOGD("processing command '%s'\n", native_cmd);
re_thread_enter(); re_thread_enter();
@@ -1421,8 +1531,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_cmd_1exec(
return res; return res;
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_audio_1codecs(JNIEnv *env, jobject thiz) JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_audio_1codecs(JNIEnv *env, jobject obj)
{ {
(void)obj;
struct list *aucodecl = baresip_aucodecl(); struct list *aucodecl = baresip_aucodecl();
struct le *le; struct le *le;
char codec_buf[256]; char codec_buf[256];
@@ -1447,8 +1558,9 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_audio_1codecs(JNIEnv *env,
return (*env)->NewStringUTF(env, codec_buf); return (*env)->NewStringUTF(env, codec_buf);
} }
JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_video_1codecs(JNIEnv *env, jobject thiz) JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_video_1codecs(JNIEnv *env, jobject obj)
{ {
(void)obj;
struct list *vidcodecl = baresip_vidcodecl(); struct list *vidcodecl = baresip_vidcodecl();
struct le *le; struct le *le;
char codec_buf[256]; char codec_buf[256];
@@ -1474,16 +1586,19 @@ JNIEXPORT jstring JNICALL Java_com_tutpro_baresip_Api_video_1codecs(JNIEnv *env,
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_log_1level_1set( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_log_1level_1set(
JNIEnv *env, jobject thiz, jint level) JNIEnv *env, jobject obj, jint level)
{ {
(void)env;
(void)obj;
const enum log_level native_level = (enum log_level)level; const enum log_level native_level = (enum log_level)level;
LOGD("setting log level to '%u'\n", native_level); LOGD("setting log level to '%u'\n", native_level);
log_level_set(native_level); log_level_set(native_level);
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1use_1nameserver( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1use_1nameserver(
JNIEnv *env, jobject thiz, jstring javaServers) JNIEnv *env, jobject obj, jstring javaServers)
{ {
(void)obj;
const char *native_servers = (*env)->GetStringUTFChars(env, javaServers, 0); const char *native_servers = (*env)->GetStringUTFChars(env, javaServers, 0);
char servers[256]; char servers[256];
char *server; char *server;
@@ -1523,8 +1638,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1use_1nameserver(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1add_1address_1ifname( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1add_1address_1ifname(
JNIEnv *env, jobject thiz, jstring jAddr, jstring jIfName) JNIEnv *env, jobject obj, jstring jAddr, jstring jIfName)
{ {
(void)obj;
const char *addr = (*env)->GetStringUTFChars(env, jAddr, 0); const char *addr = (*env)->GetStringUTFChars(env, jAddr, 0);
const char *name = (*env)->GetStringUTFChars(env, jIfName, 0); const char *name = (*env)->GetStringUTFChars(env, jIfName, 0);
int res; int res;
@@ -1546,8 +1662,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1add_1address_1ifname(
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1rm_1address( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1rm_1address(
JNIEnv *env, jobject thiz, jstring jIp) JNIEnv *env, jobject obj, jstring jIp)
{ {
(void)obj;
const char *native_ip = (*env)->GetStringUTFChars(env, jIp, 0); const char *native_ip = (*env)->GetStringUTFChars(env, jIp, 0);
int res; int res;
struct sa temp_sa; struct sa temp_sa;
@@ -1571,8 +1688,10 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_net_1rm_1address(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_uag_1reset_1transp( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_uag_1reset_1transp(
JNIEnv *env, jobject thiz, jboolean reg, jboolean reinvite) JNIEnv *env, jobject obj, jboolean reg, jboolean reinvite)
{ {
(void)env;
(void)obj;
LOGD("reseting transports (%d, %d)\n", reg, reinvite); LOGD("reseting transports (%d, %d)\n", reg, reinvite);
re_thread_enter(); re_thread_enter();
(void)uag_reset_transp(reg, reinvite); (void)uag_reset_transp(reg, reinvite);
@@ -1580,37 +1699,46 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_uag_1reset_1transp(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_uag_1enable_1sip_1trace( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_uag_1enable_1sip_1trace(
JNIEnv *env, jobject thiz, jboolean enable) JNIEnv *env, jobject obj, jboolean enable)
{ {
(void)env;
(void)obj;
LOGD("enabling sip trace (%d)\n", enable); LOGD("enabling sip trace (%d)\n", enable);
uag_enable_sip_trace(enable); uag_enable_sip_trace(enable);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_config_1verify_1server_1set( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_config_1verify_1server_1set(
JNIEnv *env, jobject thiz, jboolean verify) JNIEnv *env, jobject obj, jboolean verify)
{ {
(void)env;
(void)obj;
struct config *conf = conf_config(); struct config *conf = conf_config();
LOGD("setting verify_server (%d)\n", verify); LOGD("setting verify_server (%d)\n", verify);
conf->sip.verify_server = verify; conf->sip.verify_server = verify;
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject thiz) JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject obj)
{ {
(void)env;
(void)obj;
re_thread_enter(); re_thread_enter();
net_debug_log(); net_debug_log();
re_thread_leave(); re_thread_leave();
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_net_1dns_1debug(JNIEnv *env, jobject thiz) JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_net_1dns_1debug(JNIEnv *env, jobject obj)
{ {
(void)env;
(void)obj;
re_thread_enter(); re_thread_enter();
net_dns_debug_log(); net_dns_debug_log();
re_thread_leave(); re_thread_leave();
} }
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_module_1load( JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_module_1load(
JNIEnv *env, jobject thiz, jstring javaModule) JNIEnv *env, jobject obj, jstring javaModule)
{ {
(void)obj;
const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0); const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0);
int result = module_load(".", native_module); int result = module_load(".", native_module);
(*env)->ReleaseStringUTFChars(env, javaModule, native_module); (*env)->ReleaseStringUTFChars(env, javaModule, native_module);
@@ -1618,8 +1746,9 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_module_1load(
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_module_1unload( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_module_1unload(
JNIEnv *env, jobject thiz, jstring javaModule) JNIEnv *env, jobject obj, jstring javaModule)
{ {
(void)obj;
const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0); const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0);
module_unload(native_module); module_unload(native_module);
LOGD("unloaded module %s\n", native_module); LOGD("unloaded module %s\n", native_module);