Nokia N97 SDK
Example Applications Guide

CSIPExSIPEngine Class Reference

#include <SIPExSIPEngine.h>

Inheritance diagram for CSIPExSIPEngine:

List of all members.

Detailed Description

CSIPExSIPEngine Class for implementing the SIP Engine for the SIP Example Application. The Engine provides API functions for other parts of the Application, and maintains an internal state machine to handle the SIP session.

Definition at line 92 of file SIPExSIPEngine.h.


Public Member Functions

virtual  ~CSIPExSIPEngine ()
IMPORT_C TBool  EnableProfileL ()
IMPORT_C void  DisableProfileL ()
IMPORT_C void  SendInviteL (const TDesC8 &aSipUri)
IMPORT_C void  CancelInviteL ()
IMPORT_C void  AcceptInviteL (const TInetAddr &aIPAddr)
IMPORT_C void  DeclineInviteL ()
IMPORT_C void  EndSessionL ()
IMPORT_C void  CreateIML (const TDesC8 &aMessage, const TDesC8 &aSipUri)
void  IMReceivedL (CSIPServerTransaction *aTransaction)
void  IMReceived (CSIPServerTransaction *aTransaction)
void  SetCurrentState (CSIPExSIPStateBase *aState)
CSIPConnection &  ConnectionL ()
CSIPProfile &  Profile ()
void  SetServerTx (CSIPServerTransaction *aTx)
CSIPServerTransaction &  ServerTx ()
void  SetClientTx (CSIPClientTransaction *aTx)
void  ClearClientTx ()
CSIPClientTransaction &  ClientTx ()
void  SetDialogAssoc (CSIPInviteDialogAssoc &aAssoc)
CSIPInviteDialogAssoc &  DialogAssoc ()
void  IncomingRequest (TUint32 aIapId, CSIPServerTransaction *aTransaction)
void  TimedOut (CSIPServerTransaction &aSIPServerTransaction)
void  IncomingRequest (CSIPServerTransaction *aTransaction)
void  IncomingRequest (CSIPServerTransaction *aTransaction, CSIPDialog &aDialog)
void  IncomingResponse (CSIPClientTransaction &aTransaction)
void  IncomingResponse (CSIPClientTransaction &aTransaction, CSIPDialogAssocBase &aDialogAssoc)
void  IncomingResponse (CSIPClientTransaction &aTransaction, CSIPInviteDialogAssoc *aDialogAssoc)
void  IncomingResponse (CSIPClientTransaction &aTransaction, CSIPRegistrationBinding &aRegistration)
void  ErrorOccured (TInt aError, CSIPTransactionBase &aTransaction)
void  ErrorOccured (TInt aError, CSIPClientTransaction &aTransaction, CSIPRegistrationBinding &aRegistration)
void  ErrorOccured (TInt aError, CSIPTransactionBase &aTransaction, CSIPDialogAssocBase &aDialogAssoc)
void  ErrorOccured (TInt aError, CSIPRefresh &aSIPRefresh)
void  ErrorOccured (TInt aError, CSIPRegistrationBinding &aRegistration)
void  ErrorOccured (TInt aError, CSIPDialogAssocBase &aDialogAssoc)
void  InviteCompleted (CSIPClientTransaction &aTransaction)
void  InviteCanceled (CSIPServerTransaction &aTransaction)
void  ConnectionStateChanged (CSIPConnection::TState aState)
void  ProfileRegistryEventOccurred (TUint32 aProfileId, TEvent aEvent)
void  ProfileRegistryErrorOccurred (TUint32 aProfileId, TInt aError)
CSIPToHeader *  CreateToHeaderLC (const TDesC8 &aSipUri)
CSIPRequestElements *  CreateReqElementsLC (const TDesC8 &aSipUri)
CSIPMessageElements *  CreateMessageElementsLC ()
CUri8 *  ConvertToUri8LC (const TDesC8 &aSipUri)
CSdpDocument *  SdpDocumentLC ()
HBufC8 *  SdpBodyL (CSdpDocument *aDocument)
RStringPool  StringPoolL ()
const TInetAddr  IPAddressFromResponseElementsL (const CSIPResponseElements &aRespElem)
MSIPExSIPEngineObserver *  Observer ()

Static Public Member Functions

static IMPORT_C CSIPExSIPEngine *  NewL (TUid aAppUid, MSIPExSIPEngineObserver *aObserver)

Private Member Functions

  CSIPExSIPEngine ()
void  ConstructL (TUid aAppUid, MSIPExSIPEngineObserver *aObserver)
TInt64  SessionId ()
void  MediaFieldsL (CSdpDocument *aDocument)
CSIPConnection *  CurrentConnection ()
void  HandleProfileRegistered (TUint32 aSIPProfileId)
void  HandleProfileDeregistered (TUint32 aSIPProfileId)
void  HandleProfileDestroyed (TUint32 aSIPProfileId)

Private Attributes

TInt64  iSessionId
TInetAddr  iLocalAddr
MSIPExSIPEngineObserver *  iObserver
CSIP *  iSIP
CSIPProfile *  iProfile
CSIPProfileRegistry *  iProfileRegistry
CSIPConnection *  iConnection
CSIPInviteDialogAssoc *  iDialogAssoc
CSIPConnection::TState  iConnState
CSIPExSIPStateBase *  iCurrentState
CSIPClientTransaction *  iClientTx
CSIPServerTransaction *  iServerTx
CSIPExSIPIdleState *  iIdle
CSIPExSIPClientEstablishingState *  iClientEstablishing
CSIPExSIPClientOfferingState *  iClientOffering
CSIPExSIPServerOfferingState *  iServerOffering
CSIPExSIPServerEstablishingState *  iServerEstablishing
CSIPExSIPEstablishedState *  iEstablished
CSIPExSIPTerminatingState *  iTerminating


Constructor & Destructor Documentation

CSIPExSIPEngine::~CSIPExSIPEngine (   )  [virtual]
 

Destructor.

Definition at line 51 of file SIPExSIPEngine.cpp.

References iClientEstablishing, iClientOffering, iClientTx, iConnection, iDialogAssoc, iEstablished, iIdle, iProfile, iProfileRegistry, iServerEstablishing, iServerOffering, iServerTx, iSIP, and iTerminating.

00052         {
00053         SdpCodecStringPool::Close();
00054         
00055         delete iIdle;
00056         delete iClientEstablishing;
00057         delete iClientOffering;
00058         delete iServerOffering;
00059         delete iServerEstablishing;
00060         delete iEstablished;
00061         delete iTerminating;
00062 
00063         delete iClientTx;
00064         delete iServerTx;
00065 
00066         delete iDialogAssoc;
00067 
00068         delete iConnection;
00069         delete iProfile;
00070         delete iProfileRegistry;
00071         delete iSIP;
00072         }

CSIPExSIPEngine::CSIPExSIPEngine (   )  [private]
 

C++ default constructor.

Definition at line 79 of file SIPExSIPEngine.cpp.

Referenced by NewL().

00080         {
00081         }


