multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp
changeset 22 b6d70b04aa2d
parent 12 966b25fd74b5
child 49 64c62431ac08
equal deleted inserted replaced
21:b7fa3d2db8f4 22:b6d70b04aa2d
    93             iOOldSchool( 0 ),
    93             iOOldSchool( 0 ),
    94             iIOldSchool( 0 ),
    94             iIOldSchool( 0 ),
    95             iOOldSchoolProceeding( 0 ),
    95             iOOldSchoolProceeding( 0 ),
    96             iOOldSchoolCompleted( 0 ),
    96             iOOldSchoolCompleted( 0 ),
    97             iIsMaster( ETrue ),
    97             iIsMaster( ETrue ),
    98             iOldLocalMediaPort( 0 )
    98             iOldLocalMediaPort( 0 ),
       
    99             iStoreRemoteOrigin ( ETrue )
    99     {
   100     {
   100     iSessionId = GetRandomNumber();
   101     iSessionId = GetRandomNumber();
   101     iSessionVersion = GetRandomNumber();
   102     iSessionVersion = GetRandomNumber();
   102     iIsSignallingRequired = KMceNoSignalling;
   103     iIsSignallingRequired = KMceNoSignalling;
   103     }
   104     }
   506         {
   507         {
   507         MCEMM_DEBUG("CMceSdpSession::DecodeOfferL(), ERROR: No media lines")
   508         MCEMM_DEBUG("CMceSdpSession::DecodeOfferL(), ERROR: No media lines")
   508         MCEMM_DEBUG("CMceSdpSession::DecodeOfferL(), Exit ")
   509         MCEMM_DEBUG("CMceSdpSession::DecodeOfferL(), Exit ")
   509         return KMceSipWarnIncompatibleMediaFormat;
   510         return KMceSipWarnIncompatibleMediaFormat;
   510         }
   511         }
   511         
   512     
   512     // store the remote o= field
   513     //avoid to store the value second time when in nat environment
   513     StoreRemoteOriginL();
   514     if ( iStoreRemoteOrigin )
   514     // store the remote a= field
   515         {
   515     StoreRemoteMediaFieldsL();
   516         // store the remote o= field
       
   517         StoreRemoteOriginL();
       
   518         // store the remote a= field
       
   519         StoreRemoteMediaFieldsL();
       
   520         }
   516     //set remote ip address
   521     //set remote ip address
   517     result = SetRemoteIpAddressL( aSession, aSdpDocument );
   522     result = SetRemoteIpAddressL( aSession, aSdpDocument );
   518     
   523     
   519     if ( result != KErrNone )
   524     if ( result != KErrNone )
   520         {
   525         {
   919         
   924         
   920     // get the remote ip address
   925     // get the remote ip address
   921     CSdpConnectionField* connfield = aSdpDocument.ConnectionField();
   926     CSdpConnectionField* connfield = aSdpDocument.ConnectionField();
   922     const TInetAddr* inetAddr = NULL;
   927     const TInetAddr* inetAddr = NULL;
   923     
   928     
   924     if( connfield )
   929     // find "c-" line from media level
       
   930     TInt index = 0;
       
   931     TBool found = ETrue;
       
   932     while( found && index < mediaLines.Count() )
       
   933         {
       
   934         RPointerArray<CSdpConnectionField>& connfields = 
       
   935                                             mediaLines[index]->ConnectionFields();
       
   936         
       
   937         if ( mediaLines[index++]->Port() > 0 )
       
   938             {
       
   939             TInt cfindex = 0;
       
   940 	        TBool cffound = EFalse;
       
   941 	        while( !cffound && cfindex < connfields.Count() )
       
   942 	            {
       
   943 	            inetAddr = connfields[cfindex++]->InetAddress();
       
   944 	            cffound = MCE_NOT_NULL_PTR( inetAddr );
       
   945 	            }
       
   946 	        found = cffound;
       
   947             }
       
   948         }
       
   949     
       
   950     if( connfield && !found )
   925         {
   951         {
   926 		inetAddr = connfield->InetAddress();
   952 		inetAddr = connfield->InetAddress();
   927 		if( inetAddr )
   953 		if( inetAddr )
   928 		    {
   954 		    {
   929 		    const TInetAddr inetAddress = *(connfield->InetAddress() );
   955 		    const TInetAddr inetAddress = *(connfield->InetAddress() );
   930 		    // if present, if not then should be media level
   956 		    // if present, if not then should be media level
   931 		    MCE_SET_REMOTE_IP_ADDR( &aSession, inetAddress );
   957 		    MCE_SET_REMOTE_IP_ADDR( &aSession, inetAddress );
   932 		    }
   958 		    }
   933         }
       
   934     
       
   935     if ( !inetAddr )
       
   936         {
       
   937         TInt index = 0;
       
   938         TBool found = ETrue;
       
   939         while( found && index < mediaLines.Count() )
       
   940             {
       
   941             RPointerArray<CSdpConnectionField>& connfields = 
       
   942                                                 mediaLines[index]->ConnectionFields();
       
   943             
       
   944             if ( mediaLines[index++]->Port() > 0 )
       
   945                 {
       
   946 	            TInt cfindex = 0;
       
   947 	            TBool cffound = EFalse;
       
   948 	            while( !cffound && cfindex < connfields.Count() )
       
   949 	                {
       
   950 	                inetAddr = connfields[cfindex++]->InetAddress();
       
   951 	                cffound = MCE_NOT_NULL_PTR( inetAddr );
       
   952 	                }
       
   953 	            found = cffound;
       
   954                 }
       
   955             }
       
   956         }
   959         }
   957         
   960         
   958     if ( inetAddr )
   961     if ( inetAddr )
   959         {
   962         {
   960         MCE_SET_REMOTE_IP_ADDR( &aSession, *inetAddr );
   963         MCE_SET_REMOTE_IP_ADDR( &aSession, *inetAddr );