// ----------------------------------------------------------------------------- // CSIPExSIPServerOfferingState::AcceptInviteL() // (other items were commented in a header). // ----------------------------------------------------------------------------- void CSIPExSIPServerOfferingState::AcceptInviteL( CSIPExSIPEngine& aEngine) { _LIT8( KMediaType, "application" ); _LIT8( KMediaSubType, "sdp" ); _LIT8( KLogEntry, "200 OK sent" ); // Get the current transaction CSIPServerTransaction& tx = aEngine.ServerTx(); // Create the Response Elements object CSIPResponseElements* respElem = CSIPResponseElements::NewLC( 200, SIPStrings::StringF( SipStrConsts::EPhraseOk ) ); // Set the message body - we need to communicate our IP Address CSIPMessageElements& msgElem = respElem->MessageElements(); CSdpDocument* sdpDocument = aEngine.SdpDocumentLC(); HBufC8* sdpBody = aEngine.SdpBodyL( sdpDocument ); CleanupStack::PushL( sdpBody ); CSIPContentTypeHeader* ct = CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType ); msgElem.SetContentL( sdpBody, ct ); // Use the transaction to send 200 (OK) tx.SendResponseL( respElem ); CleanupStack::Pop( ct ); CleanupStack::Pop( sdpBody ); CleanupStack::PopAndDestroy( sdpDocument ); CleanupStack::Pop( respElem ); aEngine.SetCurrentState( iServerEstablishingState ); aEngine.Observer()->WriteLog( KLogEntry ); }
// ----------------------------------------------------------------------------- // MceSip::DoDiscardRequestL // ----------------------------------------------------------------------------- // void MceSip::DoDiscardRequestL( CSIPServerTransaction& aRequest, TInt aError, TBool aRetryIndication ) { CSIPResponseElements* response = NULL; TUint responseCode = 0; if ( aError >= (TInt)KMceSipTrying ) { responseCode = (TUint)aError; RStringF reasonPhrase = ReasonPhraseL( responseCode ); CleanupClosePushL( reasonPhrase ); response = CSIPResponseElements::NewL( responseCode, reasonPhrase ); CleanupStack::PopAndDestroy();//reasonPhrase } else { TInt reasonPhrase = 0; ErrorResponse( aError, responseCode, reasonPhrase ); response = CSIPResponseElements::NewL( responseCode, SIPStrings::StringF( reasonPhrase ) ); } CleanupStack::PushL( response ); if ( aRetryIndication ) { CSIPMessageElements& elements = response->MessageElements(); //create Retry-After header RPointerArray<CSIPHeaderBase> headers; CSIPHeaderBase::PushLC( &headers ); CSIPRetryAfterHeader* retryAfter = CSIPRetryAfterHeader::NewLC( Random( KMceRandMinRetryValue, KMceRandMaxRetryValue ) ); headers.AppendL( retryAfter ); CleanupStack::Pop( retryAfter ); //send invitation elements.SetUserHeadersL( headers ); CleanupStack::Pop( &headers ); } aRequest.SendResponseL( response ); CleanupStack::Pop( response ); }
TInt MceSip::RSeq( const CSIPResponseElements& aResponseElements ) { TInt value = KErrNotFound; // if its not found CSIPHeaderBase* rseqHeader = FindHeader( aResponseElements.MessageElements(), SIPStrings::StringF( SipStrConsts::ERSeqHeader ) ); if ( rseqHeader ) { value = static_cast< CSIPRSeqHeader* >( rseqHeader )->Value(); } return value; }