- when freeswitch initiates hanging up of global audio call, we need to hangup all
listen only callers. If not, the globak audio stream is destroyed and not re-recreated resulting in no audio for listen only.
This commit is contained in:
parent
88df7450a5
commit
d34ee2a90e
0
bbb-fsesl-client/deploy.sh
Normal file → Executable file
0
bbb-fsesl-client/deploy.sh
Normal file → Executable file
@ -63,7 +63,8 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
|
||||
private String _destination;
|
||||
private Boolean listeningToGlobal = false;
|
||||
private IMessagingService messagingService;
|
||||
|
||||
private ForceHangupGlobalAudioUsersListener forceHangupGlobalAudioUsersListener;
|
||||
|
||||
private enum CallState {
|
||||
UA_IDLE(0), UA_INCOMING_CALL(1), UA_OUTGOING_CALL(2), UA_ONCALL(3);
|
||||
private final int state;
|
||||
@ -404,15 +405,23 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
|
||||
|
||||
/** Callback function called when arriving a BYE request */
|
||||
public void onCallClosing(Call call, Message bye) {
|
||||
log.info("Received a BYE from the other end telling us to hangup.");
|
||||
|
||||
if (!isCurrentCall(call)) return;
|
||||
closeVoiceStreams();
|
||||
notifyListenersOfOnCallClosed();
|
||||
callState = CallState.UA_IDLE;
|
||||
log.info("Received a BYE from the other end telling us to hangup.");
|
||||
|
||||
// Reset local sdp for next call.
|
||||
initSessionDescriptor();
|
||||
if (!isCurrentCall(call)) return;
|
||||
closeVoiceStreams();
|
||||
notifyListenersOfOnCallClosed();
|
||||
|
||||
// FreeSWITCH initiated hangup of call. Hangup all listen only users.
|
||||
// ralam jan 24, 2019
|
||||
if (forceHangupGlobalAudioUsersListener != null) {
|
||||
log.info("Forcing hangup for listen only users of of voice conf {}.", getDestination());
|
||||
forceHangupGlobalAudioUsersListener.forceHangupGlobalAudioUsers(getDestination());
|
||||
}
|
||||
|
||||
callState = CallState.UA_IDLE;
|
||||
|
||||
// Reset local sdp for next call.
|
||||
initSessionDescriptor();
|
||||
}
|
||||
|
||||
|
||||
@ -451,7 +460,11 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
|
||||
private boolean isCurrentCall(Call call) {
|
||||
return this.call == call;
|
||||
}
|
||||
|
||||
|
||||
public void setForceHangupGlobalAudioUsersListener(ForceHangupGlobalAudioUsersListener listener) {
|
||||
forceHangupGlobalAudioUsersListener = listener;
|
||||
}
|
||||
|
||||
public void setCallStreamFactory(CallStreamFactory csf) {
|
||||
this.callStreamFactory = csf;
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
public interface ForceHangupGlobalAudioUsersListener {
|
||||
void forceHangupGlobalAudioUsers(String voiceConf);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.red5.app.sip.codecs.Codec;
|
||||
@ -80,6 +81,13 @@ public class GlobalCall {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static synchronized Collection<ListenOnlyUser> getAllListenOnlyUsers(String voiceConf) {
|
||||
if (voiceConfToListenOnlyUsersMap.containsKey(voiceConf)) {
|
||||
return voiceConfToListenOnlyUsersMap.get(voiceConf).getAllListenOnlyUsers();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Codec getRoomCodec(String roomName) {
|
||||
return roomToCodecMap.get(roomName);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import org.red5.server.api.stream.IBroadcastStream;
|
||||
* @author Richard Alam
|
||||
*
|
||||
*/
|
||||
public class SipPeer implements SipRegisterAgentListener {
|
||||
public class SipPeer implements SipRegisterAgentListener, ForceHangupGlobalAudioUsersListener {
|
||||
private static Logger log = Red5LoggerFactory.getLogger(SipPeer.class, "sip");
|
||||
|
||||
private ClientConnectionManager clientConnManager;
|
||||
@ -130,6 +130,7 @@ public class SipPeer implements SipRegisterAgentListener {
|
||||
SipPeerProfile callerProfile = SipPeerProfile.copy(registeredProfile);
|
||||
CallAgent ca = new CallAgent(this.clientRtpIp, sipProvider, callerProfile, audioconfProvider, clientId, messagingService);
|
||||
ca.setClientConnectionManager(clientConnManager);
|
||||
ca.setForceHangupGlobalAudioUsersListener(this);
|
||||
ca.setCallStreamFactory(callStreamFactory);
|
||||
callManager.add(ca);
|
||||
|
||||
@ -229,6 +230,15 @@ public class SipPeer implements SipRegisterAgentListener {
|
||||
log.info("Successfully unregistered with Sip Server");
|
||||
registered = false;
|
||||
}
|
||||
|
||||
public void forceHangupGlobalAudioUsers(String voiceConf) {
|
||||
Collection<ListenOnlyUser> listenOnlyUsers = GlobalCall.getAllListenOnlyUsers(voiceConf);
|
||||
Iterator iter = listenOnlyUsers.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ListenOnlyUser listenOnlyUser = (ListenOnlyUser) iter.next();
|
||||
hangup(listenOnlyUser.clientId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallStreamFactory(CallStreamFactory csf) {
|
||||
callStreamFactory = csf;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ -23,4 +25,8 @@ public class VoiceConfToListenOnlyUsersMap {
|
||||
public int numUsers() {
|
||||
return listenOnlyUsers.size();
|
||||
}
|
||||
|
||||
public Collection<ListenOnlyUser> getAllListenOnlyUsers() {
|
||||
return listenOnlyUsers.values();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user