Member Function Documentation

EXPORT_C CSIPExSIPEngine * CSIPExSIPEngine::NewL (  TUid  aAppUid,
MSIPExSIPEngineObserver *  aObserver
)  [static]
 

NewL Create new instance of SIP Engine.

Parameters:
aAppUid  Application uid.
aObserver  Pointer to the Engine Observer.
Returns:
Pointer to new SIP Engine instance.

Definition at line 35 of file SIPExSIPEngine.cpp.

References CSIPExSIPEngine().

Referenced by CSIPExEngine::ConstructL().

00038         {
00039         CSIPExSIPEngine* self = new( ELeave ) CSIPExSIPEngine();
00040         CleanupStack::PushL( self );
00041         self->ConstructL( aAppUid, aObserver );
00042         CleanupStack::Pop( self );
00043         
00044         return self;
00045         }

void CSIPExSIPEngine::ConstructL (  TUid  aAppUid,
MSIPExSIPEngineObserver *  aObserver
)  [private]
 

2nd phase construction.

Parameters:
aAppUid  Application uid.
aObserver  Pointer to the Engine Observer.

Definition at line 88 of file SIPExSIPEngine.cpp.

References iClientEstablishing, iClientOffering, iConnState, iCurrentState, iEstablished, iIdle, iLocalAddr, iObserver, iProfileRegistry, iServerEstablishing, iServerOffering, iSIP, iTerminating, CSIPExSIPTerminatingState::LinkStates(), CSIPExSIPEstablishedState::LinkStates(), CSIPExSIPServerEstablishingState::LinkStates(), CSIPExSIPServerOfferingState::LinkStates(), CSIPExSIPClientOfferingState::LinkStates(), CSIPExSIPClientEstablishingState::LinkStates(), CSIPExSIPIdleState::LinkStates(), CSIPExSIPTerminatingState::NewL(), CSIPExSIPEstablishedState::NewL(), CSIPExSIPServerEstablishingState::NewL(), CSIPExSIPServerOfferingState::NewL(), CSIPExSIPClientOfferingState::NewL(), CSIPExSIPClientEstablishingState::NewL(), CSIPExSIPIdleState::NewL(), and StringPoolL().

00091         {
00092         // Make note of the observer class.
00093         iObserver = aObserver;
00094 
00095         // Create instances of the CSIP and Profile Registry classes
00096         iSIP = CSIP::NewL( aAppUid, *this );
00097         iProfileRegistry = CSIPProfileRegistry::NewL( *iSIP, *this );
00098 
00099         // Open SDP Codec String Pool
00100         StringPoolL();
00101 
00102         // Set our local address
00103         const TUint32 KInetAddr = INET_ADDR(127,0,0,1);
00104         iLocalAddr.SetAddress( KInetAddr );
00105 
00106         // Set up the state machine
00107         // Create instances of the state classes.
00108         iIdle = CSIPExSIPIdleState::NewL();
00109         iClientEstablishing = CSIPExSIPClientEstablishingState::NewL();
00110         iClientOffering = CSIPExSIPClientOfferingState::NewL();
00111         iServerOffering = CSIPExSIPServerOfferingState::NewL();
00112         iServerEstablishing = CSIPExSIPServerEstablishingState::NewL();
00113         iEstablished = CSIPExSIPEstablishedState::NewL();
00114         iTerminating = CSIPExSIPTerminatingState::NewL();
00115 
00116         // Create the links for state transitions.
00117         iIdle->LinkStates( *iClientEstablishing, *iServerOffering );
00118         iClientEstablishing->LinkStates( *iIdle, *iClientOffering, *iEstablished );
00119         iClientOffering->LinkStates( *iIdle, *iEstablished, *iIdle );
00120         iServerOffering->LinkStates( *iServerEstablishing, *iIdle );
00121         iServerEstablishing->LinkStates( *iEstablished, *iIdle );
00122         iEstablished->LinkStates( *iTerminating, *iIdle );
00123         iTerminating->LinkStates( *iIdle );
00124 
00125         // Set current state data
00126         iCurrentState = iIdle;
00127         iConnState = CSIPConnection::EInactive;
00128         }

EXPORT_C TBool CSIPExSIPEngine::EnableProfileL (   ) 
 

EnableProfileL Enable the default profile. Callback is notified when operation is complete. Leaves if default SIP profile is not found or profile type is not expected. Returns true if profile was registered immediately after enabling.

Definition at line 139 of file SIPExSIPEngine.cpp.

References iObserver, iProfile, iProfileRegistry, MSIPExSIPEngineObserver::ProfileError(), and MSIPExSIPEngineObserver::WriteLog().

Referenced by TSIPExStateIdle::EnableProfileL(), and IncomingRequest().

00140         {
00141         // Check for existing profile
00142         if ( iProfile )
00143                 {
00144                 delete iProfile;
00145                 iProfile = NULL;
00146                 }
00147     TBool registered( EFalse );
00148     
00149     // Leaves with KErrNotFound if default profile is not found
00150         iProfile = iProfileRegistry->DefaultProfileL();
00151 
00152     // Safety check that DefaultProfile() didn't return NULL pointer.
00153     if ( !iProfile )
00154         {
00155         iObserver->ProfileError( KErrNotFound );
00156         _LIT8( KProfileError, "Profile not found. Define a profile:");
00157         iObserver->WriteLog(KProfileError());
00158                 User::Leave( KErrNotFound );
00159         }
00160     // Leaves if profile type is not EInternet
00161     else if ( iProfile->Type().iSIPProfileClass != TSIPProfileTypeInfo::EInternet )
00162                 {
00163                 delete iProfile;
00164                 iProfile = NULL;
00165                 iObserver->ProfileError( KErrNotSupported );
00166                 User::Leave( KErrNotSupported );
00167                 }
00168         else
00169                 {
00170                 const TDesC8* aor = NULL;
00171         iProfile->GetParameter( KSIPUserAor, aor );     
00172         iObserver->WriteLog( *aor );
00173                 iProfileRegistry->EnableL( *iProfile, *this );
00174                 
00175                 // check whether profile was immediately set to registered state
00176                 iProfile->GetParameter( KSIPProfileRegistered, registered );
00177                 }
00178                 
00179     return registered;
00180         }

EXPORT_C void CSIPExSIPEngine::DisableProfileL (   ) 
 

DisableProfile Disable the current profile. Callback is notified when operation is complete.

Definition at line 188 of file SIPExSIPEngine.cpp.

References iProfile, and iProfileRegistry.

Referenced by TSIPExStateRegistered::DisableProfileL().

00189         {
00190         if ( iProfile )
00191                 {
00192                 iProfileRegistry->Disable( *iProfile );
00193                 delete iProfile;
00194                 iProfile = NULL;                
00195                 }
00196         }

EXPORT_C void CSIPExSIPEngine::SendInviteL (  const TDesC8 &  aSipUri  ) 
 

SendInvite Create and send an INVITE to the recipient identified by the parameter.

Parameters:
aSipUri  Address of the recipient.

