multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp
branchRCL_3
changeset 17 b9d283c5c7b5
parent 13 fb1bbf85a302
child 19 3f7c7e6eea8a
equal deleted inserted replaced
15:f40c1a748eb9 17:b9d283c5c7b5
    42 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    43 // CMceStateOffering::CMceStateOffering
    43 // CMceStateOffering::CMceStateOffering
    44 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    45 //
    45 //
    46 CMceStateOffering::CMceStateOffering ()
    46 CMceStateOffering::CMceStateOffering ()
    47     : CMceState( KMceStateOffering )
    47     : CMceState( KMceStateOffering ),
       
    48       iLastResponse ( 0 ),
       
    49 	  iReadyToSendACK ( ETrue )
    48 	{
    50 	{
    49 	}
    51 	}
    50 
    52 
    51 
    53 
    52 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
   263     TMceStateTransitionEvent& aEvent )
   265     TMceStateTransitionEvent& aEvent )
   264     {
   266     {
   265     TInt status = KErrNone;
   267     TInt status = KErrNone;
   266     CMceSipSession& session = aEvent.Session();
   268     CMceSipSession& session = aEvent.Session();
   267     CSIPClientTransaction& response = session.Response();
   269     CSIPClientTransaction& response = session.Response();
       
   270     iLastResponse = MceSip::ResponseCode( response );
   268      
   271      
   269     session.Extensions().UpdateL( response );
   272     session.Extensions().UpdateL( response );
   270     session.Actions().CheckContactIsSecureL( response );
   273     session.Actions().CheckContactIsSecureL( response );
   271 
   274 
   272     session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeIntermediate;
   275     session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeIntermediate;
   438 void CMceStateOffering::EntryResponseL( TMceStateTransitionEvent& aEvent )
   441 void CMceStateOffering::EntryResponseL( TMceStateTransitionEvent& aEvent )
   439     {
   442     {
   440     TInt status = KErrNone;
   443     TInt status = KErrNone;
   441 	CMceSipSession& session = aEvent.Session();
   444 	CMceSipSession& session = aEvent.Session();
   442     CMceSipSession::TSubState subState = session.SubState();
   445     CMceSipSession::TSubState subState = session.SubState();
       
   446     TInt currentResponse = MceSip::ResponseCode( session.Response() );
   443 	
   447 	
       
   448 	// If media handling is ongoing while 200OK arrives with certain SDP content
       
   449     // don't send ACK thus the UAS will retransmit 200OK untile pervious meida handling
       
   450     // finish.
       
   451  
       
   452     if ( KMceSipRinging == iLastResponse &&
       
   453     	 KMceSipOK == currentResponse && 
       
   454     	 MceSip::HasContent( session.Response() ) )
       
   455     	{
       
   456 		if ( session.WaitingMediaCallback() )
       
   457     		{
       
   458 			iReadyToSendACK = EFalse;
       
   459 			MCESRV_DEBUG("Waiting media callback, do not send ACK for this 200OK")
       
   460     		return;
       
   461     		}
       
   462     	else
       
   463     		{
       
   464 			iReadyToSendACK = ETrue;
       
   465 			MCESRV_DEBUG("Ready to send ACK")
       
   466     		}
       
   467     	}
   444     //send ACK
   468     //send ACK
   445     session.Actions().SendACKL( session.Response() );
   469     session.Actions().SendACKL( session.Response() );
   446 	session.Actions().CheckContactIsSecureL( session.Response() );
   470 	session.Actions().CheckContactIsSecureL( session.Response() );
   447     session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeFinal;
   471     session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeFinal;
   448     
   472     
   449 	// Handle the answer only if the media processing is not
   473     iLastResponse = currentResponse;
   450 	// already ongoing
   474 
   451 	if ( !session.WaitingMediaCallback() )
   475 	if ( !session.WaitingMediaCallback() )
   452 	    {
   476 	    {
   453 	    if ( MceSip::HasContent( session.Response() ) )
   477 	    if ( MceSip::HasContent( session.Response() ) )
   454 	        {
   478 	        {
   455 	        //process session timer
   479 	        //process session timer
   771 // CMceStateOffering::ExitL
   795 // CMceStateOffering::ExitL
   772 // -----------------------------------------------------------------------------
   796 // -----------------------------------------------------------------------------
   773 //
   797 //
   774 void CMceStateOffering::ExitL( TMceStateTransitionEvent& aEvent )
   798 void CMceStateOffering::ExitL( TMceStateTransitionEvent& aEvent )
   775 	{
   799 	{
       
   800 	if ( !iReadyToSendACK )
       
   801 		{
       
   802 		MCESRV_DEBUG("Not ready, don't change any state");
       
   803 		return;
       
   804 		}
   776 	
   805 	
   777 	if ( IsExtensionRequestEvent( aEvent ))
   806 	if ( IsExtensionRequestEvent( aEvent ))
   778 		{
   807 		{
   779 		//Do Nothing;
   808 		//Do Nothing;
   780 		}
   809 		}