- Moved call_peeruri API function back to Api object, since call object

does not exist when peer URI is needed.
This commit is contained in:
Juha Heinanen
2020-05-02 09:58:52 +03:00
parent 365ea34a48
commit d12a9aa2f9
4 changed files with 34 additions and 36 deletions
@@ -25,6 +25,7 @@ object Api {
external fun ua_set_media_af(uap: String, af: Int)
external fun account_debug(accp: String)
external fun ua_debug(uap: String)
external fun call_peeruri(callp: String): String
external fun message_send(uap: String, peer_uri: String, message: String, time: String): Int
external fun reload_config(): Int
external fun cmd_exec(cmd: String): Int
@@ -556,12 +556,7 @@ class BaresipService: Service() {
return
}
"call incoming" -> {
val call = Call.find(callp)
if (call == null) {
Log.w(LOG_TAG, "Incoming call $callp is not found")
return
}
val peerUri = call.peerUri()
val peerUri = Api.call_peeruri(callp)
if ((Call.calls().size > 0) ||
(tm.callState != TelephonyManager.CALL_STATE_IDLE) ||
!Utils.checkPermission(applicationContext,
@@ -43,10 +43,6 @@ class Call(val callp: String, val ua: UserAgent, val peerURI: String, val dir: S
return call_has_video(callp)
}
fun peerUri(): String {
return call_peeruri(callp)
}
fun status(): String {
return call_status(callp)
}
@@ -62,7 +58,6 @@ class Call(val callp: String, val ua: UserAgent, val peerURI: String, val dir: S
private external fun call_connect(callp: String, peer_uri: String): Int
private external fun call_hold(callp: String): Int
private external fun call_unhold(callp: String): Int
private external fun call_peeruri(callp: String): String
private external fun call_send_digit(callp: String, digit: Char): Int
private external fun call_notify_sipfrag(callp: String, code: Int, reason: String)
private external fun call_start_audio(callp: String)
@@ -89,5 +84,12 @@ class Call(val callp: String, val ua: UserAgent, val peerURI: String, val dir: S
if (c.callp == callp) return c
return null
}
fun incomingCall(): Call? {
for (c in BaresipService.calls)
if (c.status == "incoming") return c
return null
}
}
}