Definition at line 203 of file SIPExSIPEngine.cpp.

References iCurrentState, and CSIPExSIPStateBase::SendInviteL().

Referenced by TSIPExStateRegistered::InviteL().

00204         {
00205         iCurrentState->SendInviteL( *this, aSipUri );
00206         }

EXPORT_C void CSIPExSIPEngine::CancelInviteL (   ) 
 

CancelInvite CANCEL a previously sent INVITE. If a final response for the INVITE has been sent, the CANCEL request fails.

Definition at line 213 of file SIPExSIPEngine.cpp.

References CSIPExSIPStateBase::CancelInviteL(), and iCurrentState.

Referenced by TSIPExStateInviting::EndGameL().

00214         {
00215         iCurrentState->CancelInviteL( *this );
00216         }

EXPORT_C void CSIPExSIPEngine::AcceptInviteL (  const TInetAddr &  aIPAddr  ) 
 

AcceptInvite Send a 200 (OK) response to an INVITE sent by a remote party.

Parameters:
aIPAddr  local ip-address.

Definition at line 223 of file SIPExSIPEngine.cpp.

References CSIPExSIPStateBase::AcceptInviteL(), iCurrentState, and iLocalAddr.

Referenced by TSIPExStateIdle::InviteReceived().

00224         {
00225         iLocalAddr = aIPAddr;
00226         iCurrentState->AcceptInviteL( *this );
00227         }

EXPORT_C void CSIPExSIPEngine::DeclineInviteL (   ) 
 

DeclineInvite Send a 488 (Not Acceptable Here) response to an INVITE sent by a remote party.

Definition at line 234 of file SIPExSIPEngine.cpp.

References CSIPExSIPStateBase::DeclineInviteL(), and iCurrentState.

00235         {
00236         iCurrentState->DeclineInviteL( *this );
00237         }

EXPORT_C void CSIPExSIPEngine::EndSessionL (   ) 
 

EndSession Terminate the SIP session by sending a BYE request.

Definition at line 244 of file SIPExSIPEngine.cpp.

References CSIPExSIPStateBase::EndSessionL(), and iCurrentState.

Referenced by TSIPExStateRemote::EndGameL(), TSIPExStateLocal::EndGameL(), TSIPExStateConnecting::EndGameL(), and TSIPExStateAcceptingSIP::EndGameL().

00245         {
00246         iCurrentState->EndSessionL( *this );
00247         }

EXPORT_C void CSIPExSIPEngine::CreateIML (  const TDesC8 &  aMessage,
const TDesC8 &  aSipUri
) 
 

CreateIML Create an instant message and send it to the remote party using the MESSAGE method.

Parameters:
aMessage  The message to be sent.
aSipUri  Address of the recipient.

Definition at line 256 of file SIPExSIPEngine.cpp.

References ConnectionL(), CreateReqElementsLC(), CreateToHeaderLC(), and iProfile.

Referenced by TSIPExStateRemote::SendInstantMsgL(), TSIPExStateRegistered::SendInstantMsgL(), and TSIPExStateLocal::SendInstantMsgL().

00259         {
00260         _LIT8( KMediaType, "SIPEx" );   // Part of content type
00261         _LIT8( KMediaSubType, "InstantMessage" );       // Part of content type
00262 
00263         // Create the necessary elements of the IM
00264         CSIPRequestElements* reqElem = CreateReqElementsLC( aSipUri );
00265         CSIPToHeader* toHeader = CreateToHeaderLC( aSipUri );
00266         reqElem->SetToHeaderL( toHeader );
00267         CleanupStack::Pop( toHeader );
00268 
00269     // Create the From header value using info from the profile
00270     const TDesC8* aor = NULL;
00271     iProfile->GetParameter( KSIPUserAor, aor ); 
00272         __ASSERT_ALWAYS( aor && *aor != KNullDesC8, User::Leave( KErrNotFound ) );
00273 
00274     CSIPAddress* addr = CSIPAddress::DecodeL( *aor );
00275         CleanupStack::PushL( addr );
00276     CSIPFromHeader* fromHeader = CSIPFromHeader::NewL( addr );
00277         CleanupStack::Pop( addr );
00278 
00279         CleanupStack::PushL( fromHeader );
00280         reqElem->SetFromHeaderL( fromHeader );
00281         CleanupStack::Pop( fromHeader );
00282         
00283 
00284         reqElem->SetMethodL( SIPStrings::StringF( SipStrConsts::EMessage ) );
00285 
00286         // Get reference to the message elements from the request
00287         // elements, create and insert content type header (ownership
00288         // of the content type object is transferred)
00289         CSIPMessageElements& msgElem = reqElem->MessageElements();
00290         CSIPContentTypeHeader* ct =
00291                 CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType );
00292         msgElem.SetContentL( aMessage.AllocL(), ct );
00293         CleanupStack::Pop( ct );
00294 
00295         // Get the current connection
00296         CSIPConnection& conn = ConnectionL();
00297 
00298         // Send the request using the connection (ownership of the
00299         // request elements object is transferred)
00300         CSIPClientTransaction* ctx = conn.SendRequestL( reqElem );
00301         CleanupStack::Pop( reqElem );
00302 
00303         delete ctx;
00304         }

void CSIPExSIPEngine::IMReceivedL (  CSIPServerTransaction *  aTransaction  ) 
 

IMReceivedL An instant message has been received from the network. Inform the observer.

Parameters:
aTransaction  Contains message elements. Ownership is transferred.

Definition at line 312 of file SIPExSIPEngine.cpp.

References MSIPExSIPEngineObserver::IMReceived(), and iObserver.

Referenced by IMReceived().

00313         {
00314         const CSIPRequestElements* reqElem = aTransaction->RequestElements();
00315         const CSIPFromHeader* fromHeader = reqElem->FromHeader();
00316         
00317     CSIPResponseElements* respElem =
00318         CSIPResponseElements::NewLC( 200, 
00319             SIPStrings::StringF( SipStrConsts::EPhraseOk ) );
00320         // Use the transaction to send 200 (OK)
00321         aTransaction->SendResponseL( respElem );
00322         CleanupStack::Pop( respElem );
00323 
00324         // Inform the observer of the Instant Message
00325         iObserver->IMReceived(
00326             fromHeader->SIPAddress().Uri8().Uri().Extract( EUriUserinfo ),
00327                 reqElem->MessageElements().Content());  
00328 
00329         // We no longer need aTransaction. Just delete it.
00330         delete aTransaction;
00331         aTransaction = NULL;
00332         }

void CSIPExSIPEngine::IMReceived (  CSIPServerTransaction *  aTransaction  ) 
 

IMReceived A non-leaving version of the IMReceivedL, the possible errors are trapped.

Parameters:
aTransaction  Contains message elements. Ownership is transferred.

Definition at line 339 of file SIPExSIPEngine.cpp.

References MSIPExSIPEngineObserver::EngineError(), IMReceivedL(), and iObserver.

Referenced by IncomingRequest().

