Stop event processing when call is auto-rejected

This commit is contained in:
Juha Heinanen
2024-09-20 17:58:23 +03:00
parent 1e93130f58
commit 7e36c2a9b7
3 changed files with 14 additions and 1 deletions
+11 -1
View File
@@ -179,7 +179,7 @@ static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
ua = uag_find_msg(msg); ua = uag_find_msg(msg);
// There is no call yet and call is thus used to hold SIP message // There is no call yet and call is thus used to hold SIP message
call = (struct call *)msg; call = (struct call *)msg;
len = re_snprintf(event_buf, sizeof event_buf, "%s,%r", prm, &msg->from.auri); len = re_snprintf(event_buf, sizeof event_buf, "%s,%r,%ld", prm, &msg->from.auri, (long)event);
break; break;
case UA_EVENT_CALL_INCOMING: case UA_EVENT_CALL_INCOMING:
len = re_snprintf(event_buf, sizeof event_buf, "call incoming,%s", prm); len = re_snprintf(event_buf, sizeof event_buf, "call incoming,%s", prm);
@@ -1290,6 +1290,16 @@ JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_sip_1treply(
(*env)->ReleaseStringUTFChars(env, reason, native_reason); (*env)->ReleaseStringUTFChars(env, reason, native_reason);
} }
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_bevent_1stop(
JNIEnv *env, jobject obj, jlong event)
{
(void)env;
(void)obj;
re_thread_enter();
bevent_stop((struct bevent *)event);
re_thread_leave();
}
JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_calls_1mute( JNIEXPORT void JNICALL Java_com_tutpro_baresip_Api_calls_1mute(
JNIEnv *env, jobject obj, jboolean mute) JNIEnv *env, jobject obj, jboolean mute)
{ {
@@ -80,6 +80,8 @@ object Api {
external fun sip_treply(msg: Long, code: Int, reason: String) external fun sip_treply(msg: Long, code: Int, reason: String)
external fun bevent_stop(event: Long)
external fun call_connect(callp: Long, peer_uri: String): Int external fun call_connect(callp: Long, peer_uri: String): Int
external fun call_hold(callp: Long, hold: Boolean): Int external fun call_hold(callp: Long, hold: Boolean): Int
external fun call_ismuted(callp: Long): Boolean external fun call_ismuted(callp: Long): Boolean
@@ -714,6 +714,7 @@ class BaresipService: Service() {
if (toastMsg != "") { if (toastMsg != "") {
Log.d(TAG, "Auto-rejecting incoming call $uap/$peerUri") Log.d(TAG, "Auto-rejecting incoming call $uap/$peerUri")
Api.sip_treply(callp, 486, "Busy Here") Api.sip_treply(callp, 486, "Busy Here")
Api.bevent_stop(ev[2].toLong())
toast(toastMsg) toast(toastMsg)
val name = "callwaiting_$toneCountry" val name = "callwaiting_$toneCountry"
val resourceId = applicationContext.resources.getIdentifier( val resourceId = applicationContext.resources.getIdentifier(