Commit ed401ca6 authored by jehan's avatar jehan

debug stun servers

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@167 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 7bbe59c7
......@@ -30,6 +30,8 @@ public interface P2pProxyResourceManagement {
public String[] lookupSipProxiesUri(String aDomaine) throws P2pProxyException ;
public void revokeSipProxy(String aProxy) throws P2pProxyException;
public void revokeMediaServer(String aMediaServer) throws P2pProxyException;
/**
* return 2 adresses where to contact media server (stun/rtprelay)
*/
......
......@@ -21,6 +21,7 @@ package org.linphone.p2pproxy.core;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
......@@ -132,6 +133,7 @@ public class JxtaNetworkManager {
if (!lNetworkConfigurator.exists()) {
lNetworkConfigurator.setPeerID(IDFactory.newPeerID(PeerGroupID.defaultNetPeerGroupID));
lNetworkConfigurator.setName(InetAddress.getLocalHost().toString()+" "+aProperties.getProperty(TCP_LISTENING_PORT));
lNetworkConfigurator.setDescription("p2p proxy instance");
lNetworkConfigurator.save();
} else {
......@@ -368,7 +370,8 @@ public class JxtaNetworkManager {
//1 check if already exist
for (Advertisement lAdv: aList) {
if (lAdv.equals(lNewAdv)) {
if (mLog.isDebugEnabled()) mLog.debug("adv ["+lNewAdv.getID()+"]already gathered");
if (mLog.isInfoEnabled()) mLog.info("adv ["+lNewAdv.getID()+"]already gathered");
if (mLog.isDebugEnabled()) mLog.debug(lNewAdv);
lNewAdv = null;
break;
}
......
......@@ -41,7 +41,7 @@ import org.linphone.p2pproxy.api.P2pProxyManagement;
import org.linphone.p2pproxy.api.P2pProxyNotReadyException;
import org.linphone.p2pproxy.api.P2pProxyResourceManagement;
import org.linphone.p2pproxy.api.P2pProxyUserAlreadyExistException;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayService;
import org.linphone.p2pproxy.core.media.MediaResourceService;
import org.linphone.p2pproxy.core.sipproxy.SipProxyRegistrar;
import org.zoolu.sip.provider.SipStack;
import org.linphone.p2pproxy.launcher.P2pProxylauncherConstants;
......@@ -84,9 +84,9 @@ public class P2pProxyMain implements P2pProxyMainMBean {
try {
mConfigHomeDir=System.getProperty("user.home")+"/.p2pproxy";
int lsipPort=5040;
int lMediaPort=16000;
int lMediaPort=MediaResourceService.AUDIO_VIDEO_LOCAL_PORT_DEFAULT_VALUE;
int lP2pPort = 9701;
JxtaNetworkManager.Mode lMode = JxtaNetworkManager.Mode.auto;
boolean lEnableHttp = false;
// setup logging
// get config dire first
......@@ -122,16 +122,11 @@ public class P2pProxyMain implements P2pProxyMainMBean {
} catch (Exception e) {
mLog.warn("cannot register MBean",e);
}
String lSocksHost = null;
String lSocksPort = null;
// if (args.length <= 0) {
// usage();
// System.exit(1);
// }
// get other params
for (int i=0; i < args.length; i=i+2) {
String argument = args[i];
if (argument.equals("-jxta")) {
if (argument.equals("-jxta") || argument.equals("-home")) {
mConfigHomeDir = args[i + 1];
//nop
} else if (argument.equals("-sip")) {
......@@ -140,8 +135,12 @@ public class P2pProxyMain implements P2pProxyMainMBean {
mConfigurator.setProperty(SipProxyRegistrar.REGISTRAR_PORT, Integer.toString(lsipPort));
} else if (argument.equals("-media")) {
lMediaPort = Integer.parseInt(args[i + 1]);
System.out.println("media detected[" + lsipPort + "]");
mConfigurator.setProperty(RtpRelayService.AUDIO_VIDEO_LOCAL_PORT, Integer.toString(lMediaPort));
System.out.println("media detected[" + lMediaPort + "]");
mConfigurator.setProperty(MediaResourceService.AUDIO_VIDEO_LOCAL_PORT, Integer.toString(lMediaPort));
} else if (argument.equals("-p2p")) {
lP2pPort = Integer.parseInt(args[i + 1]);
System.out.println("p2p port detected[" + lP2pPort + "]");
mConfigurator.setProperty(JxtaNetworkManager.TCP_LISTENING_PORT, Integer.toString(lP2pPort));
} else if (argument.equals("-relay")) {
lMode = JxtaNetworkManager.Mode.relay;
mConfigurator.setProperty(JxtaNetworkManager.MODE, lMode.name());
......@@ -169,29 +168,18 @@ public class P2pProxyMain implements P2pProxyMainMBean {
else if (argument.equals("-seeding-relay")) {
mConfigurator.setProperty(JxtaNetworkManager.SEEDING_RELAY, args[i + 1]);
System.out.println("seeding relay detected[" + args[i + 1] + "]");
} else if (argument.equals("-seeding")) {
mConfigurator.setProperty(JxtaNetworkManager.SEEDING_RDV, args[i + 1]);
mConfigurator.setProperty(JxtaNetworkManager.SEEDING_RELAY, args[i + 1]);
System.out.println("seeding detected[" + args[i + 1] + "]");
}
else if (argument.equals("-public-address")) {
mConfigurator.setProperty(JxtaNetworkManager.HTTP_LISTENING_PUBLIC_ADDRESS,args[i + 1]+":9700");
mConfigurator.setProperty(JxtaNetworkManager.TCP_LISTENING_PUBLIC_ADDRESS,args[i + 1]+":9701");
mConfigurator.setProperty(RtpRelayService.AUDIO_VIDEO_PUBLIC_URI,"udp://"+args[i + 1]+":"+lMediaPort);
mConfigurator.setProperty(JxtaNetworkManager.TCP_LISTENING_PUBLIC_ADDRESS,args[i + 1]+":"+lP2pPort);
mConfigurator.setProperty(MediaResourceService.AUDIO_VIDEO_PUBLIC_URI,"udp://"+args[i + 1]+":"+lMediaPort);
mConfigurator.setProperty(SipProxyRegistrar.REGISTRAR_PUBLIC_ADDRESS,args[i + 1]);
System.out.println("public address detected[" + args[i + 1] + "]");
}
else if (argument.equals("-socks-url")) {
try {
URI lSocksUrl = new URI(args[i + 1]);
lSocksHost = lSocksUrl.getHost();
lSocksPort = Integer.toString(lSocksUrl.getPort());
}catch (Exception e) {
mLog.warn("enable to get socks proxy from env",e);
}
System.out.println("socks serveur detected[" + args[i + 1] + "]");
} else if (argument.equals("-enable-http-client")) {
lEnableHttp = true;
mConfigurator.setProperty(JxtaNetworkManager.ENABLE_HTTP_CLIENT, "true");
System.out.println("enable-http mode detected");
i--;
}
else
{
System.out.println("Invalid option: " + args[i]);
......@@ -199,41 +187,6 @@ public class P2pProxyMain implements P2pProxyMainMBean {
System.exit(1);
}
}
String lProxyUrlString = null;
String lProxyHost = null;
String lProxyPort = null;
//configure http proxy
if ((lProxyUrlString = System.getenv("http_proxy")) != null) {
//get from env
try {
URL lProxyUrl = new URL(lProxyUrlString);
lProxyHost = lProxyUrl.getHost();
lProxyPort = Integer.toString(lProxyUrl.getPort());
}catch (Exception e) {
mLog.warn("enable do get http proxy from env",e);
}
}
//check from config
if (lProxyHost != null || (lProxyHost = mConfigurator.getProperty("http.proxyHost")) != null) {
System.setProperty("http.proxyHost", lProxyHost);
}
if (lProxyPort != null || (lProxyPort = mConfigurator.getProperty("http.proxyPort")) != null) {
System.setProperty("http.proxyPort", lProxyPort);
}
//configure socks proxy
if ((lProxyUrlString = System.getenv("socks_proxy")) != null) {
//get from env
}
//check from config
if (lSocksHost != null || (lSocksHost = mConfigurator.getProperty("socksProxyHost")) != null) {
System.setProperty("socksProxyHost", lSocksHost);
}
if (lSocksPort != null || (lSocksPort = mConfigurator.getProperty("socksProxyPort")) != null) {
System.setProperty("socksProxyPort", lSocksPort);
}
//check from env
File lJxtaDirectory = new File (mConfigHomeDir);
if (lJxtaDirectory.exists() == false) lJxtaDirectory.mkdir();
......@@ -351,35 +304,17 @@ public class P2pProxyMain implements P2pProxyMainMBean {
}
private static void usage() {
System.out.println("p2pproxy");
System.out.println("-jxta : directory where configuration/cache is located (including jxta cache.default is $HOME/.p2pproxy");
System.out.println("-home : directory where configuration/cache is located (including jxta cache.default is $HOME/.p2pproxy");
System.out.println("-sip : udp proxy port, default 5060");
System.out.println("-media : udp relay/stun port, default 16000");
System.out.println("-p2p : p2p tcp port, default 9701");
System.out.println("-relay : super peer mode");
System.out.println("-edge-only : edge mode");
System.out.println("-seeding-server : seeding server mode");
System.out.println("-auto-config : automatically choose edge or relay (default mode)");
System.out.println("-seeding-rdv : list of boostrap rdv separated by | (ex tcp://127.0.0.1:9701|http://127.0.0.2:9700)");
System.out.println("-seeding-relay : list of boostrap relay separated by |(ex tcp://127.0.0.1:9701|http://127.0.0.2:9700)");
System.out.println("-seeding : list of boostrap rdv separated by | (ex tcp://127.0.0.1:9701|http://127.0.0.2:9700)");
System.out.println("-public-address : ip as exported to peers (ex myPublicAddress.no-ip.org)");
System.out.println("-socks-url : tcp://ip:port for socks server (ex tcp://socks.com:1080)");
System.out.println("-enable-http-client : enable http transport for client (default = false)");
}
public String getHttpProxy() {
return System.getProperty("http.proxyHost", "not-set")+":"+System.getProperty("http.proxyPort", "not-set");
}
public void setHttpProxy(String aProxyHost, String aProxyPort, String aUserName, String aPassword) {
System.setProperty("http.proxyHost",aProxyHost);
System.setProperty("http.proxyPort",aProxyPort);
}
public String getSocksServer() {
return System.getProperty("socksProxyHost", "not-set")+":"+System.getProperty("socksProxyPort", "not-set");
}
public void setSocksServer(String aSocksHost, String aSocksPort, String aUserName, String aPassword) {
System.setProperty("socksProxyHost",aSocksHost);
System.setProperty("socksProxyPort",aSocksPort);
}
public void loadTraceConfigFile() throws P2pProxyException {
staticLoadTraceConfigFile();
......@@ -514,7 +449,15 @@ public static int revokeSipProxy(String aProxy) {
return P2pProxylauncherConstants.P2PPROXY_NOT_CONNECTED;
}
}
public static int revokeMediaServer(String aServer) {
try {
isReady();
mP2pProxyManagement.revokeMediaServer(aServer);
return P2pProxylauncherConstants.P2PPROXY_NO_ERROR;
} catch (P2pProxyException e) {
return P2pProxylauncherConstants.P2PPROXY_NOT_CONNECTED;
}
}
public static void stop() {
mExit = true;
......
......@@ -23,10 +23,7 @@ package org.linphone.p2pproxy.core;
import org.linphone.p2pproxy.api.P2pProxyException;
public interface P2pProxyMainMBean {
public void setHttpProxy(String aProxyHost,String aProxyPort,String aUserName,String aPassword);
public String getHttpProxy();
public void setSocksServer(String aSocksHost,String aSocksPort,String aUserName,String aPassword);
public String getSocksServer();
/**
* reload traces from file
* @throws P2pProxyException
......
......@@ -19,21 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.p2pproxy.core;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.Map;
import org.apache.log4j.Logger;
import org.linphone.p2pproxy.api.P2pProxyException;
import org.linphone.p2pproxy.api.P2pProxyManagement;
import org.linphone.p2pproxy.core.media.rtprelay.MediaType;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayServiceClient;
import org.linphone.p2pproxy.core.rdvautoconfig.PeerInfoServiceClient;
import org.linphone.p2pproxy.core.sipproxy.NetworkResourceAdvertisement;
public abstract class P2pProxyManagementImpl extends P2pProxyResourceManagementImpl implements ServiceProvider,P2pProxyManagement {
protected final Configurator mConfigurator;
......
......@@ -55,5 +55,20 @@ public String[] getMediaServerList() throws P2pProxyException {
throw new P2pProxyException(e);
}
}
public void revokeMediaServer(String aMediaServer) throws P2pProxyException {
try {
List<NetworkResourceAdvertisement> lMediaResourceAdvertisement = (List<NetworkResourceAdvertisement>) (mJxtaNetworkManager.getAdvertisementList(null,MediaResourceService.ADV_NAME, true));
for (NetworkResourceAdvertisement lMediaResource:lMediaResourceAdvertisement) {
if (lMediaResource.getAddress().equals("udp://"+aMediaServer)) {
mJxtaNetworkManager.getPeerGroup().getDiscoveryService().flushAdvertisement(lMediaResource);
mLog.info(aMediaServer +" revoked");
}
}
} catch (Exception e) {
throw new P2pProxyException(e);
}
}
}
......@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.p2pproxy.core.media;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.net.URI;
......@@ -37,12 +38,15 @@ import org.linphone.p2pproxy.core.JxtaNetworkManager;
import org.linphone.p2pproxy.core.ServiceProvider;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayServer;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayServerConfig;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayService;
import org.linphone.p2pproxy.core.sipproxy.NetworkResourceAdvertisement;
import org.linphone.p2pproxy.core.stun.StunServer;
public class MediaResourceService implements ServiceProvider {
private final static Logger mLog = Logger.getLogger(MediaResourceService.class);
public final static String AUDIO_VIDEO_LOCAL_PORT="org.linphone.p2pproxy.udp-media-relay.audio-video.port";
public final static int AUDIO_VIDEO_LOCAL_PORT_DEFAULT_VALUE=16000;
public final static String AUDIO_VIDEO_PUBLIC_URI="org.linphone.p2pproxy.udp-media-relay.audio-video.public-uri";
private GenericUdpSession mUdpSessionForStunRtp;
private RtpRelayServer mRtpRelayServer;
private StunServer mSturServer;
......@@ -54,8 +58,9 @@ public class MediaResourceService implements ServiceProvider {
private final int ADV_LIFE_TIME=6000000;
TimerTask mPublishTask;
public MediaResourceService(Configurator aConfigurator, JxtaNetworkManager aJxtaNetworkManager) throws SocketException, UnknownHostException {
URI lAudioVideoPublicUri = URI.create(aConfigurator.getProperty(RtpRelayService.AUDIO_VIDEO_PUBLIC_URI,RtpRelayService.getDefaultAudioVideoPublicUri()));
int lAudioVideoLocalPort = Integer.valueOf(aConfigurator.getProperty(RtpRelayService.AUDIO_VIDEO_LOCAL_PORT,String.valueOf(lAudioVideoPublicUri.getPort())));
int lAudioVideoLocalPort = Integer.valueOf(aConfigurator.getProperty(MediaResourceService.AUDIO_VIDEO_LOCAL_PORT,String.valueOf(AUDIO_VIDEO_LOCAL_PORT_DEFAULT_VALUE)));
URI lAudioVideoPublicUri = URI.create(aConfigurator.getProperty(MediaResourceService.AUDIO_VIDEO_PUBLIC_URI,"udp://"+InetAddress.getLocalHost().getHostAddress()+":"+lAudioVideoLocalPort));
mConfig = new RtpRelayServerConfig(new InetSocketAddress(lAudioVideoPublicUri.getHost(),lAudioVideoPublicUri.getPort())
,new InetSocketAddress(lAudioVideoLocalPort));
mUdpSessionForStunRtp = new GenericUdpSession(new InetSocketAddress(lAudioVideoLocalPort));
......@@ -74,7 +79,7 @@ public class MediaResourceService implements ServiceProvider {
try {
mStunRtpServerAdvertisement = (NetworkResourceAdvertisement) AdvertisementFactory.newAdvertisement(NetworkResourceAdvertisement.getAdvertisementType());
mStunRtpServerAdvertisement.setAddress("udp://"+mConfig.getAudioVideoPublicSocketAddress().getAddress().getHostAddress()+":"+mConfig.getAudioVideoPublicSocketAddress().getPort());
mStunRtpServerAdvertisement.setID(IDFactory.newCodatID(mJxtaNetworkManager.getPeerGroup().getPeerGroupID(), mStunRtpServerAdvertisement.getAddress().toString().getBytes()));
mStunRtpServerAdvertisement.setID(IDFactory.newCodatID(mJxtaNetworkManager.getPeerGroup().getPeerGroupID()/*, mStunRtpServerAdvertisement.getAddress().getBytes("US-ASCII")*/));
mStunRtpServerAdvertisement.setName(ADV_NAME);
mJxtaNetworkManager.getPeerGroup().getDiscoveryService().publish(mStunRtpServerAdvertisement,ADV_LIFE_TIME,ADV_LIFE_TIME/2);
mLog.info(mStunRtpServerAdvertisement + "published");
......
package org.linphone.p2pproxy.core.media;
import org.linphone.p2pproxy.api.P2pProxyException;
public class MediaResoureUnreachableException extends P2pProxyException {
private String mRourceAddress;
public MediaResoureUnreachableException() {
super();
// TODO Auto-generated constructor stub
}
public MediaResoureUnreachableException(String arg0, Throwable arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
public MediaResoureUnreachableException(String arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public MediaResoureUnreachableException(Throwable arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public void setRourceAddress(String anAddress) {
mRourceAddress = anAddress;
}
public String getResourceAddress() {
return mRourceAddress;
}
}
/*
p2pproxy Copyright (C) 2007 Jehan Monnier ()
UdpRelayService.java - .
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.p2pproxy.core.media.rtprelay;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.linphone.p2pproxy.api.P2pProxyException;
import org.linphone.p2pproxy.core.Configurator;
import org.linphone.p2pproxy.core.GenericService;
import org.linphone.p2pproxy.core.GenericUdpSession;
import org.linphone.p2pproxy.core.JxtaNetworkManager;
import org.linphone.p2pproxy.core.ServiceProvider;
public class RtpRelayService implements ServiceProvider{
private final static Logger mLog = Logger.getLogger(RtpRelayService.class);
private final RtpRelayServer mRtpRelayServer;
public final static String AUDIO_VIDEO_LOCAL_PORT="org.linphone.p2pproxy.udp-media-relay.audio-video.port";
public final static String AUDIO_VIDEO_PUBLIC_URI="org.linphone.p2pproxy.udp-media-relay.audio-video.public-uri";
private final static String SRV_NAME = "RTPRELAY";
public final static String ADV_NAME = "JXTASPEC:LINPHONE-"+SRV_NAME;
//
private final RtpRelayServerConfig mConfig;
private final GenericService mGenericService;
private final GenericUdpSession mGenericUdpSession;
private class SocketHandlerFactory implements GenericService.ServiceSocketHandlerFactory {
public Runnable create(final Socket socket) {
return new Runnable() {
public void run() {
try {
ObjectOutputStream lOut = new ObjectOutputStream(socket.getOutputStream());
//work around to unlock the socket
lOut.writeBoolean(true);
lOut.flush();
ObjectInputStream lIn = new ObjectInputStream(socket.getInputStream());
Object lInputObj;
boolean lStop = false;
while (lStop == false) {
lInputObj = lIn.readObject();
mLog.info("request message ["+lInputObj+"] received");
if (lInputObj instanceof AddressRequest) {
Map<MediaType,InetSocketAddress> lList = new HashMap<MediaType,InetSocketAddress>();
lList.put(MediaType.audio, mConfig.getAudioVideoPublicSocketAddress());
lList.put(MediaType.video, mConfig.getAudioVideoPublicSocketAddress());
AddressResponse lAddressResponse = new AddressResponse(lList);
lOut.writeObject(lAddressResponse);
lOut.flush();
} else {
mLog.error("unknown request ["+lInputObj+"]");
}
lStop = true;
}
} catch (Exception e) {
mLog.error("socket instance error",e);
}
finally {
try {
socket.close();
} catch (IOException e) {
mLog.error("cannot close socket ",e);
}
}
}
};
}
}
/**
* @param properties mandatory parameter are:
* {@link AUDIO_LOCAL_PORT} ,{@link AUDIO_PUBLIC_URI} , {@link VIDEO_LOCAL_PORT}, {@link VIDEO_PUBLIC_URI}
* @param jxtaNetworkManager
* @param serviceName
* @param serviceSocketHandlerFactory
* @throws SocketException
* @throws UnknownHostException
*/
public RtpRelayService(RtpRelayServerConfig aConfig,Configurator properties, JxtaNetworkManager jxtaNetworkManager) throws SocketException, UnknownHostException {
mGenericService = new GenericService(properties, jxtaNetworkManager,SRV_NAME ,new SocketHandlerFactory());
mConfig = aConfig;
mGenericUdpSession = new GenericUdpSession(mConfig.getAudioVideoPrivateSocketAddress());
mRtpRelayServer = new RtpRelayServer(mGenericUdpSession.getSocket());
mGenericUdpSession.addMessageHandler(mRtpRelayServer);
mLog.info("UdpRelayService created "+this);
}
public String toString() {
return mRtpRelayServer +" public address ["+mConfig.getAudioVideoPublicSocketAddress()+"] private address address ["+mConfig.getAudioVideoPrivateSocketAddress()+"]";
}
public void start(long timeOut) throws P2pProxyException {
mGenericService.start(timeOut);
}
public void stop() {
mGenericUdpSession.close();
mGenericService.stop();
}
public static String getDefaultAudioVideoPublicUri() throws UnknownHostException {
return "udp://"+InetAddress.getLocalHost().getHostAddress()+":16000";
}
}
package org.linphone.p2pproxy.core.media.rtprelay;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Map;
import org.apache.log4j.Logger;
import org.linphone.p2pproxy.api.P2pProxyException;
import org.linphone.p2pproxy.core.Configurator;
import org.linphone.p2pproxy.core.GenericServiceClient;
import org.linphone.p2pproxy.core.JxtaNetworkManager;
public class RtpRelayServiceClient extends GenericServiceClient {
private final static Logger mLog = Logger.getLogger(RtpRelayServiceClient.class);
public RtpRelayServiceClient(Configurator aProperties,JxtaNetworkManager aJxtaNetworkManager) throws SocketException, UnknownHostException {
super (aProperties,aJxtaNetworkManager,RtpRelayService.ADV_NAME);
}
public void stop() {
super.stop();
}
public Map<MediaType, InetSocketAddress> getAddresses() throws P2pProxyException {
try {
checkObject();
checkSocketConnection();
AddressRequest lAddressRequest = new AddressRequest();
mOut.writeObject(lAddressRequest);
mOut.flush();
mLog.info("request message ["+lAddressRequest+"] sent");
Object lInputObj = mIn.readObject();
mLog.info("response message ["+lInputObj+"] received");
if(lInputObj instanceof AddressResponse) {
AddressResponse lAddressResponse = (AddressResponse)lInputObj;
if (mLog.isDebugEnabled()) mLog.debug("receiving relay address ["+lAddressResponse.toString()+"]");
return lAddressResponse.getAddressTable();
} else {
throw new P2pProxyException("unknown response ["+lInputObj+"]");
}
} catch(Exception e) {
throw new P2pProxyException(e);
}
}
}
......@@ -39,7 +39,8 @@ import org.linphone.p2pproxy.api.P2pProxyNetworkProbe;
import org.linphone.p2pproxy.core.Configurator;
import org.linphone.p2pproxy.core.JxtaNetworkManager;
import org.linphone.p2pproxy.core.ServiceProvider;
import org.linphone.p2pproxy.core.media.rtprelay.RtpRelayService;
import org.linphone.p2pproxy.core.media.MediaResourceService;
public class AutoConfigService implements ServiceProvider {
private final static Logger mLog = Logger.getLogger(AutoConfigService.class);
......@@ -131,7 +132,7 @@ public class AutoConfigService implements ServiceProvider {
}
}
public boolean startUdpProxyIfPossible() {
int lAudioVideoPort = Integer.parseInt(mProperties.getProperty(RtpRelayService.AUDIO_VIDEO_LOCAL_PORT,"16000"));
int lAudioVideoPort = Integer.parseInt(mProperties.getProperty(MediaResourceService.AUDIO_VIDEO_LOCAL_PORT,"16000"));
InetSocketAddress lSocketAddress=null;
try {