00340         {
00341         TRAPD( err, IMReceivedL( aTransaction ));
00342 
00343         if ( err != KErrNone )
00344                 {
00345                 iObserver->EngineError( err );
00346                 }
00347         }

void CSIPExSIPEngine::SetCurrentState (  CSIPExSIPStateBase *  aState  ) 
 

SetCurrentState Sets the active state of the state machine.

Parameters:
aState  The current state.

Definition at line 354 of file SIPExSIPEngine.cpp.

References iCurrentState.

Referenced by CSIPExSIPServerOfferingState::AcceptInviteL(), CSIPExSIPServerEstablishingState::AckReceivedL(), CSIPExSIPServerOfferingState::ByeReceivedL(), CSIPExSIPServerEstablishingState::ByeReceivedL(), CSIPExSIPEstablishedState::ByeReceivedL(), CSIPExSIPClientOfferingState::CancelInviteL(), CSIPExSIPClientEstablishingState::CancelInviteL(), CSIPExSIPServerOfferingState::CancelReceivedL(), CSIPExSIPServerEstablishingState::CancelReceivedL(), CSIPExSIPServerOfferingState::DeclineInviteL(), CSIPExSIPEstablishedState::EndSessionL(), CSIPExSIPIdleState::InviteReceivedL(), CSIPExSIPTerminatingState::ResponseReceivedL(), CSIPExSIPClientOfferingState::ResponseReceivedL(), CSIPExSIPClientEstablishingState::ResponseReceivedL(), and CSIPExSIPIdleState::SendInviteL().

00355         {
00356         iCurrentState = aState;
00357         }

CSIPConnection & CSIPExSIPEngine::ConnectionL (   ) 
 

Connection Sets the active connection.

Definition at line 364 of file SIPExSIPEngine.cpp.

References CurrentConnection(), iConnection, iProfile, and iSIP.

Referenced by CreateIML(), and CSIPExSIPIdleState::SendInviteL().

00365         {
00366         CSIPConnection* conn = CurrentConnection();
00367         if ( !conn )
00368                 {
00369                 TUint32 iapId( 0 );
00370             User::LeaveIfError( iProfile->GetParameter( KSIPAccessPointId, iapId ) );
00371                 iConnection = CSIPConnection::NewL( *iSIP, iapId, *this );
00372                 return *iConnection;
00373                 }
00374         return *conn;
00375         }

CSIPProfile & CSIPExSIPEngine::Profile (   ) 
 

Profile Returns the enabled profile.

Definition at line 382 of file SIPExSIPEngine.cpp.

References iProfile.

Referenced by CSIPExSIPIdleState::InviteReceivedL(), and CSIPExSIPIdleState::SendInviteL().

00383         {
00384         return *iProfile;
00385         }

void CSIPExSIPEngine::SetServerTx (  CSIPServerTransaction *  aTx  ) 
 

SetServerTx Sets the current Server Transaction. The ownership is transferred to the Engine.

Parameters:
aTx  The transaction.

Definition at line 392 of file SIPExSIPEngine.cpp.

References iServerTx.

Referenced by IncomingRequest().

00393         {
00394         delete iServerTx;
00395         iServerTx = aTx;
00396         }

CSIPServerTransaction & CSIPExSIPEngine::ServerTx (   ) 
 

ServerTx Gets the current Server Transaction.

Definition at line 403 of file SIPExSIPEngine.cpp.

References iServerTx.

Referenced by CSIPExSIPServerOfferingState::AcceptInviteL(), and CSIPExSIPServerOfferingState::DeclineInviteL().

00404         {
00405         return *iServerTx;
00406         }

void CSIPExSIPEngine::SetClientTx (  CSIPClientTransaction *  aTx  ) 
 

SetClientTx Sets the current Client Transaction. The ownership is transferred to the Engine.

Parameters:
aTx  The transaction.

Definition at line 413 of file SIPExSIPEngine.cpp.

References iClientTx.

Referenced by CSIPExSIPEstablishedState::EndSessionL(), and CSIPExSIPIdleState::SendInviteL().

00414         {
00415         delete iClientTx;
00416         iClientTx = aTx;
00417         }

void CSIPExSIPEngine::ClearClientTx (   ) 
 

ClearClientTx Deletes the current Client Transaction.

Definition at line 424 of file SIPExSIPEngine.cpp.

References iClientTx.

Referenced by CSIPExSIPTerminatingState::ResponseReceivedL().

00425         {
00426         delete iClientTx;
00427         iClientTx = NULL;
00428         }

CSIPClientTransaction & CSIPExSIPEngine::ClientTx (   ) 
 

ClientTx Gets the current Client Transaction.

Definition at line 435 of file SIPExSIPEngine.cpp.

References iClientTx.

Referenced by CSIPExSIPClientOfferingState::CancelInviteL(), and CSIPExSIPClientEstablishingState::CancelInviteL().

00436         {
00437         return *iClientTx;
00438         }

void CSIPExSIPEngine::SetDialogAssoc (  CSIPInviteDialogAssoc &  aAssoc  ) 
 

SetDialogAssoc Sets the current Invite Dialog Association.

Parameters:
aAssoc  The Dialog Assoc.

Definition at line 445 of file SIPExSIPEngine.cpp.

References iDialogAssoc.

Referenced by CSIPExSIPIdleState::InviteReceivedL(), and CSIPExSIPIdleState::SendInviteL().

00446         {
00447         delete iDialogAssoc;
00448         iDialogAssoc = &aAssoc;
00449         }

CSIPInviteDialogAssoc & CSIPExSIPEngine::DialogAssoc (   ) 
 

DialogAssoc Returns the current Invite Dialog Association.

Definition at line 456 of file SIPExSIPEngine.cpp.

References iDialogAssoc.

Referenced by CSIPExSIPEstablishedState::EndSessionL(), CSIPExSIPEstablishedState::ResponseReceivedL(), CSIPExSIPClientOfferingState::ResponseReceivedL(), and CSIPExSIPClientEstablishingState::ResponseReceivedL().

00457         {
00458         return *iDialogAssoc;
00459         }

void CSIPExSIPEngine::IncomingRequest (  TUint32  aIapId,
CSIPServerTransaction *  aTransaction
) 
 

IncomingRequest (from MSIPObserver) A SIP request has been received from the network.

Parameters:
aIapId  The IapId from which the SIP request was received.
aTransaction  contains local address, remote address of a sip message, as well as optional SIP message method, headers and body. The ownership is transferred.

Definition at line 737 of file SIPExSIPEngine.cpp.

References CurrentConnection(), EnableProfileL(), MSIPExSIPEngineObserver::EngineError(), iConnection, iCurrentState, CSIPExSIPStateBase::InviteReceivedL(), iObserver, iProfile, iServerTx, iSIP, MSIPExSIPEngineObserver::ProfileError(), and SetServerTx().

