moved more api functions to Api class
This commit is contained in:
@ -930,7 +930,7 @@ Java_com_tutpro_baresip_MainActivity_reload_1config(JNIEnv *env, jobject thiz) {
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_tutpro_baresip_Utils_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaCmd) {
|
||||
Java_com_tutpro_baresip_Api_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaCmd) {
|
||||
const char *native_cmd = (*env)->GetStringUTFChars(env, javaCmd, 0);
|
||||
LOGD("processing command '%s'\n", native_cmd);
|
||||
if (strcmp(native_cmd, "audio_debug") == 0) {
|
||||
@ -942,7 +942,7 @@ Java_com_tutpro_baresip_Utils_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaC
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_tutpro_baresip_Utils_audio_1codecs(JNIEnv *env, jobject thiz)
|
||||
Java_com_tutpro_baresip_Api_audio_1codecs(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
struct list *aucodecl = baresip_aucodecl();
|
||||
struct le *le;
|
||||
@ -969,7 +969,7 @@ Java_com_tutpro_baresip_Utils_audio_1codecs(JNIEnv *env, jobject thiz)
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_tutpro_baresip_Utils_uri_1decode(JNIEnv *env, jobject thiz, jstring javaUri) {
|
||||
Java_com_tutpro_baresip_Api_uri_1decode(JNIEnv *env, jobject thiz, jstring javaUri) {
|
||||
const char *uri = (*env)->GetStringUTFChars(env, javaUri, 0);
|
||||
struct pl pl;
|
||||
struct uri uri2;
|
||||
|
||||
@ -53,7 +53,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
regint = findViewById(R.id.RegInt) as EditText
|
||||
regint.setText(acc.regint.toString())
|
||||
|
||||
val audioCodecs = ArrayList(Utils.audio_codecs().split(","))
|
||||
val audioCodecs = ArrayList(Api.audio_codecs().split(","))
|
||||
newCodecs.addAll(audioCodecs)
|
||||
while (newCodecs.size < audioCodecs.size) newCodecs.add("")
|
||||
|
||||
@ -183,7 +183,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (ob != acc.outbound) {
|
||||
val outbound = ArrayList<String>()
|
||||
for (i in ob.indices) {
|
||||
if ((ob[i] == "") || Utils.uri_decode(ob[i])) {
|
||||
if ((ob[i] == "") || Api.uri_decode(ob[i])) {
|
||||
if (account_set_outbound(acc.accp, ob[i], i) == 0) {
|
||||
if (ob[i] != "")
|
||||
outbound.add(account_outbound(acc.accp, i))
|
||||
|
||||
@ -2,6 +2,9 @@ package com.tutpro.baresip
|
||||
|
||||
object Api {
|
||||
|
||||
external fun audio_codecs(): String
|
||||
external fun call_peeruri(callp: String): String
|
||||
external fun cmd_exec(cmd: String): Int
|
||||
external fun uri_decode(uri: String): Boolean
|
||||
|
||||
}
|
||||
@ -195,7 +195,7 @@ class MainActivity : AppCompatActivity() {
|
||||
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
||||
val outCalls = Call.uaCalls(calls, uas[aorSpinner.selectedItemPosition], "out")
|
||||
if (outCalls.size > 0) {
|
||||
if (Utils.cmd_exec("zrtp_unverify " + outCalls[0].zid) != 0) {
|
||||
if (Api.cmd_exec("zrtp_unverify " + outCalls[0].zid) != 0) {
|
||||
Log.w("Baresip",
|
||||
"Command 'zrtp_unverify ${outCalls[0].zid}' failed")
|
||||
} else {
|
||||
@ -405,7 +405,7 @@ class MainActivity : AppCompatActivity() {
|
||||
verifyDialog.setMessage("Do you want to verify SAS <${ev[1]}> <${ev[2]}>?")
|
||||
verifyDialog.setPositiveButton("Yes") { dialog, _ ->
|
||||
val security: Int
|
||||
if (Utils.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
||||
if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
||||
Log.w("Baresip", "Command 'zrtp_verify ${ev[3]}' failed")
|
||||
security = R.drawable.box_yellow
|
||||
} else {
|
||||
@ -605,7 +605,7 @@ class MainActivity : AppCompatActivity() {
|
||||
return true
|
||||
}
|
||||
R.id.about -> {
|
||||
Utils.cmd_exec("audio_debug")
|
||||
Api.cmd_exec("audio_debug")
|
||||
i = Intent(this, AboutActivity::class.java)
|
||||
startActivityForResult(i, ABOUT_CODE)
|
||||
return true
|
||||
@ -761,7 +761,7 @@ class MainActivity : AppCompatActivity() {
|
||||
unverifyDialog.setMessage("This call is SECURE and peer is VERIFIED! " +
|
||||
"Do you want to unverify the peer?")
|
||||
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
||||
if (Utils.cmd_exec("zrtp_unverify " + call.zid) != 0) {
|
||||
if (Api.cmd_exec("zrtp_unverify " + call.zid) != 0) {
|
||||
Log.w("Baresip", "Command 'zrtp_unverify ${call.zid}' failed")
|
||||
} else {
|
||||
security_button.setImageResource(R.drawable.box_yellow)
|
||||
|
||||
@ -182,8 +182,4 @@ object Utils {
|
||||
return isLocked
|
||||
}
|
||||
|
||||
external fun cmd_exec(cmd: String): Int
|
||||
external fun uri_decode(uri: String): Boolean
|
||||
external fun audio_codecs(): String
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user