realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp
branchRCL_3
changeset 12 c2e8c8b73582
parent 0 307788aac0a8
child 14 532ef74cdfa0
equal deleted inserted replaced
10:dc4cddf5f2f8 12:c2e8c8b73582
   438 		
   438 		
   439 	if (iProfile &&
   439 	if (iProfile &&
   440 	    AgentObserver().ProceedRegistration(*iProfile, aError) &&
   440 	    AgentObserver().ProceedRegistration(*iProfile, aError) &&
   441 	    (CurrentState() == MSIPProfileContext::ERegistrationInProgress ||
   441 	    (CurrentState() == MSIPProfileContext::ERegistrationInProgress ||
   442 	     CurrentState() == MSIPProfileContext::ERegistered) &&
   442 	     CurrentState() == MSIPProfileContext::ERegistered) &&
   443 		(aError == KErrSIPOutboundProxyNotResponding || 
   443 		(aError == K408TimeOut ||
       
   444 		 aError == K500ServerInternalError ||
       
   445 		 aError == KErrSIPOutboundProxyNotResponding || 
   444 		 aError == KErrSIPResolvingFailure || 
   446 		 aError == KErrSIPResolvingFailure || 
   445 		 aError == KErrTimedOut || 
   447 		 aError == KErrTimedOut || 
   446 		 aError == KErrSIPTransportFailure ||
   448 		 aError == KErrSIPTransportFailure ||
   447 		 aError == KErrSIPICMPFailure  && 
   449 		 aError == KErrSIPICMPFailure  && 
   448 		 iConnection.State() != CSIPConnection::ESuspended))		
   450 		 iConnection.State() != CSIPConnection::ESuspended))		
   488 // -----------------------------------------------------------------------------
   490 // -----------------------------------------------------------------------------
   489 //	
   491 //	
   490 TBool CSIPIetfProfileContext::ShouldRetryRegistration( TInt aError )
   492 TBool CSIPIetfProfileContext::ShouldRetryRegistration( TInt aError )
   491 	{
   493 	{
   492 	return (aError == K503ServiceUnavailable || 
   494 	return (aError == K503ServiceUnavailable || 
       
   495 	        aError == K408TimeOut ||
       
   496 	        aError == K500ServerInternalError ||
   493 		    aError == KErrSIPOutboundProxyNotResponding || 
   497 		    aError == KErrSIPOutboundProxyNotResponding || 
   494 		    aError == KErrTimedOut ||
   498 		    aError == KErrTimedOut ||
   495 		    ((aError == KErrSIPResolvingFailure || 
   499 		    ((aError == KErrSIPResolvingFailure || 
   496 		      aError == KErrSIPTransportFailure ||
   500 		      aError == KErrSIPTransportFailure ||
   497 		      aError == KErrSIPICMPFailure) && 
   501 		      aError == KErrSIPICMPFailure) && 
   546 // CSIPIetfProfileContext::IncomingResponse()
   550 // CSIPIetfProfileContext::IncomingResponse()
   547 // (other items were commented in a header).
   551 // (other items were commented in a header).
   548 // -----------------------------------------------------------------------------
   552 // -----------------------------------------------------------------------------
   549 //
   553 //
   550 void CSIPIetfProfileContext::IncomingResponse(
   554 void CSIPIetfProfileContext::IncomingResponse(
   551 	CSIPClientTransaction& aTransaction,
   555     CSIPClientTransaction& aTransaction,
   552 	CSIPRegistrationBinding& aRegistration,
   556     CSIPRegistrationBinding& aRegistration,
   553 	TBool& aHandled)
   557     TBool& aHandled)
   554 	{
   558     {
   555 	if (iClientTx && iRegistration && 
   559     if (iClientTx && iRegistration && 
   556 		aTransaction==*iClientTx && aRegistration==*iRegistration)
   560         aTransaction==*iClientTx && aRegistration==*iRegistration)
   557 		{
   561         {
   558 		PROFILE_DEBUG3("SIPIetfProfileContext::IncomingResponse", ProfileId())
   562         PROFILE_DEBUG3("SIPIetfProfileContext::IncomingResponse", ProfileId())
   559 		aHandled = ETrue;
   563         aHandled = ETrue;
   560 		const CSIPResponseElements* response = aTransaction.ResponseElements();
   564         const CSIPResponseElements* response = aTransaction.ResponseElements();
   561 		if (response)
   565         TUint responseCode = response->StatusCode();
   562 		    {
   566         TBool retry = EFalse;
   563 		    TUint responseCode = response->StatusCode();
   567         if (response)
   564 		    if (responseCode >= K300MultipleChoices)
   568             {
   565 		        {
   569                 retry = RetryRegister( &aTransaction,  responseCode);
   566 		        PROFILE_DEBUG1("IETFProfileContext: registration failed")
   570                 if( retry )
   567                 RetryPossible(responseCode);
   571                 {
   568 		        }
   572                 iCurrentState->ErrorOccured(*this, responseCode);
   569 		    else
   573                 }
   570 		        {
   574                 else
   571 			    if (responseCode >= K200Ok)
   575                 {
   572 				    {
   576                     if (responseCode >= K300MultipleChoices)
   573 				    PROFILE_DEBUG1("IETFProfileContext: registration complete")
   577                     {
   574 				    iRetryCounter = 0;
   578                     PROFILE_DEBUG1("IETFProfileContext: registration failed")
   575 				    iRetryCounterSum = 0;
   579                     RetryPossible(responseCode);
   576 				    Received2XXRegisterResponse();
   580                     }
   577 		            }
   581                     else
   578 		        }
   582                     {
   579 		    }
   583                         if (responseCode >= K200Ok)
   580         iCurrentState->ResponseReceived(*this, aTransaction);
   584                         {
   581 		}
   585                         PROFILE_DEBUG1("IETFProfileContext: registration complete")
   582 	}
   586                         iRetryCounter = 0;
       
   587                         iRetryCounterSum = 0;
       
   588                         Received2XXRegisterResponse();
       
   589                         }
       
   590                     }
       
   591                 }
       
   592             }
       
   593         
       
   594             if( retry )
       
   595             {
       
   596             iCurrentState->ErrorOccured(*this, responseCode);
       
   597             }
       
   598             else
       
   599             {
       
   600             iCurrentState->ResponseReceived(*this, aTransaction);
       
   601             }
       
   602         }
       
   603     }
   583 
   604 
   584 // -----------------------------------------------------------------------------
   605 // -----------------------------------------------------------------------------
   585 // CSIPIetfProfileContext::RandomPercent()
   606 // CSIPIetfProfileContext::RandomPercent()
   586 // (other items were commented in a header).
   607 // (other items were commented in a header).
   587 // -----------------------------------------------------------------------------
   608 // -----------------------------------------------------------------------------