00740         {
00741         if ( !iProfile )
00742                 {
00743                 TRAPD( err, EnableProfileL() );
00744 
00745                 if ( err != KErrNone )
00746                         {
00747                         // A profile error occured.
00748                         // Delete aTransaction and inform the observer.
00749                         delete aTransaction;
00750                         aTransaction = NULL;
00751 
00752                         iObserver->ProfileError( err );
00753                         return;
00754                         }
00755                 }
00756         
00757         if ( !CurrentConnection() )
00758                 {
00759                 // Create an instance of the SIP Connection object.
00760                 TRAPD( err2, iConnection = CSIPConnection::NewL( *iSIP, aIapId, *this ) );
00761 
00762                 if ( err2 != KErrNone )
00763                         {
00764                         // An error occured opening the connection.
00765                         // Delete aTransaction and inform the observer.
00766                         delete aTransaction;
00767                         aTransaction = NULL;
00768 
00769                         iObserver->EngineError( err2 );
00770                         return;
00771                         }
00772                 } 
00773 
00774         if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EInvite ) )
00775                 {
00776                 // An INVITE has been received.
00777                 // Save the pointer for later queries and eventual
00778                 // deletion.
00779                 SetServerTx(aTransaction);
00780 
00781                 // Let the current state handle the received INVITE.
00782                 // Ownership of aTransaction is transferred.
00783                 TRAPD( err2, iCurrentState->InviteReceivedL( *this, aTransaction ) );
00784                 if ( err2 != KErrNone )
00785                         {
00786                         // An error occured when handling invitation.
00787                         // Delete aTransaction and inform the observer.
00788                         delete aTransaction;
00789                         iServerTx = NULL;
00790                         iObserver->EngineError( err2 );
00791                         return;
00792                         }
00793                 }
00794         else if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EMessage ) )
00795                 {
00796                 IMReceived( aTransaction );
00797                 }
00798         }

void CSIPExSIPEngine::TimedOut (  CSIPServerTransaction &  aSIPServerTransaction  ) 
 

TimedOut (from MSIPObserver)

Definition at line 804 of file SIPExSIPEngine.cpp.

00806         {
00807         }

void CSIPExSIPEngine::IncomingRequest (  CSIPServerTransaction *  aTransaction  ) 
 

IncomingRequest (from MSIPConnectionObserver) A SIP request outside a dialog has been received from the network.

Parameters:
aTransaction  SIP server transaction. The ownership is transferred.

Definition at line 817 of file SIPExSIPEngine.cpp.

References EnableProfileL(), iCurrentState, IMReceived(), CSIPExSIPStateBase::InviteReceivedL(), iObserver, iProfile, MSIPExSIPEngineObserver::ProfileError(), and SetServerTx().

00818         {
00819     if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EInvite ) )
00820         {
00821                 // An INVITE has been received.
00822                 // Get profile, create connection, and let the
00823                 // state machine handle it.
00824 
00825                 if ( !iProfile )
00826                         {
00827                         // If the default profile isn't enabled, do it now
00828                         TRAPD( err, EnableProfileL() );
00829 
00830                         if ( err != KErrNone )
00831                                 {
00832                                 // A profile error occured.
00833                                 // Delete aTransaction and inform the observer.
00834                                 delete aTransaction;
00835                                 aTransaction = NULL;
00836 
00837                                 iObserver->ProfileError( err );
00838                                 }
00839                         }
00840 
00841                 // The transaction still exists, which means there
00842                 // was no trouble with the profile part. Go on with
00843                 // request handling.
00844                 if ( aTransaction )
00845                         {
00846                         // The ownership of aTransaction is transferred.
00847                         // Save the pointer for later queries and eventual
00848                         // deletion.
00849                         SetServerTx(aTransaction);
00850 
00851                         // Handle the incoming request in the state machine classes
00852                         // The ownership of aTransaction is transferred.
00853                         TRAPD( err2, iCurrentState->InviteReceivedL( *this, aTransaction ));
00854                         }
00855         }
00856     else if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EMessage ) )
00857         {
00858         // An Instant Message is received
00859                 // The state machine isn't needed for this.
00860         IMReceived( aTransaction );
00861         }
00862         }

void CSIPExSIPEngine::IncomingRequest (  CSIPServerTransaction *  aTransaction,
CSIPDialog &  aDialog
) 
 

IncomingRequest (from MSIPConnectionObserver) A SIP request within a dialog has been received from the network. The client must resolve the actual dialog association to which this request belongs.

Parameters:
aTransaction  SIP server transaction. The ownership is transferred.
aDialog  the dialog that this transaction belongs to.

Definition at line 869 of file SIPExSIPEngine.cpp.

References CSIPExSIPStateBase::AckReceivedL(), CSIPExSIPStateBase::ByeReceivedL(), MSIPExSIPEngineObserver::EngineError(), iCurrentState, iDialogAssoc, iObserver, and SetServerTx().

00872         {
00873         const RPointerArray<CSIPDialogAssocBase>& dialogAssoc =
00874         aDialog.SIPDialogAssociations();
00875 
00876         for ( TInt i = 0; i < dialogAssoc.Count(); i++ )
00877                 {
00878                 if ( dialogAssoc[i]->Type() == 
00879                     SIPStrings::StringF( SipStrConsts::EInvite ) )
00880                         {
00881                         iDialogAssoc = 
00882                             reinterpret_cast<CSIPInviteDialogAssoc*>( dialogAssoc[0] );
00883                         break;
00884                         }
00885                 }
00886 
00887     if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EBye ) )
00888         {
00889                 // The ownership of aTransaction is transferred.
00890                 // Save the pointer for later queries and eventual
00891                 // deletion.
00892                 SetServerTx(aTransaction);
00893 
00894         TRAPD( err, iCurrentState->ByeReceivedL( *this, *aTransaction ) );
00895 
00896         if ( err != KErrNone )
00897                 {
00898                 iObserver->EngineError( err );
00899                 }
00900         }
00901     else if ( aTransaction->Type() == 
00902         SIPStrings::StringF( SipStrConsts::EAck ) )
00903         {
00904                 // The ownership of aTransaction is transferred.
00905                 // Save the pointer for later queries and eventual
00906                 // deletion.
00907                 SetServerTx(aTransaction);
00908 
00909         TRAPD( err, iCurrentState->AckReceivedL( *this, *aTransaction ) );
00910 
00911         if ( err != KErrNone )
00912                 {
00913                 iObserver->EngineError( err );
00914                 }
00915         }
00916     else if ( aTransaction->Type() == 
00917         SIPStrings::StringF( SipStrConsts::EMessage ) )
00918         {
00919         IMReceived( aTransaction );
00920         }
00921     else
00922         {
00923         // Unknown, or unimplemented, request received
00924                 delete aTransaction;
00925                 aTransaction = NULL;
00926         iObserver->EngineError( KErrNotSupported );
00927         }
00928         }

void CSIPExSIPEngine::IncomingResponse (  CSIPClientTransaction &  aTransaction  ) 
 

IncomingResponse (from MSIPConnectionObserver)

Definition at line 933 of file SIPExSIPEngine.cpp.

00935         {
00936         }

void CSIPExSIPEngine::IncomingResponse (  CSIPClientTransaction &  aTransaction,
CSIPDialogAssocBase &  aDialogAssoc
) 
 

