Changeset 108:e414f1f14f5a in mediastreamer2
- Timestamp:
- Oct 21, 2008 10:06:20 PM (5 years ago)
- Branch:
- default
- Location:
- p2pproxy
- Files:
-
- 1 added
- 5 edited
-
launcher/.cdtproject (added)
-
src/org/linphone/p2pproxy/core/P2pProxyMain.java (modified) (3 diffs)
-
src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java (modified) (2 diffs)
-
src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java (modified) (3 diffs)
-
test-src/org/linphone/p2pproxy/test/utils/SipClient.java (modified) (5 diffs)
-
test-src/org/linphone/p2pproxy/test/utils/UserInstance.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
p2pproxy/src/org/linphone/p2pproxy/core/P2pProxyMain.java
r106 r108 62 62 private static String mConfigHomeDir; 63 63 static private boolean mExit = false; 64 static private boolean isReady = false; 64 65 65 66 … … 280 281 281 282 mLog.warn("p2pproxy initilized"); 282 283 isReady = true; 283 284 while (mExit == false) { 284 285 Thread.sleep(1000); … … 413 414 private static void isReady() throws P2pProxyNotReadyException { 414 415 try { 415 if (( mJxtaNetworkManager!=null&& mJxtaNetworkManager.isConnectedToRendezVous(0) == true)416 if ((isReady == true && mJxtaNetworkManager.isConnectedToRendezVous(0) == true) 416 417 || 417 ( mJxtaNetworkManager!=null&& mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) {418 (isReady == true && mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) { 418 419 //nop connected 419 420 } else { -
p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java
r107 r108 300 300 if (mP2pProxyAccountManagement.isValidAccount(lFromName)) { 301 301 lRegistration = new Registration(lFromName); 302 lRegistration.Contact = aMessage.getContactHeader().getNameAddress().getAddress().toString();; 302 // forgot contact, use rport lRegistration.Contact = aMessage.getContactHeader().getNameAddress().getAddress().toString();; 303 303 304 updateRegistration(lRegistration,aMessage); 304 305 mRegistrationTab.put(lFromName, lRegistration); … … 326 327 aRegistration.Expiration = aRegistrationMessage.getExpiresHeader().getDeltaSeconds()*1000; 327 328 } 328 329 aRegistration.Contact = "sip:"+aRegistrationMessage.getRemoteAddress()+":"+aRegistrationMessage.getRemotePort(); 329 330 mSuperPeerProxy.updateRegistration(aRegistration, aRegistrationMessage); 330 331 } -
p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java
r70 r108 59 59 String lTo = aMessage.getToHeader().getNameAddress().getAddress().toString(); 60 60 SipURL lNextHope = null; 61 //check if invite 62 if (aMessage.isInvite() || aMessage.isCancel()) { 61 63 62 //ok need to find the root 64 63 //is local ? … … 71 70 } 72 71 } 73 // add recordRoute 74 SipUtils.addRecordRoute(aProvider,aMessage); 75 72 if (aMessage.isInvite() || aMessage.isCancel()) { 73 //check if invite 74 // add recordRoute 75 SipUtils.addRecordRoute(aProvider,aMessage); 76 } 76 77 77 } else { 78 if (lNextHope == null) { 79 // not for us 78 80 //just look at route set 79 81 MultipleHeader lMultipleRoute = aMessage.getRoutes(); … … 83 85 } else { 84 86 // last proxy, get route from request uri 85 lNextHope = aMessage.getRequestLine().getAddress(); 87 //check if we know the user 88 lNextHope = aMessage.getRequestLine().getAddress(); 86 89 } 87 90 -
p2pproxy/test-src/org/linphone/p2pproxy/test/utils/SipClient.java
r100 r108 142 142 String lCalleeUri = aTo; 143 143 mLog.info("Calling ["+aTo+"] from ["+mSipIdentity+"]"); 144 long lTimout = 75000;144 long lTimout = 30000; 145 145 146 146 final Semaphore lCallerSemaphoreAccepted = new Semaphore(0); … … 219 219 String lCalleeUri = aTo; 220 220 mLog.info("Calling ["+aTo+"] from ["+mSipIdentity+"]"); 221 long lTimout = 75000;221 long lTimout = 30000; 222 222 223 223 final Semaphore lCallerSemaphoreAccepted = new Semaphore(0); … … 229 229 call.ackWithAnswer(sdp); 230 230 } 231 public void onCallClosing(Call call, Message bye) { 232 //nop 233 } 231 234 232 public void onCallRinging(Call call, Message resp) { 235 233 lCallerSemaphoreRinging.release(); 234 } 235 public void onCallClosed(Call call, Message resp) { 236 lCalleeSemaphoreClosed.release(); 236 237 } 237 238 }; … … 251 252 lCaller.bye(); 252 253 253 Assert.assertTrue("caller call not closed until ["+ lTimout+"]", lCalleeSemaphoreClosed.tryAcquire(lTimout,TimeUnit.MILLISECONDS));254 254 Assert.assertTrue("caller call not closed until ["+aCallDuration + aCallDuration/10+"]", lCalleeSemaphoreClosed.tryAcquire(aCallDuration + aCallDuration/10,TimeUnit.MILLISECONDS)); 255 255 256 mLog.info("Call ok"); 256 257 return lCaller; … … 272 273 call.accept(sdp); 273 274 } 274 public void onCallClosed(Call call, Message resp) {275 //nop276 }275 public void onCallClosing(Call call, Message bye) { 276 //nop 277 } 277 278 }; 278 279 Call lCallee = new Call(mProvider, mSipIdentity, getContact(mProvider), lCalleeListener); -
p2pproxy/test-src/org/linphone/p2pproxy/test/utils/UserInstance.java
r106 r108 23 23 import java.io.File; 24 24 import java.net.DatagramSocket; 25 import java.net.InetAddress; 25 26 import java.net.URI; 26 27 import java.util.Timer; … … 76 77 File lFile = new File(SipStack.log_path); 77 78 if (lFile.exists() == false) lFile.mkdir(); 78 mProvider=new SipProvider(null,lSipPort); 79 //InetAddress[] lAddresses = InetAddress.getAllByName("localhost"); 80 mProvider=new SipProvider(null,lSipPort); 79 81 mSipClient = new SipClient(mProvider,userName,30000); 80 82 class RegistrarTimerTask extends TimerTask { … … 83 85 try { 84 86 // 1 get proxy address 85 String lProxyUri = P2pProxyMain.lookupSipProxyUri(P2pProxyResourceManagement.DOMAINE);87 URI lProxyUri = URI.create(P2pProxyMain.lookupSipProxyUri(P2pProxyResourceManagement.DOMAINE)); 86 88 if (lProxyUri == null) { 87 89 System.out.println("cannot find registrar"); … … 89 91 } 90 92 //2 setOutbound proxy 91 mProvider.setOutboundProxy(new SocketAddress(lProxyUri ));93 mProvider.setOutboundProxy(new SocketAddress(lProxyUri.getRawSchemeSpecificPart())); 92 94 mSipClient.register(REGISTRATION_PERIOD,userName); 93 95 mIsRegistered = true; … … 95 97 mLog.error("cannot register user["+userName+"]",e); 96 98 } finally { 97 mTimer.schedule(new RegistrarTimerTask(), REGISTRATION_PERIOD-REGISTRATION_PERIOD/10);99 mTimer.schedule(new RegistrarTimerTask(), 1000 *(REGISTRATION_PERIOD-REGISTRATION_PERIOD/10)); 98 100 } 99 101 } … … 111 113 public static void main(String[] args) throws P2pProxyException { 112 114 String lFrom=null, lTo=null; 113 int lDuration = 10, lLoop= 1;115 int lDuration = 10, lLoop=0; 114 116 for (int i=0; i < args.length; i=i+2) { 115 117 String argument = args[i];
Note: See TracChangeset
for help on using the changeset viewer.
