Changeset 108:e414f1f14f5a in mediastreamer2


Ignore:
Timestamp:
Oct 21, 2008 10:06:20 PM (5 years ago)
Author:
jehan <jehan@…>
Branch:
default
Message:

debug sip proxy

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@111 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

Location:
p2pproxy
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • p2pproxy/src/org/linphone/p2pproxy/core/P2pProxyMain.java

    r106 r108  
    6262   private static String mConfigHomeDir; 
    6363   static private boolean mExit = false; 
     64   static private boolean isReady = false; 
    6465    
    6566    
     
    280281 
    281282                   mLog.warn("p2pproxy initilized"); 
    282  
     283                   isReady = true; 
    283284                   while (mExit == false) { 
    284285                           Thread.sleep(1000); 
     
    413414private static void isReady() throws P2pProxyNotReadyException { 
    414415    try { 
    415       if ((mJxtaNetworkManager!=null && mJxtaNetworkManager.isConnectedToRendezVous(0) == true)  
     416      if ((isReady == true && mJxtaNetworkManager.isConnectedToRendezVous(0) == true)  
    416417          ||  
    417           (mJxtaNetworkManager!=null && mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) { 
     418          (isReady == true && mJxtaNetworkManager.getPeerGroup().getRendezVousService().isRendezVous())) { 
    418419         //nop connected 
    419420      } else { 
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java

    r107 r108  
    300300         if (mP2pProxyAccountManagement.isValidAccount(lFromName)) { 
    301301         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          
    303304         updateRegistration(lRegistration,aMessage); 
    304305         mRegistrationTab.put(lFromName, lRegistration); 
     
    326327         aRegistration.Expiration =  aRegistrationMessage.getExpiresHeader().getDeltaSeconds()*1000;  
    327328      } 
    328        
     329      aRegistration.Contact = "sip:"+aRegistrationMessage.getRemoteAddress()+":"+aRegistrationMessage.getRemotePort(); 
    329330      mSuperPeerProxy.updateRegistration(aRegistration, aRegistrationMessage);  
    330331   } 
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java

    r70 r108  
    5959           String lTo = aMessage.getToHeader().getNameAddress().getAddress().toString(); 
    6060           SipURL lNextHope = null; 
    61            //check if invite 
    62            if (aMessage.isInvite() || aMessage.isCancel()) { 
     61         
    6362                   //ok need to find the root 
    6463                   //is local ? 
     
    7170                           } 
    7271                   } 
    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                   } 
    7677                    
    77            } else { 
     78           if (lNextHope == null) { 
     79                   // not for us 
    7880                   //just look at route set 
    7981                   MultipleHeader lMultipleRoute = aMessage.getRoutes(); 
     
    8385                   } else { 
    8486                           // last proxy, get route from request uri 
    85                       lNextHope = aMessage.getRequestLine().getAddress(); 
     87                           //check if we know the user 
     88                           lNextHope = aMessage.getRequestLine().getAddress(); 
    8689                   } 
    8790                    
  • p2pproxy/test-src/org/linphone/p2pproxy/test/utils/SipClient.java

    r100 r108  
    142142            String lCalleeUri = aTo; 
    143143            mLog.info("Calling  ["+aTo+"] from ["+mSipIdentity+"]"); 
    144             long lTimout = 75000; 
     144            long lTimout = 30000; 
    145145 
    146146            final Semaphore lCallerSemaphoreAccepted = new Semaphore(0); 
     
    219219            String lCalleeUri = aTo; 
    220220            mLog.info("Calling  ["+aTo+"] from ["+mSipIdentity+"]"); 
    221             long lTimout = 75000; 
     221            long lTimout = 30000; 
    222222 
    223223            final Semaphore lCallerSemaphoreAccepted = new Semaphore(0); 
     
    229229                  call.ackWithAnswer(sdp); 
    230230              } 
    231               public void onCallClosing(Call call, Message bye) { 
    232                   //nop 
    233               } 
     231 
    234232                public void onCallRinging(Call call, Message resp) { 
    235233                    lCallerSemaphoreRinging.release(); 
     234                } 
     235                public void onCallClosed(Call call, Message resp) { 
     236                        lCalleeSemaphoreClosed.release(); 
    236237                } 
    237238            }; 
     
    251252                        lCaller.bye(); 
    252253 
    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    
    255256            mLog.info("Call ok"); 
    256257            return lCaller; 
     
    272273               call.accept(sdp); 
    273274           } 
    274          public void onCallClosed(Call call, Message resp) { 
    275              //nop 
    276          } 
     275           public void onCallClosing(Call call, Message bye) { 
     276               //nop 
     277           } 
    277278       }; 
    278279       Call  lCallee = new Call(mProvider, mSipIdentity, getContact(mProvider), lCalleeListener); 
  • p2pproxy/test-src/org/linphone/p2pproxy/test/utils/UserInstance.java

    r106 r108  
    2323import java.io.File; 
    2424import java.net.DatagramSocket; 
     25import java.net.InetAddress; 
    2526import java.net.URI; 
    2627import java.util.Timer; 
     
    7677        File lFile = new File(SipStack.log_path); 
    7778    if (lFile.exists() == false) lFile.mkdir(); 
    78         mProvider=new SipProvider(null,lSipPort); 
     79    //InetAddress[] lAddresses = InetAddress.getAllByName("localhost"); 
     80    mProvider=new SipProvider(null,lSipPort); 
    7981        mSipClient = new SipClient(mProvider,userName,30000); 
    8082         class RegistrarTimerTask extends  TimerTask { 
     
    8385                        try { 
    8486                        // 1 get proxy address 
    85                         String lProxyUri = P2pProxyMain.lookupSipProxyUri(P2pProxyResourceManagement.DOMAINE); 
     87                        URI lProxyUri = URI.create(P2pProxyMain.lookupSipProxyUri(P2pProxyResourceManagement.DOMAINE)); 
    8688                        if (lProxyUri == null) { 
    8789                                 System.out.println("cannot find registrar"); 
     
    8991                        } 
    9092                        //2 setOutbound proxy 
    91                         mProvider.setOutboundProxy(new SocketAddress(lProxyUri)); 
     93                        mProvider.setOutboundProxy(new SocketAddress(lProxyUri.getRawSchemeSpecificPart())); 
    9294                        mSipClient.register(REGISTRATION_PERIOD,userName); 
    9395                        mIsRegistered = true; 
     
    9597                                mLog.error("cannot register user["+userName+"]",e); 
    9698                        } finally { 
    97                                 mTimer.schedule(new  RegistrarTimerTask(), REGISTRATION_PERIOD-REGISTRATION_PERIOD/10); 
     99                                mTimer.schedule(new  RegistrarTimerTask(), 1000 *(REGISTRATION_PERIOD-REGISTRATION_PERIOD/10)); 
    98100                        } 
    99101                } 
     
    111113public static void main(String[] args) throws P2pProxyException { 
    112114        String lFrom=null, lTo=null; 
    113         int lDuration = 10, lLoop=1; 
     115        int lDuration = 10, lLoop=0; 
    114116        for (int i=0; i < args.length; i=i+2) {   
    115117                   String argument = args[i]; 
Note: See TracChangeset for help on using the changeset viewer.