diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStreamFactory.java b/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStreamFactory.java deleted file mode 100755 index 9d46a660f2..0000000000 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStreamFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.bigbluebutton.voice.conf.sip; - -import org.red5.app.sip.codecs.Codec; - -public class CallStreamFactory { - private ScopeProvider scopeProvider; - - public CallStream createCallStream(Codec sipCodec, SipConnectInfo connInfo) { - return new CallStream(sipCodec, connInfo, scopeProvider); - } - - public void setScopeProvider(ScopeProvider scopeProvider) { - this.scopeProvider = scopeProvider; - } -} diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Application.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Application.java similarity index 87% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Application.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Application.java index 9d527a29df..f659391587 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Application.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Application.java @@ -1,11 +1,12 @@ -package org.bigbluebutton.voice.conf; +package org.bigbluebutton.voiceconf.red5; import java.text.MessageFormat; import java.util.List; import org.slf4j.Logger; -import org.bigbluebutton.voice.conf.sip.ClientConnectionManager; -import org.bigbluebutton.voice.conf.sip.SipPeerManager; -import org.bigbluebutton.voice.conf.sip.exception.PeerNotFoundException; +import org.bigbluebutton.voiceconf.sip.CallStreamFactory; +import org.bigbluebutton.voiceconf.sip.ClientConnectionManager; +import org.bigbluebutton.voiceconf.sip.PeerNotFoundException; +import org.bigbluebutton.voiceconf.sip.SipPeerManager; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.MultiThreadedApplicationAdapter; import org.red5.server.api.IClient; @@ -30,12 +31,16 @@ public class Application extends MultiThreadedApplicationAdapter { private int rtpPort; private String password = "secret"; private String username; + private CallStreamFactory callStreamFactory; private MessageFormat callExtensionPattern = new MessageFormat("{0}"); @Override public boolean appStart(IScope scope) { - log.debug("VoiceConferenceApplication appStart[" + scope.getName() + "]"); + log.debug("VoiceConferenceApplication appStart[" + scope.getName() + "]"); + callStreamFactory = new CallStreamFactory(); + callStreamFactory.setScope(scope); + sipPeerManager.setCallStreamFactory(callStreamFactory); sipPeerManager.setClientConnectionManager(clientConnManager); sipPeerManager.createSipPeer(sipServerHost, sipServerHost, startSipPort, startRtpPort, stopRtpPort); try { diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Service.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Service.java similarity index 96% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Service.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Service.java index fe8de7ccf7..f8b963b78b 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/Service.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/Service.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf; +package org.bigbluebutton.voiceconf.red5; import java.text.MessageFormat; import java.util.List; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/AudioStream.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/AudioStream.java new file mode 100755 index 0000000000..2ae1f3bdd2 --- /dev/null +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/AudioStream.java @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2008, 2009 by Xuggle Incorporated. All rights reserved. + * + * This file is part of Xuggler. + * + * You can redistribute Xuggler and/or modify it under the terms of the GNU + * Affero General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * Xuggler is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Xuggler. If not, see . + * + */ +package org.bigbluebutton.voiceconf.red5.media; + +import java.io.IOException; +import java.util.Collection; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; + +import org.red5.logging.Red5LoggerFactory; +import org.red5.server.api.IScope; +import org.red5.server.api.event.IEvent; +import org.red5.server.api.stream.IBroadcastStream; +import org.red5.server.api.stream.IStreamCodecInfo; +import org.red5.server.api.stream.IStreamListener; +import org.red5.server.api.stream.ResourceExistException; +import org.red5.server.api.stream.ResourceNotFoundException; +import org.red5.server.messaging.IMessageComponent; +import org.red5.server.messaging.IPipe; +import org.red5.server.messaging.IPipeConnectionListener; +import org.red5.server.messaging.IProvider; +import org.red5.server.messaging.OOBControlMessage; +import org.red5.server.messaging.PipeConnectionEvent; +import org.red5.server.net.rtmp.event.IRTMPEvent; +import org.red5.server.net.rtmp.event.Notify; +import org.red5.server.stream.codec.StreamCodecInfo; +import org.red5.server.stream.message.RTMPMessage; + +import org.slf4j.Logger; + +import org.red5.server.api.stream.IStreamPacket;; + +public class AudioStream implements IBroadcastStream, IProvider, IPipeConnectionListener { + /** Listeners to get notified about received packets. */ + private Set streamListeners = new CopyOnWriteArraySet(); + final private Logger log = Red5LoggerFactory.getLogger(AudioStream.class, "sip"); + + private String publishedStreamName; + private IPipe livePipe; + private IScope scope; + + // Codec handling stuff for frame dropping + private StreamCodecInfo streamCodecInfo; + private Long creationTime; + + public AudioStream(String name) { + publishedStreamName = name; + livePipe = null; + log.trace("name: {}", name); + + streamCodecInfo = new StreamCodecInfo(); + creationTime = null; + } + + public IProvider getProvider() { + log.trace("getProvider()"); + return this; + } + + public Notify getMetaData() { + System.out.println("**** GETTING METADATA ******"); + return null; + } + + public String getPublishedName() { + log.trace("getPublishedName()"); + return publishedStreamName; + } + + public String getSaveFilename() { + log.trace("getSaveFilename()"); + throw new Error("unimplemented method"); + } + + public void addStreamListener(IStreamListener listener) { + log.trace("addStreamListener(listener: {})", listener); + streamListeners.add(listener); + } + + public Collection getStreamListeners() { + // log.trace("getStreamListeners()"); + return streamListeners; + } + + public void removeStreamListener(IStreamListener listener) { + log.trace("removeStreamListener({})", listener); + streamListeners.remove(listener); + } + + public void saveAs(String filePath, boolean isAppend) throws IOException, + ResourceNotFoundException, ResourceExistException { + log.trace("saveAs(filepath:{}, isAppend:{})", filePath, isAppend); + throw new Error("unimplemented method"); + } + + public void setPublishedName(String name) { + log.trace("setPublishedName(name:{})", name); + publishedStreamName = name; + } + + public void close() { + log.trace("close()"); + } + + public IStreamCodecInfo getCodecInfo() { + // log.trace("getCodecInfo()"); + // we don't support this right now. + return streamCodecInfo; + } + + public String getName() { + log.trace("getName(): {}", publishedStreamName); + // for now, just return the published name + return publishedStreamName; + } + + public void setScope(IScope scope) { + this.scope = scope; + } + + public IScope getScope() { + log.trace("getScope(): {}", scope); + return scope; + } + + public void start() { + log.trace("start()"); + } + + public void stop() { + log.trace("stop"); + } + + public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) { + log.trace("onOOBControlMessage"); + } + + public void onPipeConnectionEvent(PipeConnectionEvent event) { + log.trace("onPipeConnectionEvent(event:{})", event); + switch (event.getType()) + { + case PipeConnectionEvent.PROVIDER_CONNECT_PUSH: + log.trace("PipeConnectionEvent.PROVIDER_CONNECT_PUSH"); + System.out.println("PipeConnectionEvent.PROVIDER_CONNECT_PUSH"); + if (event.getProvider() == this + && (event.getParamMap() == null + || !event.getParamMap().containsKey("record"))) { + log.trace("Creating a live pipe"); + System.out.println("Creating a live pipe"); + this.livePipe = (IPipe) event.getSource(); + } + break; + case PipeConnectionEvent.PROVIDER_DISCONNECT: + log.trace("PipeConnectionEvent.PROVIDER_DISCONNECT"); + System.out.println("PipeConnectionEvent.PROVIDER_DISCONNECT"); + if (this.livePipe == event.getSource()) { + log.trace("PipeConnectionEvent.PROVIDER_DISCONNECT - this.mLivePipe = null;"); + System.out.println("PipeConnectionEvent.PROVIDER_DISCONNECT - this.mLivePipe = null;"); + this.livePipe = null; + } + break; + case PipeConnectionEvent.CONSUMER_CONNECT_PUSH: + log.trace("PipeConnectionEvent.CONSUMER_CONNECT_PUSH"); + System.out.println("PipeConnectionEvent.CONSUMER_CONNECT_PUSH"); + break; + case PipeConnectionEvent.CONSUMER_DISCONNECT: + log.trace("PipeConnectionEvent.CONSUMER_DISCONNECT"); + System.out.println("PipeConnectionEvent.CONSUMER_DISCONNECT"); + break; + default: + log.trace("PipeConnectionEvent default"); + System.out.println("PipeConnectionEvent default"); + break; + } + } + + public void dispatchEvent(IEvent event) { + // log.trace("dispatchEvent(event:{})", event); + // System.out.println("dispatchEvent(event:)" + event); + if (event instanceof IRTMPEvent) { + IRTMPEvent rtmpEvent = (IRTMPEvent) event; + if (livePipe != null) { + RTMPMessage msg = new RTMPMessage(); + msg.setBody(rtmpEvent); + + if (creationTime == null) + creationTime = (long)rtmpEvent.getTimestamp(); + + try { +// System.out.println("dispatchEvent(event:)" + event); + livePipe.pushMessage(msg); + + if (rtmpEvent instanceof IStreamPacket) { +// System.out.println("dispatchEvent(IStreamPacket:)" + event); + for (IStreamListener listener : getStreamListeners()) { + try { +// System.out.println("dispatchEvent(event:)" + event); + listener.packetReceived(this, (IStreamPacket) rtmpEvent); + } catch (Exception e) { + log.error("Error while notifying listener " + listener, e); + } + } + } + } catch (IOException ex) { + log.error("Got exception: {}", ex); + } + } + } + } + + public long getCreationTime() { + return creationTime != null ? creationTime : 0L; + } +} diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ListenStream.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ListenStream.java similarity index 95% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ListenStream.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ListenStream.java index 5dd74fd18f..9099a55801 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ListenStream.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ListenStream.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; import org.red5.app.sip.AudioStream; import org.red5.app.sip.trancoders.TranscodedAudioDataListener; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ReceivedRtpPacketProcessor.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ReceivedRtpPacketProcessor.java similarity index 93% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ReceivedRtpPacketProcessor.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ReceivedRtpPacketProcessor.java index e37c14d2f9..de7033bf2d 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/ReceivedRtpPacketProcessor.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/ReceivedRtpPacketProcessor.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiver.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java similarity index 95% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiver.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java index d96de6c7bc..65e0ccd732 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiver.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; import local.net.RtpPacket; import local.net.RtpSocket; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiverListener.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiverListener.java similarity index 58% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiverListener.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiverListener.java index 4e590ab4e8..73eae36fef 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamReceiverListener.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiverListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; public interface RtpStreamReceiverListener { diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamSender.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamSender.java similarity index 96% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamSender.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamSender.java index f08572f774..a8a9f8a582 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/RtpStreamSender.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamSender.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; import local.net.RtpPacket; import local.net.RtpSocket; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/TalkStream.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/TalkStream.java similarity index 95% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/TalkStream.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/TalkStream.java index 78d6d0244e..8081e5bd1e 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/stream/TalkStream.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/TalkStream.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.stream; +package org.bigbluebutton.voiceconf.red5.media; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallAgent.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallAgent.java similarity index 96% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallAgent.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallAgent.java index a69196669e..c66a6260ae 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallAgent.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallAgent.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.zoolu.sip.call.*; import org.zoolu.sip.address.*; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallManager.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallManager.java similarity index 88% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallManager.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallManager.java index 74527f167c..29d9de57b0 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallManager.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallManager.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import java.util.Collection; import java.util.Map; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStream.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStream.java similarity index 90% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStream.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStream.java index 6f32b20ea5..4d34f1c1f4 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/CallStream.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStream.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import java.net.DatagramSocket; import java.net.SocketException; @@ -31,12 +31,12 @@ public class CallStream implements RtpStreamReceiverListener { private ReceivedRtpPacketProcessor packetProcessor; private final Codec sipCodec; private final SipConnectInfo connInfo; - private final ScopeProvider scopeProvider; + private final IScope scope; - public CallStream(Codec sipCodec, SipConnectInfo connInfo, ScopeProvider scopeProvider) { + public CallStream(Codec sipCodec, SipConnectInfo connInfo, IScope scope) { this.sipCodec = sipCodec; this.connInfo = connInfo; - this.scopeProvider = scopeProvider; + this.scope = scope; } public void start() throws Exception { @@ -47,7 +47,7 @@ public class CallStream implements RtpStreamReceiverListener { throw new Exception("Exception while initializing CallStream"); } - listenStream = new ListenStream(scopeProvider.getScope()); + listenStream = new ListenStream(scope); Transcoder rtmpToRtpTranscoder, rtpToRtmpTranscoder; if (sipCodec.getCodecId() == SpeexCodec.codecId) { diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStreamFactory.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStreamFactory.java new file mode 100755 index 0000000000..1775194a60 --- /dev/null +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/CallStreamFactory.java @@ -0,0 +1,16 @@ +package org.bigbluebutton.voiceconf.sip; + +import org.red5.app.sip.codecs.Codec; +import org.red5.server.api.IScope; + +public class CallStreamFactory { + private IScope scope; + + public CallStream createCallStream(Codec sipCodec, SipConnectInfo connInfo) { + return new CallStream(sipCodec, connInfo, scope); + } + + public void setScope(IScope scope) { + this.scope = scope; + } +} diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnection.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnection.java similarity index 67% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnection.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnection.java index 29197761c4..2e343c9401 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnection.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnection.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.service.IServiceCapableConnection; @@ -21,16 +21,16 @@ private static Logger log = Red5LoggerFactory.getLogger(ClientConnection.class, public void onCallConnected(String publishName, String playName) { log.debug( "SIP Call Connected" ); - connection.invoke("connected", new Object[] {publishName, playName}); + connection.invoke("successfullyJoinedVoiceConferenceCallback", new Object[] {publishName, playName}); } public void onOutgoingCallFailed() { log.debug("onOutgoingCallFailed"); - connection.invoke("callState", new Object[] {"onUaCallFailed"}); + connection.invoke("failedToJoinVoiceConferenceCallback", new Object[] {"onUaCallFailed"}); } public void onCallClosed() { log.debug("onCallClosed"); - connection.invoke("callState", new Object[] {"onUaCallClosed"}); + connection.invoke("disconnectedFromJoinVoiceConferenceCallback", new Object[] {"onUaCallClosed"}); } } diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnectionManager.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnectionManager.java similarity index 91% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnectionManager.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnectionManager.java index 8d9fdd9880..817d0ac933 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ClientConnectionManager.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ClientConnectionManager.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import java.util.HashMap; import java.util.Map; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/OptionMethodListener.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/OptionMethodListener.java similarity index 92% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/OptionMethodListener.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/OptionMethodListener.java index 0e565ae77a..8d18456171 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/OptionMethodListener.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/OptionMethodListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/exception/PeerNotFoundException.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/PeerNotFoundException.java similarity index 74% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/exception/PeerNotFoundException.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/PeerNotFoundException.java index 7ecb6c5e6f..a65c7f50ae 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/exception/PeerNotFoundException.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/PeerNotFoundException.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip.exception; +package org.bigbluebutton.voiceconf.sip; public class PeerNotFoundException extends Exception { diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ScopeProvider.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ScopeProvider.java similarity index 66% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ScopeProvider.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ScopeProvider.java index 9a11221dc9..88b7d5d2de 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/ScopeProvider.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/ScopeProvider.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.red5.server.api.IScope; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SdpUtils.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SdpUtils.java similarity index 97% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SdpUtils.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SdpUtils.java index ddf76fb8bb..525b8d39b8 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SdpUtils.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SdpUtils.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import java.util.Enumeration; import java.util.Vector; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipConnectInfo.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipConnectInfo.java similarity index 86% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipConnectInfo.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipConnectInfo.java index e0115df34e..277dd50143 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipConnectInfo.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipConnectInfo.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; class SipConnectInfo { diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeer.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeer.java similarity index 92% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeer.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeer.java index 1647944f40..ada04d95d3 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeer.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeer.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import java.util.Collection; import java.util.Iterator; @@ -7,8 +7,7 @@ import org.zoolu.sip.provider.*; import org.zoolu.net.SocketAddress; import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; -import org.red5.server.api.IScope; -import org.red5.server.api.stream.IBroadcastStream; + /** * Class that is a peer to the sip server. This class will maintain @@ -56,7 +55,7 @@ public class SipPeer implements SipRegisterAgentListener { this.password = password; sipProvider.setOutboundProxy(new SocketAddress(host)); - SipPeerProfile regProfile = createRegisterUserProfile(username, password); + SipPeerProfile regProfile = createRegisterUserProfile(); if (sipProvider != null) { registerAgent = new SipRegisterAgent(sipProvider, regProfile.fromUrl, @@ -67,7 +66,7 @@ public class SipPeer implements SipRegisterAgentListener { } } - private SipPeerProfile createRegisterUserProfile(String username, String password) { + private SipPeerProfile createRegisterUserProfile() { SipPeerProfile userProfile = new SipPeerProfile(); userProfile.audioPort = startRtpPort; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerManager.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerManager.java similarity index 89% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerManager.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerManager.java index e23587226a..c165c66e34 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerManager.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerManager.java @@ -1,12 +1,8 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.slf4j.Logger; import org.zoolu.sip.provider.SipStack; -import org.bigbluebutton.voice.conf.sip.exception.PeerNotFoundException; import org.red5.logging.Red5LoggerFactory; -import org.red5.server.api.IScope; -import org.red5.server.api.stream.IBroadcastStream; - import java.util.*; /** @@ -18,6 +14,7 @@ public final class SipPeerManager { private static final Logger log = Red5LoggerFactory.getLogger( SipPeerManager.class, "sip" ); private ClientConnectionManager clientConnManager; + private CallStreamFactory callStreamFactory; private Map sipPeers; private int sipStackDebugLevel = 8; @@ -28,6 +25,8 @@ public final class SipPeerManager { public void createSipPeer(String peerId, String host, int sipPort, int startRtpPort, int stopRtpPort) { SipPeer sipPeer = new SipPeer(peerId, host, sipPort, startRtpPort, stopRtpPort); + sipPeer.setClientConnectionManager(clientConnManager); + sipPeer.setCallStreamFactory(callStreamFactory); sipPeers.put(peerId, sipPeer); } @@ -113,6 +112,10 @@ public final class SipPeerManager { SipStack.log_path = "log"; } + public void setCallStreamFactory(CallStreamFactory csf) { + callStreamFactory = csf; + } + public void setClientConnectionManager(ClientConnectionManager ccm) { clientConnManager = ccm; } diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerProfile.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerProfile.java similarity index 96% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerProfile.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerProfile.java index 044e998eab..f17dd7ee91 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipPeerProfile.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipPeerProfile.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import org.red5.app.sip.codecs.Codec; import org.zoolu.sip.address.*; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgent.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgent.java similarity index 96% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgent.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgent.java index 880a017b24..c017f93458 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgent.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgent.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; import local.net.KeepAliveSip; import org.zoolu.net.SocketAddress; diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgentListener.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgentListener.java similarity index 85% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgentListener.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgentListener.java index 69a942f2e3..c01bca6aa2 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipRegisterAgentListener.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipRegisterAgentListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; public interface SipRegisterAgentListener { /** When a UA has been successfully (un)registered. */ diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipUserAgentListener.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipUserAgentListener.java similarity index 89% rename from bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipUserAgentListener.java rename to bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipUserAgentListener.java index ccc690a869..710a7109d1 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voice/conf/sip/SipUserAgentListener.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/sip/SipUserAgentListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.voice.conf.sip; +package org.bigbluebutton.voiceconf.sip; public interface SipUserAgentListener { public void onCallConnected(String talkStreamName, String listenStreamName); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as old mode 100644 new mode 100755 index 5dc3c23c2f..37a406f1ad --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as @@ -127,38 +127,21 @@ package org.bigbluebutton.modules.phone.managers { // // CallBack Methods from Red5 // - //******************************************************************************************** - - public function registrationSucess(msg:String):* { - LogUtil.debug("REGISTRATION to the SIP server Succeeded. " + msg); - if (msg == "REGISTERED") { - registered = true; - var regSuccessEvent:RegistrationSuccessEvent = new RegistrationSuccessEvent(); - localDispatcher.dispatchEvent(regSuccessEvent); - } else { - LogUtil.debug("Got unregister message" + msg); - } - } - - public function registrationFailure(msg:String):* { - trace("REGISTRATION to the SIP server failed."); - var regFailedEvent:RegistrationFailedEvent = new RegistrationFailedEvent(); - localDispatcher.dispatchEvent(regFailedEvent); - } - - public function callState(msg:String):* { - LogUtil.debug("RED5Manager callState " + msg); - - if (msg == "onUaCallClosed" || msg == "onUaCallFailed") { - trace("Call has been disconnected."); - isConnected = false; - var event:CallDisconnectedEvent = new CallDisconnectedEvent(); - localDispatcher.dispatchEvent(event); - } + //******************************************************************************************** + public function failedToJoinVoiceConferenceCallback(msg:String):* { + LogUtil.debug("failedToJoinVoiceConferenceCallback " + msg); + var event:CallDisconnectedEvent = new CallDisconnectedEvent(); + localDispatcher.dispatchEvent(event); } + + public function disconnectedFromJoinVoiceConferenceCallback(msg:String):* { + LogUtil.debug("disconnectedFromJoinVoiceConferenceCallback " + msg); + var event:CallDisconnectedEvent = new CallDisconnectedEvent(); + localDispatcher.dispatchEvent(event); + } - public function connected(publishName:String, playName:String):* { - trace("Call has been connected"); + public function successfullyJoinedVoiceConferenceCallback(publishName:String, playName:String):* { + LogUtil.debug("Call has been connected"); isConnected = true; var event:CallConnectedEvent = new CallConnectedEvent(); event.publishStreamName = publishName; @@ -170,47 +153,17 @@ package org.bigbluebutton.modules.phone.managers { // // SIP Actions // - //******************************************************************************************** - - public function register():void { - trace("Open " + username); - netConnection.call("open", null, uid, username); - } - + //******************************************************************************************** public function doCall(dialStr:String):void { - trace("Calling " + dialStr); + LogUtil.debug("Calling " + dialStr); netConnection.call("call", null, uid, dialStr); } - - public function doCallChar(chr:String):void { - if (isConnected) { - netConnection.call("dtmf", null, uid, chr); - } - } - + public function doHangUp():void { if (isConnected) { netConnection.call("hangup", null, uid); isConnected = false; } } - - public function doAccept():void { - netConnection.call("accept", null, uid); - } - - public function doStreamStatus(status:String):void { - netConnection.call("streamStatus", null, uid, status); - } - - public function doClose():void { - if (isRegistered()) { - netConnection.call("unregister", null, uid); - } - } - - public function isRegistered():Boolean { - return registered; - } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as index 01b2473f8a..e5cbe727b2 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as @@ -53,20 +53,15 @@ package org.bigbluebutton.modules.phone.managers public function setupConnection():void { streamManager.setConnection(connectionManager.getConnection()); } + public function join(e:JoinVoiceConferenceEvent):void { setupMic(e.useMicrophone); var uid:String = String( Math.floor( new Date().getTime() ) ); connectionManager.connect(uid, attributes.username, attributes.room, attributes.uri); } - - public function register():void { - setupConnection(); - trace("Registering...."); - connectionManager.register(); - } - + public function dialConference():void { - trace("Dialing...." + attributes.voicebridge); + LogUtil.debug("Dialing...." + attributes.voicebridge); connectionManager.doCall(attributes.voicebridge); } @@ -77,7 +72,6 @@ package org.bigbluebutton.modules.phone.managers public function hangup():void { LogUtil.debug("PhoneManager hangup"); connectionManager.doHangUp(); - connectionManager.doClose(); } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as index 5619878038..025ae7bffd 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as @@ -69,7 +69,7 @@ package org.bigbluebutton.modules.phone.managers } public function initWithNoMicrophone(): void { - trace("No available microphone"); + LogUtil.debug("No available microphone"); var event:MicrophoneUnavailEvent = new MicrophoneUnavailEvent(); localDispatcher.dispatchEvent(event); } @@ -90,7 +90,7 @@ package org.bigbluebutton.modules.phone.managers localDispatcher.dispatchEvent(unmutedEvent); break; default: - trace("unknown micStatusHandler event: " + event); + LogUtil.debug("unknown micStatusHandler event: " + event); } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml old mode 100644 new mode 100755 index d07fef2ca6..9bb716a561 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml @@ -80,10 +80,6 @@ - - - - @@ -94,7 +90,7 @@ - +