- checkpoint 4: just moving things around
This commit is contained in:
parent
964577c62e
commit
be908218e9
@ -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;
|
||||
}
|
||||
}
|
@ -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 {
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf;
|
||||
package org.bigbluebutton.voiceconf.red5;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
231
bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/AudioStream.java
Executable file
231
bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/AudioStream.java
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
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<IStreamListener> streamListeners = new CopyOnWriteArraySet<IStreamListener>();
|
||||
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<IStreamListener> 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;
|
||||
}
|
||||
}
|
@ -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;
|
@ -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;
|
@ -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;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip.stream;
|
||||
package org.bigbluebutton.voiceconf.red5.media;
|
||||
|
||||
public interface RtpStreamReceiverListener {
|
||||
|
@ -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;
|
@ -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;
|
@ -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.*;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
@ -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) {
|
@ -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;
|
||||
}
|
||||
}
|
@ -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"});
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import org.slf4j.Logger;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip.exception;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
public class PeerNotFoundException extends Exception {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import org.red5.server.api.IScope;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
class SipConnectInfo {
|
||||
|
@ -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;
|
||||
|
@ -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<String, SipPeer> 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;
|
||||
}
|
@ -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.*;
|
@ -1,4 +1,4 @@
|
||||
package org.bigbluebutton.voice.conf.sip;
|
||||
package org.bigbluebutton.voiceconf.sip;
|
||||
|
||||
import local.net.KeepAliveSip;
|
||||
import org.zoolu.net.SocketAddress;
|
@ -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. */
|
@ -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);
|
79
bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as
Normal file → Executable file
79
bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as
Normal file → Executable file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
6
bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml
Normal file → Executable file
6
bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneLocalEventMap.mxml
Normal file → Executable file
@ -80,10 +80,6 @@
|
||||
<MethodInvoker generator="{PhoneManager}" method="join" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{RegistrationSuccessEvent.REGISTRATION_SUCCESS_EVENT}">
|
||||
<MethodInvoker generator="{PhoneManager}" method="dialConference"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{CallConnectedEvent.CALL_CONNECTED_EVENT}">
|
||||
<MethodInvoker generator="{PhoneLocalEventMapDelegate}" method="disableToolbarButton"/>
|
||||
<MethodInvoker generator="{PhoneManager}" method="callConnected" arguments="{event}"/>
|
||||
@ -94,7 +90,7 @@
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ConnectionStatusEvent.CONNECTION_STATUS_EVENT}">
|
||||
<MethodInvoker generator="{PhoneManager}" method="register"/>
|
||||
<MethodInvoker generator="{PhoneManager}" method="dialConference"/>
|
||||
</EventHandlers>
|
||||
|
||||
</LocalEventMap>
|
||||
|
Loading…
Reference in New Issue
Block a user