IncomingResponse (from MSIPConnectionObserver) A SIP response that is within a dialog association or creates a dialog association.

Parameters:
aTransaction  contains response elements.
aDialogAssoc  a dialog association.

Definition at line 943 of file SIPExSIPEngine.cpp.

References iDialogAssoc.

00945         {
00946         if ( aDialogAssoc.Type() == SIPStrings::StringF( SipStrConsts::EInvite )  )
00947                 {
00948                 iDialogAssoc = reinterpret_cast<CSIPInviteDialogAssoc*>( &aDialogAssoc );
00949                 }
00950         
00951         TRAPD( err, iCurrentState->ResponseReceivedL( *this, aTransaction ) );
00952         
00953         if ( err != KErrNone )
00954                 {
00955                 iObserver->EngineError( err );
00956                 }
00957         }

void CSIPExSIPEngine::IncomingResponse (  CSIPClientTransaction &  aTransaction,
CSIPInviteDialogAssoc *  aDialogAssoc
) 
 

IncomingResponse (from MSIPConnectionObserver)

Definition at line 964 of file SIPExSIPEngine.cpp.

00967         {
00968         delete aDialogAssoc;
00969         aDialogAssoc = NULL;
00970         }

void CSIPExSIPEngine::IncomingResponse (  CSIPClientTransaction &  aTransaction,
CSIPRegistrationBinding &  aRegistration
) 
 

IncomingResponse (from MSIPConnectionObserver)

Definition at line 976 of file SIPExSIPEngine.cpp.

00979         {
00980         
00981         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPTransactionBase &  aTransaction
) 
 

An asynchronous error has occurred in the stack related to the request indicated by the given transaction.

Parameters:
aError  system wide or sip error code
aTransaction  failed transaction.
aSIPConnection  a SIP connection

Definition at line 988 of file SIPExSIPEngine.cpp.

00991         {
00992         
00993         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPClientTransaction &  aTransaction,
CSIPRegistrationBinding &  aRegistration
) 
 

An asynchronous error has occurred in the stack related to the request indicated by the given transaction.

Parameters:
aError  system wide or sip error code
aTransaction  the failed transaction.
aRegistration  the failed registration.

Definition at line 1000 of file SIPExSIPEngine.cpp.

01004         {
01005         
01006         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPTransactionBase &  aTransaction,
CSIPDialogAssocBase &  aDialogAssoc
) 
 

An asynchronous error has occured related to a request within an existing dialog.

Parameters:
aError  system wide or sip error code
aTransaction  the failed transaction.
aDialogAssoc  the failed dialog associoation.

Definition at line 1013 of file SIPExSIPEngine.cpp.

01017         {
01018         
01019         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPRefresh &  aSIPRefresh
) 
 

An asynchronous error has occured related to a refresh

Parameters:
aError  system wide or sip error code
aSIPRefresh  original refresh object.

Definition at line 1026 of file SIPExSIPEngine.cpp.

01029         {
01030         
01031         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPRegistrationBinding &  aRegistration
) 
 

An asynchronous error has occured related to a periodical refresh that relates to a registration.

Parameters:
aError  system wide or sip error code; KErrCouldNotConnect if the refresh has failed due to the suspended connection.
aRegistration  associated registration.

Definition at line 1038 of file SIPExSIPEngine.cpp.

01041         {
01042         
01043         }

void CSIPExSIPEngine::ErrorOccured (  TInt  aError,
CSIPDialogAssocBase &  aDialogAssoc
) 
 

An asynchronous error has occured related to a periodical refresh that belongs to SIP dialog association.

Parameters:
aError  system wide or sip error code; KErrCouldNotConnect if the refresh has failed due to the suspended connection.
aDialogAssoc  SIP dialog association.

Definition at line 1050 of file SIPExSIPEngine.cpp.

01053         {
01054         
01055         }

void CSIPExSIPEngine::InviteCompleted (  CSIPClientTransaction &  aTransaction  ) 
 

SIP stack has completed UAC core INVITE transaction 64*T1 seconds after the reception of the first 2xx response. No more 2xx responses can be received to the issued single INVITE.

If the INVITE transaction does not create a dialog, or the INVITE transaction encounters an error, this event will not be sent.

Parameters:
aTransaction  a complete UAC core INVITE transaction

Definition at line 1062 of file SIPExSIPEngine.cpp.

References iClientTx.

01064         {
01065         delete iClientTx;
01066         iClientTx = NULL;
01067         }

void CSIPExSIPEngine::InviteCanceled (  CSIPServerTransaction &  aTransaction  ) 
 

Invite was canceled with the CANCEL

Parameters:
aTransaction  a canceled INVITE UAS transaction

Definition at line 1073 of file SIPExSIPEngine.cpp.

References iClientTx.

01075     {
01076     delete iClientTx; 
01077         iClientTx = NULL;
01078     }

void CSIPExSIPEngine::ConnectionStateChanged (  CSIPConnection::TState  aState  ) 
 

Connection state has changed. If connection state has changed to EInactive or EUnavailable, SIP stack has removed all stand-alone SIP refreshes, registrations and dialog associations that client requested to refresh. Client may re-issue refresh requests (stand-alone, registration or dialog association related) when connection becomes EActive again. SIP stack also terminates all pending sip client transactions and no errors are reported back to the client about the terminated transactions nor about removed refreshes in order to avoid event flood.

Parameters:
aState  indicates the current connection state

Definition at line 1084 of file SIPExSIPEngine.cpp.

References MSIPExSIPEngineObserver::ConnectionLost(), iConnState, and iObserver.

01085         {
01086         if ( iConnState == CSIPConnection::EActive &&
01087                  aState != CSIPConnection::EActive )
01088                 {
01089                 // A previously active connection is active no more
01090                 iObserver->ConnectionLost();
01091                 }
01092         else
01093                 {
01094                 iConnState = aState;
01095                 }
01096         }

void CSIPExSIPEngine::ProfileRegistryEventOccurred (  TUint32  aProfileId,
TEvent  aEvent
) 
 

An event related to SIP Profile has accorred

Parameters:
aProfileId  a profile Id
aEvent  an occurred event

Definition at line 1107 of file SIPExSIPEngine.cpp.

References HandleProfileDeregistered(), HandleProfileDestroyed(), and HandleProfileRegistered().

01110     {
01111     switch (aEvent)
01112             {
01113             case MSIPProfileRegistryObserver::EProfileRegistered:
01114                 {
01115                 HandleProfileRegistered( aProfileId );
01116                 break;
01117                 }
01118             case MSIPProfileRegistryObserver::EProfileDeregistered:
01119                 {
01120                 HandleProfileDeregistered( aProfileId );
01121                 break;
01122                 }
01123             case MSIPProfileRegistryObserver::EProfileDestroyed:
01124                 {
01125             HandleProfileDestroyed( aProfileId );
01126                 break;
01127                 }
01128             default:
01129                 {
01130                 // MSIPProfileRegistryObserver::EProfileCreated and
01131                 // MSIPProfileRegistryObserver::EProfileUpdated
01132                 // are ignored
01133                 break;
01134                 }
01135             }
01136     }

