S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExSIPIdleState Class Reference

#include <SIPExSIPIdleState.h>

Inheritance diagram for CSIPExSIPIdleState:

CSIPExSIPStateBase List of all members.

Public Member Functions

virtual IMPORT_C ~CSIPExSIPIdleState ()
void LinkStates (CSIPExSIPStateBase &aClientEstablishingState, CSIPExSIPStateBase &aServerOfferingState)
void SendInviteL (CSIPExSIPEngine &aEngine, const TDesC8 &aSipUri)
void InviteReceivedL (CSIPExSIPEngine &aEngine, CSIPServerTransaction *aTransaction)

Static Public Member Functions

static IMPORT_C CSIPExSIPIdleState * NewL ()

Private Member Functions

 CSIPExSIPIdleState ()

Private Attributes

CSIPExSIPStateBase * iClientEstablishingState
CSIPExSIPStateBase * iServerOfferingState

Detailed Description

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

Definition at line 32 of file SIPExSIPIdleState.h.


Constructor & Destructor Documentation

EXPORT_C CSIPExSIPIdleState::~CSIPExSIPIdleState (   )  [virtual]
 

Destructor

Definition at line 40 of file SIPExSIPIdleState.cpp.

00041         {
00042         }

CSIPExSIPIdleState::CSIPExSIPIdleState (   )  [private]
 

C++ default constructor.

Definition at line 31 of file SIPExSIPIdleState.cpp.

00032         {
00033         }


Member Function Documentation

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

Two-phased constructor.

Definition at line 49 of file SIPExSIPIdleState.cpp.

References CSIPExSIPIdleState().

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

void CSIPExSIPIdleState::LinkStates (  CSIPExSIPStateBase &  aClientEstablishingState,
CSIPExSIPStateBase &  aServerOfferingState
) 
 

Links the states

Parameters:
aClientEstablishingState Invitation with media parameters is sent to peer.
aServerOfferingState Invitation with media parameters is received from peer.

Definition at line 60 of file SIPExSIPIdleState.cpp.

References iClientEstablishingState, and iServerOfferingState.

00063         {
00064         iClientEstablishingState = &aClientEstablishingState;
00065         iServerOfferingState = &aServerOfferingState;
00066         }

void CSIPExSIPIdleState::SendInviteL (  CSIPExSIPEngine &  aEngine,
const TDesC8 &  aSipUri
)  [virtual]
 

SendInviteL Sends an INVITE to peer.

Parameters:
aEngine Reference to SIP Engine.
aSipUri uri of recipient.

Reimplemented from CSIPExSIPStateBase.

Definition at line 72 of file SIPExSIPIdleState.cpp.

References CSIPExSIPEngine::ConnectionL(), CSIPExSIPEngine::ConvertToUri8LC(), CSIPExSIPEngine::CreateMessageElementsLC(), iClientEstablishingState, CSIPExSIPEngine::Profile(), CSIPExSIPEngine::SetClientTx(), CSIPExSIPEngine::SetCurrentState(), and CSIPExSIPEngine::SetDialogAssoc().

00075         {
00076         // Retrieve the active profile and connection
00077         CSIPProfile& prof = aEngine.Profile();
00078         CSIPConnection& conn = aEngine.ConnectionL();
00079 
00080     // Create CUri8 from passed descriptor
00081     CUri8* uri8 = aEngine.ConvertToUri8LC( aSipUri );
00082     
00083         // Get dialog association, save for future use
00084         // The ownership of uri8 is transferred
00085         CSIPInviteDialogAssoc* dialogAssoc =
00086                 CSIPInviteDialogAssoc::NewL( conn, uri8, prof );
00087         CleanupStack::Pop( uri8 );      
00088                 
00089         aEngine.SetDialogAssoc( *dialogAssoc ); //Ownership is transferred!!
00090 
00091         // Create the necessary message elements
00092         CSIPMessageElements* msgElements = aEngine.CreateMessageElementsLC();
00093 
00094         // Send the INVITE in the dialog
00095         // The ownership of msgElements is transferred
00096         CSIPClientTransaction* tx = dialogAssoc->SendInviteL( msgElements );
00097         CleanupStack::Pop( msgElements );
00098 
00099         // Save the pointer to the transaction to the Engine
00100         aEngine.SetClientTx( tx );
00101 
00102         // Change machine state
00103         aEngine.SetCurrentState( iClientEstablishingState );
00104         }

void CSIPExSIPIdleState::InviteReceivedL (  CSIPExSIPEngine &  aEngine,
CSIPServerTransaction *  aTransaction
)  [virtual]
 

InviteReceivedL INVITE has been received.

Parameters:
aEngine Reference to SIP Engine.
aTransaction Contains response elements. The ownership is transferred.

Reimplemented from CSIPExSIPStateBase.

Definition at line 111 of file SIPExSIPIdleState.cpp.

References MSIPExSIPEngineObserver::InviteReceived(), iServerOfferingState, CSIPExSIPEngine::Observer(), CSIPExSIPEngine::Profile(), CSIPExSIPEngine::SetCurrentState(), CSIPExSIPEngine::SetDialogAssoc(), and MSIPExSIPEngineObserver::WriteLog().

00114         {
00115         _LIT8( KLogEntry, "180 Ringing sent" );
00116 
00117         // Get dialog association, save for future use
00118         CSIPInviteDialogAssoc* dialogAssoc =
00119                 CSIPInviteDialogAssoc::NewL( *aTransaction );
00120         aEngine.SetDialogAssoc( *dialogAssoc );
00121     
00122         // Create the necessary response elements and send
00123     CSIPResponseElements* elem =
00124         CSIPResponseElements::NewLC( 
00125             180, SIPStrings::StringF( SipStrConsts::EPhraseRinging ) );
00126     aTransaction->SendResponseL( elem );
00127     CleanupStack::Pop( elem );
00128         aEngine.Observer()->WriteLog( KLogEntry );
00129 
00130         // Get the From header from the request
00131         const CSIPRequestElements* reqElem = aTransaction->RequestElements();
00132         const CSIPFromHeader* fromHeader = reqElem->FromHeader();
00133         
00134         // Change machine state
00135         aEngine.SetCurrentState( iServerOfferingState );
00136 
00137     TUint32 iapId( 0 );
00138         User::LeaveIfError( 
00139                 aEngine.Profile().GetParameter( KSIPAccessPointId, iapId ) );
00140         
00141         // Send user name from the From header to the Engine Observer 
00142         // as a parameter. Send also id of used IAP.
00143         aEngine.Observer()->InviteReceived( 
00144             fromHeader->SIPAddress().Uri8().Uri().Extract( EUriUserinfo ), iapId );
00145         }


© Nokia 2006

Back to top