Skip to content

Commit 37d0eab

Browse files
authored
fix: Fixes outgoing calls and not live rooms. (#604)
* fix: Fixes outgoing calls and not live rooms. * squash: Create outgoing sip call when meeting is not live. * squash: Adds a log.
1 parent 8fb55e3 commit 37d0eab

File tree

6 files changed

+72
-20
lines changed

6 files changed

+72
-20
lines changed

src/main/java/org/jitsi/jigasi/AbstractGateway.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ public void onJvbRoomJoined(T source)
199199
public void onLobbyWaitReview(ChatRoom lobbyRoom)
200200
{}
201201

202+
@Override
203+
public void notifyConferenceNotLive()
204+
{}
205+
202206
/**
203207
* Finds {@link AbstractGatewaySession} for given <tt>callResource</tt> if
204208
* one is currently active.

src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,18 @@ public void notifyOnLobbyWaitReview(ChatRoom lobbyRoom)
311311
* Method called to notify that the conference is not live yet.
312312
*/
313313
public void notifyConferenceNotLive()
314-
{}
314+
{
315+
Iterable<GatewaySessionListener> gwListeners;
316+
synchronized (listeners)
317+
{
318+
gwListeners = new ArrayList<>(listeners);
319+
}
320+
321+
for (GatewaySessionListener listener : gwListeners)
322+
{
323+
listener.notifyConferenceNotLive();
324+
}
325+
}
315326

316327
/**
317328
* Method called by {@link JvbConference} that it has reached

src/main/java/org/jitsi/jigasi/GatewaySessionListener.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public interface GatewaySessionListener<T extends AbstractGatewaySession>
3636
*/
3737
void onJvbRoomJoined(T source);
3838

39+
void notifyConferenceNotLive();
40+
3941
/**
4042
* Called when a <tt>AbstractGatewaySession</tt> has joined the lobby MUC
4143
*

src/main/java/org/jitsi/jigasi/SipGatewaySession.java

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ public void peerStateChanged(CallPeerChangeEvent evt)
549549
}
550550

551551
/**
552+
* jvbConferenceCall can be null in case of outgoing call where the xmpp meeting is not live.
552553
* {@inheritDoc}
553554
*/
554555
Exception onConferenceCallStarted(Call jvbConferenceCall)
@@ -594,16 +595,6 @@ Exception onConferenceCallStarted(Call jvbConferenceCall)
594595
return null;
595596
}
596597

597-
//sendPresenceExtension(
598-
// createPresenceExtension(
599-
// SipGatewayExtension.STATE_RINGING, null));
600-
601-
//if (jvbConference != null)
602-
//{
603-
// jvbConference.setPresenceStatus(
604-
// SipGatewayExtension.STATE_RINGING);
605-
//}
606-
607598
// Make an outgoing call
608599
final OperationSetBasicTelephony tele
609600
= sipProvider.getOperationSet(
@@ -652,9 +643,12 @@ public void callEnded(CallEvent callEvent)
652643
this.sipCall = tele.createCall(outboundPrefix + destination);
653644
this.initSipCall();
654645

655-
// Outgoing SIP connection mode sets common conference object
656-
// just after the call has been created
657-
jvbConferenceCall.setConference(sipCall.getConference());
646+
if (jvbConferenceCall != null)
647+
{
648+
// Outgoing SIP connection mode sets common conference object
649+
// just after the call has been created
650+
jvbConferenceCall.setConference(sipCall.getConference());
651+
}
658652

659653
logger.info("Created outgoing call to " + this);
660654

@@ -672,7 +666,10 @@ public void callEnded(CallEvent callEvent)
672666

673667
try
674668
{
675-
CallManager.acceptCall(jvbConferenceCall);
669+
if (jvbConferenceCall != null)
670+
{
671+
CallManager.acceptCall(jvbConferenceCall);
672+
}
676673
}
677674
catch(OperationFailedException e)
678675
{
@@ -1193,6 +1190,23 @@ public void notifyConferenceNotLive()
11931190
{
11941191
logger.error("Cannot send visitor message", ex);
11951192
}
1193+
1194+
if (this.callContext.getDestination() != null && this.getSipCall() == null)
1195+
{
1196+
Exception error = this.onConferenceCallStarted(null);
1197+
1198+
if (error != null)
1199+
{
1200+
logger.error(error.toString(), error);
1201+
1202+
if (error instanceof OperationFailedException)
1203+
{
1204+
OperationFailedException ex = (OperationFailedException)error;
1205+
1206+
hangUpSipCall(ex.getErrorCode(), ex.getMessage());
1207+
}
1208+
}
1209+
}
11961210
}
11971211

11981212
/**

src/main/java/org/jitsi/jigasi/xmpp/CallControlMucActivator.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.jitsi.utils.logging.Logger;
3131
import org.jitsi.xmpp.extensions.rayo.*;
3232
import org.jitsi.service.configuration.*;
33-
import org.jitsi.xmpp.util.*;
3433
import org.jivesoftware.smack.*;
3534
import org.jivesoftware.smack.bosh.*;
3635
import org.jivesoftware.smack.iqrequest.*;
@@ -376,6 +375,10 @@ public void onJvbRoomJoined(AbstractGatewaySession source)
376375
updatePresenceStatusForXmppProviders();
377376
}
378377

378+
@Override
379+
public void notifyConferenceNotLive()
380+
{}
381+
379382
@Override
380383
public void onLobbyWaitReview(ChatRoom lobbyRoom)
381384
{}
@@ -686,11 +689,19 @@ private void setDialResponseAndRegisterHangUpHandler(
686689
room = waiter.lobbyRoom;
687690
}
688691

689-
response.setUri("xmpp:" + room.getIdentifier() + "/" + room.getUserNickname());
692+
// room can be null when the meeting is not live yet
693+
if (room != null)
694+
{
695+
response.setUri("xmpp:" + room.getIdentifier() + "/" + room.getUserNickname());
690696

691-
final XMPPConnection roomConnection = ((ProtocolProviderServiceJabberImpl) room.getParentProvider())
692-
.getConnection();
693-
roomConnection.registerIQRequestHandler(new HangUpIqHandler(room.getParentProvider()));
697+
final XMPPConnection roomConnection = ((ProtocolProviderServiceJabberImpl) room.getParentProvider())
698+
.getConnection();
699+
roomConnection.registerIQRequestHandler(new HangUpIqHandler(room.getParentProvider()));
700+
}
701+
else
702+
{
703+
logger.warn("Room is null for session: " + session);
704+
}
694705
}
695706
}
696707

@@ -716,6 +727,12 @@ public void onJvbRoomJoined(AbstractGatewaySession source)
716727
countDownLatch.countDown();
717728
}
718729

730+
@Override
731+
public void notifyConferenceNotLive()
732+
{
733+
countDownLatch.countDown();
734+
}
735+
719736
@Override
720737
public void onLobbyWaitReview(ChatRoom lobbyRoom)
721738
{

src/test/java/org/jitsi/jigasi/GatewaySessionAsserts.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public void onJvbRoomJoined(AbstractGatewaySession source)
3939
}
4040
}
4141

42+
@Override
43+
public void notifyConferenceNotLive()
44+
{}
45+
4246
@Override
4347
public void onLobbyWaitReview(ChatRoom lobbyRoom)
4448
{}

0 commit comments

Comments
 (0)