void CSIPExSIPEngine::ProfileRegistryErrorOccurred (  TUint32  aProfileId,
TInt  aError
) 
 

An asynchronous error has occurred related to SIP profile Event is send to those observers, who have the corresponding profile instantiated.

Parameters:
aProfileId  the id of failed profile
aError  an occurred error

Definition at line 1142 of file SIPExSIPEngine.cpp.

References iObserver, and MSIPExSIPEngineObserver::ProfileError().

01145         {
01146         iObserver->ProfileError( aError );
01147         }

CSIPToHeader * CSIPExSIPEngine::CreateToHeaderLC (  const TDesC8 &  aSipUri  ) 
 

CreateToHeaderLC Return a To header object based on URI.

Parameters:
aSipUri  The URI address as a string.
Returns:
Pointer to CSIPToHeader instance. Ownership is transferred.

Definition at line 466 of file SIPExSIPEngine.cpp.

Referenced by CreateIML().

00467         {
00468         CSIPAddress* addr = CSIPAddress::DecodeL( aSipUri );
00469         CleanupStack::PushL( addr );
00470         
00471         CSIPToHeader* to = CSIPToHeader::NewL( addr );
00472         CleanupStack::Pop( addr );
00473         CleanupStack::PushL( to );
00474 
00475         return to;
00476         }

CSIPRequestElements * CSIPExSIPEngine::CreateReqElementsLC (  const TDesC8 &  aSipUri  ) 
 

CreateReqElementsLC Return a RequestElements object based on URI.

Parameters:
aSipUri  The URI address as a string.
Returns:
Pointer to CSIPRequestElements instance.

Definition at line 483 of file SIPExSIPEngine.cpp.

References ConvertToUri8LC().

Referenced by CreateIML().

00484     {
00485     CUri8* uri8 = ConvertToUri8LC( aSipUri );
00486     CSIPRequestElements* req = CSIPRequestElements::NewL( uri8 );
00487     CleanupStack::Pop( uri8 );
00488     CleanupStack::PushL( req );
00489     return req;
00490     }

CSIPMessageElements * CSIPExSIPEngine::CreateMessageElementsLC (   ) 
 

CreateMessageElementsLC Instantiate a Message Elements object.

Returns:
Pointer to CSIPMessageElements instance. Ownership is transferred.

Definition at line 497 of file SIPExSIPEngine.cpp.

References MediaFieldsL(), SdpBodyL(), and SdpDocumentLC().

Referenced by CSIPExSIPEstablishedState::EndSessionL(), and CSIPExSIPIdleState::SendInviteL().

00498         {
00499         _LIT8( KMediaType, "application" );
00500         _LIT8( KMediaSubType, "sdp" );
00501 
00502         CSIPMessageElements* msgElements = CSIPMessageElements::NewLC();
00503 
00504         CSdpDocument* sdpDocument = SdpDocumentLC();
00505         MediaFieldsL( sdpDocument );
00506 
00507     HBufC8* content = SdpBodyL( sdpDocument );
00508     CleanupStack::PushL( content );
00509 
00510         CSIPContentTypeHeader* ct =
00511                 CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType );
00512 
00513         msgElements->SetContentL( content, ct );
00514 
00515         CleanupStack::Pop( ct );
00516         CleanupStack::Pop( content );
00517         CleanupStack::PopAndDestroy( sdpDocument );
00518 
00519         return msgElements;
00520         }

CUri8 * CSIPExSIPEngine::ConvertToUri8LC (  const TDesC8 &  aSipUri  ) 
 

ConvertToUri8LC Convert textual representation of uri to CUri8

Returns:
Pointer to CUri8 instance. Ownership is transferred.

Definition at line 527 of file SIPExSIPEngine.cpp.

Referenced by CreateReqElementsLC(), and CSIPExSIPIdleState::SendInviteL().

00528     {
00529     TUriParser8 parser;
00530     User::LeaveIfError( parser.Parse( aSipUri ) ); 
00531     CUri8* uri8 = CUri8::NewLC( parser );
00532     return uri8; 
00533     }

CSdpDocument * CSIPExSIPEngine::SdpDocumentLC (   ) 
 

SdpDocumentLC Instantiate a SDP Document object.

Returns:
Pointer to CSdpDocument instance. Ownership is transferred.

Definition at line 566 of file SIPExSIPEngine.cpp.

References iLocalAddr, and SessionId().

Referenced by CSIPExSIPServerOfferingState::AcceptInviteL(), and CreateMessageElementsLC().

00567         {
00568         _LIT8( KSessionName, "SIP Example Application" );
00569 
00570         // Create SDP document
00571         CSdpDocument* sdpDocument = CSdpDocument::NewL();
00572         CleanupStack::PushL( sdpDocument );
00573 
00574         CSdpOriginField* orgField = CSdpOriginField::NewL( KSdpNoInfoDesC8(), 
00575                                                                                                            SessionId(), 0,
00576                                                                                                            iLocalAddr );
00577         sdpDocument->SetOriginField( orgField );
00578 
00579         // Set session name
00580         sdpDocument->SetSessionNameL( KSessionName );
00581 
00582         // Set connection data
00583         CSdpConnectionField* connField = CSdpConnectionField::NewL( iLocalAddr );
00584         sdpDocument->SetConnectionField( connField );
00585 
00586         return sdpDocument;
00587         }

HBufC8 * CSIPExSIPEngine::SdpBodyL (  CSdpDocument *  aDocument  ) 
 

SdpBodyL Return SDP message body in textual form.

Returns:
Pointer to SDP Document as HBufC8. Ownership is transferred.

Definition at line 620 of file SIPExSIPEngine.cpp.

Referenced by CSIPExSIPServerOfferingState::AcceptInviteL(), and CreateMessageElementsLC().

00621         {
00622         HBufC8* sdpBuf = NULL;
00623 
00624         // Build the message body using buffer writer
00625         if ( aDocument->IsValid() )
00626                 {
00627                 CBufFlat* enBuf = CBufFlat::NewL( 1000 );
00628                 CleanupStack::PushL( enBuf );
00629                 RBufWriteStream writeStream;
00630                 writeStream.Open( *enBuf, 0 );
00631                 aDocument->EncodeL( writeStream );
00632                 writeStream.Close();
00633                 TPtr8 ptr = enBuf->Ptr( 0 );
00634                 sdpBuf = ptr.AllocL();
00635                 CleanupStack::PopAndDestroy( enBuf );
00636                 writeStream.Close();
00637                 }
00638 
00639         return sdpBuf;
00640         }

RStringPool CSIPExSIPEngine::StringPoolL (   ) 
 

Get SDP codec string pool. Open string pool if not opened.

Returns:
String pool.

Definition at line 693 of file SIPExSIPEngine.cpp.

Referenced by ConstructL(), and MediaFieldsL().

