S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExSIPEstablishedState Class Reference

#include <SIPExSIPEstablishedState.h>

Inheritance diagram for CSIPExSIPEstablishedState:

CSIPExSIPStateBase List of all members.

Public Member Functions

virtual IMPORT_C ~CSIPExSIPEstablishedState ()
void LinkStates (CSIPExSIPStateBase &aTerminatingState, CSIPExSIPStateBase &aTerminatedState)
void EndSessionL (CSIPExSIPEngine &aEngine)
void ByeReceivedL (CSIPExSIPEngine &aEngine, CSIPServerTransaction &aTransaction)
void ResponseReceivedL (CSIPExSIPEngine &aEngine, CSIPClientTransaction &aTransaction)
void AckReceivedL (CSIPExSIPEngine &aEngine, CSIPServerTransaction &aTransaction)

Static Public Member Functions

static IMPORT_C CSIPExSIPEstablishedState * NewL ()

Private Member Functions

 CSIPExSIPEstablishedState ()

Private Attributes

CSIPExSIPStateBase * iTerminatingState
CSIPExSIPStateBase * iTerminatedState

Detailed Description

Reacts to events that are possible in "Established" state.

Definition at line 32 of file SIPExSIPEstablishedState.h.


Constructor & Destructor Documentation

EXPORT_C CSIPExSIPEstablishedState::~CSIPExSIPEstablishedState (   )  [virtual]
 

Destructor

Definition at line 39 of file SIPExSIPEstablishedState.cpp.

00040         {
00041         }

CSIPExSIPEstablishedState::CSIPExSIPEstablishedState (   )  [private]
 

C++ default constructor.

Definition at line 30 of file SIPExSIPEstablishedState.cpp.

00031         {
00032         }


Member Function Documentation

EXPORT_C CSIPExSIPEstablishedState * CSIPExSIPEstablishedState::NewL (   )  [static]
 

Two-phased constructor.

Definition at line 48 of file SIPExSIPEstablishedState.cpp.

References CSIPExSIPEstablishedState().

00049         {
00050         CSIPExSIPEstablishedState* self =
00051                 new (ELeave) CSIPExSIPEstablishedState();
00052         return self;
00053         }

void CSIPExSIPEstablishedState::LinkStates (  CSIPExSIPStateBase &  aTerminatingState,
CSIPExSIPStateBase &  aTerminatedState
) 
 

Links the states

Parameters:
aTerminatingState BYE sent, waiting for response.
aTerminatedState SIP Session has been ended.

Definition at line 60 of file SIPExSIPEstablishedState.cpp.

References iTerminatedState, and iTerminatingState.

00063         {
00064         iTerminatingState = &aTerminatingState;
00065         iTerminatedState = &aTerminatedState;
00066         }

void CSIPExSIPEstablishedState::EndSessionL (  CSIPExSIPEngine &  aEngine  )  [virtual]
 

EndSessionL Send BYE in an established session.

Parameters:
aEngine Reference to Engine object.

Reimplemented from CSIPExSIPStateBase.

Definition at line 73 of file SIPExSIPEstablishedState.cpp.

References CSIPExSIPEngine::CreateMessageElementsLC(), CSIPExSIPEngine::DialogAssoc(), iTerminatingState, CSIPExSIPEngine::SetClientTx(), and CSIPExSIPEngine::SetCurrentState().

00074         {
00075         // Get the current Dialog Association
00076         CSIPInviteDialogAssoc& dialogAssoc = aEngine.DialogAssoc();
00077         // Create the Message Elements object
00078         CSIPMessageElements* msgElements = aEngine.CreateMessageElementsLC();
00079 
00080         // Use the Dialog Association to send BYE request
00081         CSIPClientTransaction* tx = dialogAssoc.SendByeL( msgElements );
00082         aEngine.SetClientTx( tx );
00083 
00084         CleanupStack::Pop( msgElements );
00085 
00086         aEngine.SetCurrentState( iTerminatingState );
00087         }

void CSIPExSIPEstablishedState::ByeReceivedL (  CSIPExSIPEngine &  aEngine,
CSIPServerTransaction &  aTransaction
)  [virtual]
 

ByeReceivedL BYE has been received.

Parameters:
aEngine Reference to Engine object.
aTransaction Contains response elements.

Reimplemented from CSIPExSIPStateBase.

Definition at line 94 of file SIPExSIPEstablishedState.cpp.

References iTerminatedState, CSIPExSIPEngine::Observer(), MSIPExSIPEngineObserver::SessionEnded(), and CSIPExSIPEngine::SetCurrentState().

00097         {
00098         // Create and send response
00099     CSIPResponseElements* elem = 
00100         CSIPResponseElements::NewLC( 
00101             200, SIPStrings::StringF( SipStrConsts::EPhraseOk ) );
00102     aTransaction.SendResponseL( elem );
00103     CleanupStack::Pop( elem );
00104 
00105         // Inform observer
00106         aEngine.Observer()->SessionEnded();
00107 
00108         // Set state ???
00109         aEngine.SetCurrentState( iTerminatedState );
00110         }

void CSIPExSIPEstablishedState::ResponseReceivedL (  CSIPExSIPEngine &  aEngine,
CSIPClientTransaction &  aTransaction
)  [virtual]
 

ResponseReceivedL A SIP response has been received from the network.

Parameters:
aEngine Reference to Engine object.
aTransaction Contains response elements.

Reimplemented from CSIPExSIPStateBase.

Definition at line 117 of file SIPExSIPEstablishedState.cpp.

References CSIPExSIPEngine::DialogAssoc(), MSIPExSIPEngineObserver::EngineError(), and CSIPExSIPEngine::Observer().

00120         {
00121         // We might receive some 200 (OK) responses from the network
00122         // after the session has been established. These should be
00123         // ACKed, other responses indicate errors.
00124 
00125         const CSIPResponseElements* respElem = aTransaction.ResponseElements();
00126 
00127         TUint statusCode = respElem->StatusCode();
00128 
00129         if ( statusCode >= 200 && statusCode < 300 )
00130                 {
00131                 // Send ACK to remote party
00132                 CSIPInviteDialogAssoc& dialogAssoc = aEngine.DialogAssoc();
00133                 dialogAssoc.SendAckL( aTransaction );
00134                 }
00135         else
00136                 {
00137                 aEngine.Observer()->EngineError( statusCode );
00138                 }
00139         }

void CSIPExSIPEstablishedState::AckReceivedL (  CSIPExSIPEngine &  aEngine,
CSIPServerTransaction &  aTransaction
)  [virtual]
 

AckReceivedL ACK has been received.

Parameters:
aEngine Reference to Engine object.
aTransaction Contains response elements.

Reimplemented from CSIPExSIPStateBase.

Definition at line 146 of file SIPExSIPEstablishedState.cpp.

References MSIPExSIPEngineObserver::InviteAcceptedByUs(), and CSIPExSIPEngine::Observer().

00149         {
00150         aEngine.Observer()->InviteAcceptedByUs();
00151         }


© Nokia 2006

Back to top