From 76fbbf985a9b8898f37083bf7eebde0543cf6ae5 Mon Sep 17 00:00:00 2001 From: jehan Date: Thu, 18 Sep 2008 15:02:59 +0000 Subject: [PATCH] fix compilation issue git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@25 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- .../media/jxtaudpproxy/SdpProcessorImpl.java | 2 +- .../core/sipproxy/SipProxyRegistrar.java | 16 +++++++++------- .../superpeers/JxtaNetworkResources.java | 5 +++-- .../core/sipproxy/superpeers/SuperPeerProxy.java | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/p2pproxy/src/org/linphone/p2pproxy/core/media/jxtaudpproxy/SdpProcessorImpl.java b/p2pproxy/src/org/linphone/p2pproxy/core/media/jxtaudpproxy/SdpProcessorImpl.java index 955bddbe0..36da0dc28 100644 --- a/p2pproxy/src/org/linphone/p2pproxy/core/media/jxtaudpproxy/SdpProcessorImpl.java +++ b/p2pproxy/src/org/linphone/p2pproxy/core/media/jxtaudpproxy/SdpProcessorImpl.java @@ -166,7 +166,7 @@ public class SdpProcessorImpl implements SdpProcessor { RtpSessionImpl lRtpSession = null; if (((NetworkResources) lRegistration.NetResources).hasRtpSession(lMLineName) == false) { // first time, just create - int lPortStart = Integer.parseInt(mProperties.getProperty(SipProxyRegistrar.UDP_MEDIA_RELAY_PORT_START, "15000")); + int lPortStart = 15000; lRtpSession = new RtpSessionImpl (lPortStart,lMLineName); ((NetworkResources) lRegistration.NetResources).putRtpSession(lMLineName, lRtpSession); } else { diff --git a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java index bc2052608..2544bface 100644 --- a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java +++ b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java @@ -50,6 +50,7 @@ import org.linphone.p2pproxy.core.P2pProxyAccountManagementMBean; import org.linphone.p2pproxy.core.P2pProxyAdvertisementNotFoundException; import org.linphone.p2pproxy.core.media.rtprelay.MediaType; import org.linphone.p2pproxy.core.media.rtprelay.SdpProcessorImpl; +import org.linphone.p2pproxy.core.sipproxy.superpeers.SuperPeerProxy; import org.zoolu.sip.address.NameAddress; import org.zoolu.sip.address.SipURL; import org.zoolu.sip.header.ExpiresHeader; @@ -67,9 +68,8 @@ import org.zoolu.sip.transaction.TransactionServer; public class SipProxyRegistrar implements SipProviderListener,SipProxyRegistrarMBean { private final static Logger mLog = Logger.getLogger(SipProxyRegistrar.class); public final static String REGISTRAR_PORT="org.linphone.p2pproxy.SipListener.registrar.port"; - public final static String UDP_PORT_BEGING="org.linphone.p2pproxy.udp.port.begin"; - public final static String UDP_MEDIA_RELAY_PORT_START="org.linphone.p2pproxy.udp-media-relay.port.start"; - + public final static String REGISTRAR_PUBLIC_ADDRESS="org.linphone.p2pproxy.SipListener.registrar.public.address"; + // private final SipProvider mProvider; private final JxtaNetworkManager mJxtaNetworkManager; @@ -80,6 +80,7 @@ public class SipProxyRegistrar implements SipProviderListener,SipProxyRegistrarM private final P2pProxyAccountManagementMBean mP2pProxyAccountManagement; private final Configurator mProperties; + private final SuperPeerProxy mSuperPeerProxy; //private long mNumberOfEstablishedCall; private long mNumberOfRefusedRegistration; @@ -178,12 +179,13 @@ public class SipProxyRegistrar implements SipProviderListener,SipProxyRegistrarM mProperties = lProperties; File lFile = new File(SipStack.log_path); if (lFile.exists() == false) lFile.mkdir(); + String lViaAddress = lProperties.getProperty(REGISTRAR_PUBLIC_ADDRESS); int lPort = Integer.parseInt(lProperties.getProperty(REGISTRAR_PORT, "5060")); String[] lProto = {SipProvider.PROTO_UDP}; - mProvider=new SipProvider(null,lPort,lProto,SipProvider.ALL_INTERFACES); + mProvider=new SipProvider(lViaAddress,lPort,lProto,SipProvider.ALL_INTERFACES); mProvider.addSipProviderListener(SipProvider.PROMISQUE,this); mPool = Executors.newCachedThreadPool(); - + mSuperPeerProxy = new SuperPeerProxy(aJxtaNetworkManager, "sip:"+mProvider.getViaAddress()+":"+mProvider.getPort()); } public synchronized void onReceivedMessage(SipProvider aProvider, Message aMessage) { @@ -272,7 +274,7 @@ public class SipProxyRegistrar implements SipProviderListener,SipProxyRegistrarM lTransactionServer.respondWith(lresp); } - private void updateRegistration(Registration aRegistration, Message aRegistrationMessage) throws IOException { + private void updateRegistration(Registration aRegistration, Message aRegistrationMessage) throws P2pProxyException { aRegistration.RegistrationDate = System.currentTimeMillis(); // default registration period aRegistration.Expiration = 3600000; @@ -280,7 +282,7 @@ public class SipProxyRegistrar implements SipProviderListener,SipProxyRegistrarM aRegistration.Expiration = aRegistrationMessage.getExpiresHeader().getDeltaSeconds()*1000; } - //TODO handle registration + mSuperPeerProxy.updateRegistration(aRegistration, aRegistrationMessage); } diff --git a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/JxtaNetworkResources.java b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/JxtaNetworkResources.java index c78c3403d..35cab917e 100644 --- a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/JxtaNetworkResources.java +++ b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/JxtaNetworkResources.java @@ -29,7 +29,7 @@ import org.apache.log4j.Logger; import org.linphone.p2pproxy.api.P2pProxyException; import org.linphone.p2pproxy.core.JxtaNetworkManager; import org.linphone.p2pproxy.core.P2pUserProfileAdvertisement; -import org.zoolu.sip.address.SipURL; + public class JxtaNetworkResources { private final JxtaNetworkManager mJxtaNetworkManager; @@ -43,6 +43,7 @@ public class JxtaNetworkResources { mP2pUserRegistrationAdvertisement.setID(IDFactory.newCodatID(mJxtaNetworkManager.getPeerGroup().getPeerGroupID(), aUserName.toString().getBytes())); mP2pUserRegistrationAdvertisement.setUserName(aUserName.toString()); mP2pUserRegistrationAdvertisement.setRegistrarAddress(aRegistrarAddress.toString()); + mLog.info("creating network resource for user ["+aUserName+"] on registrar ["+aRegistrarAddress+"]"); } void publish(long aLiveTime) throws P2pProxyException { @@ -57,7 +58,7 @@ public class JxtaNetworkResources { } catch (IOException e1) { throw new P2pProxyException(e1); } - mLog.debug("publishing P2pUserRegistration Advertisement published expire ["+aLiveTime+"]"); + mLog.debug("publishing P2pUserRegistration Advertisement ["+mP2pUserRegistrationAdvertisement+"]published expire ["+aLiveTime+"]"); } } diff --git a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java index e8228096e..eef3cd16a 100644 --- a/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java +++ b/p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java @@ -32,7 +32,7 @@ public class SuperPeerProxy implements SipProxy, RegistrationHandler { private final JxtaNetworkManager mJxtaNetworkManager; private final String mRegistrarAddress; - SuperPeerProxy(JxtaNetworkManager aJxtaNetworkManager, String aRegistrarAddress) { + public SuperPeerProxy(JxtaNetworkManager aJxtaNetworkManager, String aRegistrarAddress) { mJxtaNetworkManager = aJxtaNetworkManager; mRegistrarAddress = aRegistrarAddress; }