00694         {
00695         TRAPD( error, SdpCodecStringPool::OpenL() );
00696         if ( error == KErrAlreadyExists )
00697                 {
00698                 return SdpCodecStringPool::StringPoolL();
00699                 }
00700         else if ( error == KErrNone )
00701                 {
00702                 //Add missing string to the pool then return it
00703                 return SdpCodecStringPool::StringPoolL();
00704                 }
00705         else
00706                 {
00707                 User::Leave( error );
00708                 return SdpCodecStringPool::StringPoolL(); //Return here to omit warning
00709                 }
00710         }

const TInetAddr CSIPExSIPEngine::IPAddressFromResponseElementsL (  const CSIPResponseElements &  aRespElem  ) 
 

IPAddressFromResponseElementsL Get IP Address from the Response Elements received from peer.

Parameters:
aRespElem  The Response Elements.

Definition at line 662 of file SIPExSIPEngine.cpp.

Referenced by CSIPExSIPClientOfferingState::ResponseReceivedL(), and CSIPExSIPClientEstablishingState::ResponseReceivedL().

00664         {
00665         ;
00666         // First, retrieve remote party IP Address
00667         // Get Message Elements from Response Elements
00668         const CSIPMessageElements& msgElem = aRespElem.MessageElements();
00669 
00670         // Get message content from Message Elements
00671         const TDesC8& content = msgElem.Content();
00672 
00673         // Get the SDP Document from the message content                
00674         CSdpDocument* SDPDoc = CSdpDocument::DecodeLC( content );
00675 
00676         // Get the Connection Field from the SDP Document
00677         CSdpConnectionField* connField = SDPDoc->ConnectionField();
00678 
00679         // And, finally, get the IP Address from the Connection Field
00680         const TInetAddr* addr = connField->InetAddress();
00681         const TInetAddr inetAddr = *addr;
00682 
00683         CleanupStack::PopAndDestroy( SDPDoc );
00684 
00685         return inetAddr;
00686         }

MSIPExSIPEngineObserver * CSIPExSIPEngine::Observer (   ) 
 

Observer Return a pointer to the Engine Observer class.

Definition at line 717 of file SIPExSIPEngine.cpp.

References iObserver.

Referenced by CSIPExSIPServerOfferingState::AcceptInviteL(), CSIPExSIPServerEstablishingState::AckReceivedL(), CSIPExSIPEstablishedState::AckReceivedL(), CSIPExSIPServerOfferingState::ByeReceivedL(), CSIPExSIPServerEstablishingState::ByeReceivedL(), CSIPExSIPEstablishedState::ByeReceivedL(), CSIPExSIPClientOfferingState::CancelInviteL(), CSIPExSIPClientEstablishingState::CancelInviteL(), CSIPExSIPServerOfferingState::CancelReceivedL(), CSIPExSIPServerEstablishingState::CancelReceivedL(), CSIPExSIPServerOfferingState::DeclineInviteL(), CSIPExSIPIdleState::InviteReceivedL(), CSIPExSIPTerminatingState::ResponseReceivedL(), CSIPExSIPEstablishedState::ResponseReceivedL(), CSIPExSIPClientOfferingState::ResponseReceivedL(), and CSIPExSIPClientEstablishingState::ResponseReceivedL().

00718         {
00719         return iObserver;
00720         }

TInt64 CSIPExSIPEngine::SessionId (   )  [private]
 

SessionId Return the Session ID

Definition at line 540 of file SIPExSIPEngine.cpp.

References iSessionId.

Referenced by SdpDocumentLC().

00541         {
00542         if ( iSessionId > 0 )
00543                 {
00544                 return iSessionId;
00545                 }
00546         else
00547                 {
00548                 // Create a random number as the session ID
00549                 TTime now;
00550                 now.HomeTime();
00551                 TInt64 seed = now.Int64();
00552 
00553                 TInt random = Math::Rand( seed );
00554                 iSessionId = random;
00555                 return iSessionId;
00556                 }
00557         }

CSIPConnection * CSIPExSIPEngine::CurrentConnection (   )  [private]
 

CurrentConnection returns currently used connection. Can be used also for checking if connection exists. Returns either iConnection, iNotOwnedConnection or NULL

Definition at line 647 of file SIPExSIPEngine.cpp.

References iConnection.

Referenced by ConnectionL(), and IncomingRequest().

00648     {
00649     if ( iConnection )
00650         {
00651         return iConnection;
00652         }
00653         
00654     return 0;
00655     }

void CSIPExSIPEngine::HandleProfileRegistered (  TUint32  aSIPProfileId  )  [private]
 

Handle SIP profile registration event

Parameters:
aSIPProfileId  id of registered profile

Definition at line 1157 of file SIPExSIPEngine.cpp.

References iObserver, iProfile, and MSIPExSIPEngineObserver::ProfileEnabled().

Referenced by ProfileRegistryEventOccurred().

01158         {
01159     TUint32 profileId( 0 );
01160         iProfile->GetParameter( KSIPProfileId, profileId );
01161     if ( aSIPProfileId == profileId )
01162         {
01163                 // The profile registration is complete
01164                 // Inform the Engine Observer
01165                 iObserver->ProfileEnabled( aSIPProfileId );
01166         }
01167         }

void CSIPExSIPEngine::HandleProfileDeregistered (  TUint32  aSIPProfileId  )  [private]
 

Handle SIP profile deregistration event

Parameters:
aSIPProfileId  id of deregistered profile

Definition at line 1173 of file SIPExSIPEngine.cpp.

References iConnection, iDialogAssoc, iObserver, iProfile, and MSIPExSIPEngineObserver::ProfileError().

Referenced by ProfileRegistryEventOccurred().

01174         {
01175         TUint32 profileId( 0 );
01176         iProfile->GetParameter( KSIPProfileId, profileId );
01177     if ( aSIPProfileId == profileId )
01178         {
01179                 // The previously registered profile has
01180                 // become unregistered.
01181         delete iDialogAssoc;
01182         iDialogAssoc = 0;
01183         delete iConnection;
01184         iConnection = 0;
01185         //iNotOwnedConnection = 0;
01186         delete iProfile;
01187         iProfile = 0;
01188         
01189         iObserver->ProfileError( KErrGeneral );         
01190         }
01191         }

void CSIPExSIPEngine::HandleProfileDestroyed (  TUint32  aSIPProfileId  )  [private]
 

Handle SIP profile destruction event. Event is send to those observers, who have the corresponding profile instantiated.

Parameters:
aSIPProfileId  id of profile which was destroyed

Definition at line 1197 of file SIPExSIPEngine.cpp.

References iConnection, iDialogAssoc, iObserver, iProfile, and MSIPExSIPEngineObserver::ProfileError().

Referenced by ProfileRegistryEventOccurred().

01198         {
01199         delete iDialogAssoc;
01200         iDialogAssoc = 0;
01201         delete iConnection;
01202         iConnection = 0;
01203         //iNotOwnedConnection = 0;
01204         delete iProfile;
01205         iProfile = 0;
01206 
01207         iObserver->ProfileError( KErrGeneral );
01208         }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top