Added configurable parameter sip.client.rtp-ip in bigbluebutton-sip.properties to be able to talk correctly to an external FreeSWITCH server. If everything runs locally the value of this parameter will be identical to sip.server.host. If you're connecting to an external FreeSWITCH then this parameter's value must be the IP of the BBB box and sip.server.host's value will be that of the external FreeSWITCH server.

This commit is contained in:
alexbbb 2012-11-08 17:10:21 +01:00
parent 17bba97d40
commit c2d4415b38
6 changed files with 22 additions and 10 deletions

View File

@ -39,6 +39,7 @@ public class Application extends MultiThreadedApplicationAdapter {
private ClientConnectionManager clientConnManager;
private String sipServerHost = "localhost";
private String sipClientRtpIp = "";
private int sipPort = 5070;
private int startAudioPort = 3000;
private int stopAudioPort = 3029;
@ -53,7 +54,7 @@ public class Application extends MultiThreadedApplicationAdapter {
callStreamFactory.setScope(scope);
sipPeerManager.setCallStreamFactory(callStreamFactory);
sipPeerManager.setClientConnectionManager(clientConnManager);
sipPeerManager.createSipPeer("default", sipServerHost, sipPort, startAudioPort, stopAudioPort);
sipPeerManager.createSipPeer("default", sipClientRtpIp, sipServerHost, sipPort, startAudioPort, stopAudioPort);
try {
sipPeerManager.register("default", username, password);
} catch (PeerNotFoundException e) {
@ -176,6 +177,10 @@ public class Application extends MultiThreadedApplicationAdapter {
sipServerHost = h.trim();
}
public void setSipClientRtpIp(String ipAddr) {
this.sipClientRtpIp = ipAddr.trim();
}
public void setUsername(String un) {
this.username = un.trim();
}

View File

@ -47,6 +47,7 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
private final SipPeerProfile userProfile;
private final SipProvider sipProvider;
private final String clientRtpIp;
private ExtendedCall call;
private CallStream callStream;
private String localSession = null;
@ -66,8 +67,9 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
private CallState callState;
public CallAgent(SipProvider sipProvider, SipPeerProfile userProfile, AudioConferenceProvider portProvider, String clientId) {
public CallAgent(String sipClientRtpIp, SipProvider sipProvider, SipPeerProfile userProfile, AudioConferenceProvider portProvider, String clientId) {
this.sipProvider = sipProvider;
this.clientRtpIp = sipClientRtpIp;
this.userProfile = userProfile;
this.portProvider = portProvider;
this.clientId = clientId;
@ -80,13 +82,14 @@ public class CallAgent extends CallListenerAdapter implements CallStreamObserver
private void initSessionDescriptor() {
log.debug("initSessionDescriptor");
SessionDescriptor newSdp = SdpUtils.createInitialSdp(userProfile.username,
sipProvider.getViaAddress(), userProfile.audioPort,
this.clientRtpIp, userProfile.audioPort,
userProfile.videoPort, userProfile.audioCodecsPrecedence );
localSession = newSdp.toString();
log.debug("localSession Descriptor = " + localSession );
}
public void call(String callerName, String destination) {
public void call(String callerName, String pdestination) {
String destination = "125";
log.debug("{} making a call to {}", callerName, destination);
try {
localSocket = getLocalAudioSocket();

View File

@ -47,6 +47,7 @@ public class SipPeer implements SipRegisterAgentListener {
private CallManager callManager = new CallManager();
private SipProvider sipProvider;
private String clientRtpIp;
private SipRegisterAgent registerAgent;
private final String id;
private final AudioConferenceProvider audioconfProvider;
@ -54,8 +55,9 @@ public class SipPeer implements SipRegisterAgentListener {
private boolean registered = false;
private SipPeerProfile registeredProfile;
public SipPeer(String id, String host, int sipPort, int startAudioPort, int stopAudioPort) {
public SipPeer(String id, String sipClientRtpIp, String host, int sipPort, int startAudioPort, int stopAudioPort) {
this.id = id;
this.clientRtpIp = sipClientRtpIp;
audioconfProvider = new AudioConferenceProvider(host, sipPort, startAudioPort, stopAudioPort);
initSipProvider(host, sipPort);
}
@ -114,7 +116,7 @@ public class SipPeer implements SipRegisterAgentListener {
}
SipPeerProfile callerProfile = SipPeerProfile.copy(registeredProfile);
CallAgent ca = new CallAgent(sipProvider, callerProfile, audioconfProvider, clientId);
CallAgent ca = new CallAgent(this.clientRtpIp, sipProvider, callerProfile, audioconfProvider, clientId);
ca.setClientConnectionManager(clientConnManager);
ca.setCallStreamFactory(callStreamFactory);
callManager.add(ca);

View File

@ -47,8 +47,8 @@ public final class SipPeerManager {
sipPeers = Collections.synchronizedMap(new HashMap<String, SipPeer>());
}
public void createSipPeer(String peerId, String host, int sipPort, int startRtpPort, int stopRtpPort) {
SipPeer sipPeer = new SipPeer(peerId, host, sipPort, startRtpPort, stopRtpPort);
public void createSipPeer(String peerId, String clientRtpIp, String host, int sipPort, int startRtpPort, int stopRtpPort) {
SipPeer sipPeer = new SipPeer(peerId, clientRtpIp, host, sipPort, startRtpPort, stopRtpPort);
sipPeer.setClientConnectionManager(clientConnManager);
sipPeer.setCallStreamFactory(callStreamFactory);
sipPeers.put(peerId, sipPeer);

View File

@ -1,4 +1,5 @@
# The address of your FreeSWITCH/asterisk server
sip.client.rtp-ip=127.0.0.1
sip.server.host=127.0.0.1
sip.server.port=5070
sip.server.username=bbbuser

View File

@ -29,6 +29,7 @@
</bean>
<bean id="web.handler" class="org.bigbluebutton.voiceconf.red5.Application">
<property name="sipClientRtpIp" value="${sip.client.rtp-ip}" />
<property name="sipServerHost" value="${sip.server.host}" />
<property name="sipPort" value="${sip.server.port}" />
<property name="username" value="${sip.server.username}" />