From 65fd84346714e21773b2bd46e732b42000da4e12 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 15 Jul 2024 10:08:47 +0200 Subject: [PATCH] catch establishing call when last call is shutting down --- .../CallIntegrationConnectionService.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java index 95f1f6785270a41bd074cf99caedac0ccd077826..a225dcbee935a5e2782eb6a6873b4ee156939c2b 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java @@ -35,6 +35,7 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.ui.RtpSessionActivity; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; +import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; @@ -125,9 +126,17 @@ public class CallIntegrationConnectionService extends ConnectionService { // actually attempted // sendJingleFinishMessage(service, contact, Reason.CONNECTIVITY_ERROR); } else { - final var proposal = - service.getJingleConnectionManager() - .proposeJingleRtpSession(account, with, media); + final JingleConnectionManager.RtpSessionProposal proposal; + try { + proposal = + service.getJingleConnectionManager() + .proposeJingleRtpSession(account, with, media); + } catch (final IllegalStateException e) { + return Connection.createFailedConnection( + new DisconnectCause( + DisconnectCause.ERROR, + "Phone is busy. Probably race condition. Try again in a moment")); + } if (proposal == null) { // TODO instead of just null checking try to get the sessionID return Connection.createFailedConnection(