sipvoipprovider/inc/svpsessionbase.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Session base class for SVP MO and MT sessions. Contains methods 
       
    15 *                common for SVP MO and MT sessions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef SVPSESSIONBASE_H
       
    21 #define SVPSESSIONBASE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <mccpcall.h>
       
    25 #include <mccpssobserver.h>
       
    26 #include <mccpdtmfobserver.h> 
       
    27 
       
    28 #include "svpsessionobserver.h"
       
    29 #include "svpholdobserver.h"
       
    30 #include "svptransferobserver.h"
       
    31 #include "svptimer.h"
       
    32 #include "svptimerobserver.h"
       
    33 #include "svppropertywatchobserver.h"
       
    34 #include "svpvolumeupdateobserver.h"
       
    35 #include "svpdtmfeventobserver.h"
       
    36 #include "svputdefs.h"
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class TMceTransactionDataContainer;
       
    40 class CSVPUtility;
       
    41 class CSVPRtpObserver;
       
    42 class CSVPHoldController;
       
    43 class MCCPCallObserver;
       
    44 class MCCPSsObserver;
       
    45 class CSVPTransferController;
       
    46 class CMceInRefer;
       
    47 class CSVPVolumeObserver;
       
    48 class CSVPPropertyWatch;
       
    49 class CSVPDTMFEventGenerator;
       
    50 class CMceSession;
       
    51 class CMceMediaStream;
       
    52 class CMceMediaSink;
       
    53 class CMceMediaSource;
       
    54 class CMceEvent;
       
    55 class CMceRefer;
       
    56 class CDesC8Array;
       
    57 
       
    58 /**
       
    59  *  SVP Session base
       
    60  *
       
    61  *  Base class for SVP MT and MO sessions.
       
    62  *
       
    63  *  @lib svp.dll
       
    64  *  @since S60 3.2
       
    65  */
       
    66 class CSVPSessionBase : public CBase,
       
    67                         public MCCPCall,
       
    68                         public MSVPTransferObserver,
       
    69                         public MSVPHoldObserver,
       
    70                         public MSVPTimerObserver,
       
    71                         public MSVPPropertyWatchObserver,
       
    72                         public MSVPVolumeUpdateObserver,
       
    73                         public MSVPDTMFEventObserver
       
    74                        
       
    75     {
       
    76 
       
    77 public:
       
    78     
       
    79     /**
       
    80     * C++ default constructor.
       
    81     */
       
    82     CSVPSessionBase( TMceTransactionDataContainer& aContainer,
       
    83                      MSVPSessionObserver& aObserver, 
       
    84                      CSVPUtility& aSVPUtility,
       
    85                      CSVPRtpObserver& aRtpObserver );
       
    86     
       
    87     /**
       
    88     * Destructor.
       
    89     */
       
    90     virtual ~CSVPSessionBase();
       
    91     
       
    92 public: // new functions    
       
    93     
       
    94     /**
       
    95      * Saves updated Mce session in cases where re-INVITE without
       
    96      * SDP is received
       
    97      * @Since S60 3.2
       
    98      * @param aUpdatedSession Session that is under update
       
    99      */
       
   100     void SetUpdatedSession( CMceInSession* aUpdatedSession );
       
   101     
       
   102     /**
       
   103     * Releases temporary secure session stored 
       
   104     * after secure session trial failed
       
   105     * @since Series 60 3.2
       
   106     */
       
   107     void ReleaseTempSecure();
       
   108     
       
   109     /**
       
   110     * Returns Mce session 
       
   111     * @Since S60 3.2
       
   112     * @param
       
   113     * @return instance of session
       
   114     */
       
   115     const CMceSession& Session() const;
       
   116     
       
   117     /**
       
   118     * Construcst audiostreams for MT and MO session
       
   119     * @since Series 60 3.2
       
   120     * @param None
       
   121     * @return 
       
   122     */   
       
   123     void ConstructAudioStreamsL();
       
   124 
       
   125     /**
       
   126     * Starts SVP timer
       
   127     * @since Series 60 3.2
       
   128     * @param aMilliSeconds
       
   129     * @param aTimerId
       
   130     * @return 
       
   131     */
       
   132     void StartTimerL( TInt aMilliSeconds, TInt aTimerId );
       
   133 
       
   134     /**
       
   135      * Stop specified SVP timer
       
   136      * @since Series 60 3.2
       
   137      * @param aTimerId The ID of the timer to stop.
       
   138      */
       
   139      void StopTimer( TInt aTimerId );
       
   140      
       
   141      /**
       
   142      * Stops started timers
       
   143      * @since Series 60 3.2
       
   144      * @return 
       
   145      */
       
   146      void StopTimers();
       
   147      
       
   148      /**
       
   149      * Returns correct timer value (RFC 3261 chapter 14.1)
       
   150      * @since Series 60 3.2
       
   151      * @return 
       
   152      */
       
   153      TInt ReinviteCrossoverTime();     
       
   154      
       
   155     /**
       
   156      * Sets observer for supplementary services events
       
   157      * @since Series 60 3.2
       
   158      * @return
       
   159      */ 
       
   160     void SetSsObserver( const MCCPSsObserver& aObserver );
       
   161     
       
   162     /**
       
   163      * Gets supplementary services events observer of session
       
   164      * @since Series 60 3.2
       
   165      * @return MCCPSsObserver supplementary services events observer
       
   166      */ 
       
   167     const MCCPSsObserver& GetSsObserver( );
       
   168     
       
   169     /**
       
   170     * Sets CCP DTMF observer to session
       
   171     * @since Series 60 3.2
       
   172     * @return 
       
   173     */
       
   174     void SetDtmfObserver( const MCCPDTMFObserver& aObserver );
       
   175     
       
   176     /**
       
   177     * Gets CCP DTMF observer 
       
   178     * @since Series 60 3.2
       
   179     * @return MCCPDTMFObserver CCP DTMF observer
       
   180     */
       
   181     const MCCPDTMFObserver& DtmfObserver();
       
   182     
       
   183     /**
       
   184     * Handles session state changes 
       
   185     * @since Series 60 3.2
       
   186     * @param aStatusCode Status code
       
   187     * @return 
       
   188     */
       
   189     void SessionStateChanged( TInt aStatusCode );
       
   190 
       
   191     /**
       
   192     * Handles session state changed announcement.
       
   193     * @since Series60 3.2
       
   194     * @param aSession MCE session
       
   195     * @return void
       
   196     */
       
   197     void HandleSessionStateChanged( CMceSession& aSession );
       
   198     
       
   199     /**
       
   200      * Handles the state change of a given stream.
       
   201      * @since S60 v3.2
       
   202      * @param aStream Stream whose state has changed.
       
   203      * @return void
       
   204      **/
       
   205     void HandleStreamStateChange( CMceMediaStream& aStream );
       
   206     
       
   207     /**
       
   208      * Handles the state change of a given stream & sink.
       
   209      * @since S60 v3.2
       
   210      * @param aStream Stream whose state has changed.
       
   211      * @param aSink Sink which is either Enabled or Disabled.
       
   212      * @return void
       
   213      **/
       
   214     void HandleStreamStateChange( CMceMediaStream& aStream,
       
   215             CMceMediaSink& aSink );
       
   216     
       
   217     /**
       
   218      * Handles the state change of a given stream & source
       
   219      * @since S60 v3.2
       
   220      * @param aStream Stream whose state has changed.
       
   221      * @param aSource Source which is either Enabled or Disabled.
       
   222      * @return void
       
   223      **/
       
   224     void HandleStreamStateChange( CMceMediaStream& aStream,
       
   225             CMceMediaSource& aSource );
       
   226     
       
   227     /**
       
   228     * Handles remote action after session is established.
       
   229     * @since Series60 3.2
       
   230     * @param None
       
   231     * @return
       
   232     */
       
   233     TInt IncomingRequest( CMceInSession& aUpdatedSession );
       
   234     
       
   235     /**
       
   236     * Returns Hold session 
       
   237     * @Since S60 3.2
       
   238     * @param None
       
   239     * @return Reference to the session hold controller
       
   240     */
       
   241     CSVPHoldController& HoldController() const;
       
   242     
       
   243     /**
       
   244     * Finds out if the session has hold controller
       
   245     * @since Series60 3.2
       
   246     * @param None
       
   247     * @return ETrue if session has hold controller, EFalse otherways
       
   248     */
       
   249     TBool HasHoldController() const;
       
   250 
       
   251     /**
       
   252      * Returns ETrue if session is muted
       
   253      * @since Series 60 3.2
       
   254      * @return TBool iMuted value
       
   255      */
       
   256     TBool IsSessionMuted() const;
       
   257 
       
   258     /**
       
   259     * Handles the event state changes.
       
   260     * @since Series 60 3.2
       
   261     * @param aEvent, the event that has changed.
       
   262     * @param aStatusCode, status code
       
   263 	* @return KErrNone if succesfull, otherwise error code
       
   264     */
       
   265     TInt EventStateChanged( CMceEvent& aEvent,
       
   266 				            TInt aStatusCode ); 
       
   267 
       
   268     /**
       
   269     * Handles the received notify.
       
   270     * @since Series 60 3.2
       
   271     * @param aEvent, the event that has changed.
       
   272     * @param aContainer, if present, holds details of received notify.
       
   273     */
       
   274     void NotifyReceived( CMceEvent& aEvent,
       
   275                             TMceTransactionDataContainer* aContainer );
       
   276 				
       
   277     /**
       
   278     * Handles the refer state changes.
       
   279     * @since Series 60 3.2
       
   280     * @param aRefer, the refer that has changed.
       
   281     * @param aStatusCode, status code
       
   282     */
       
   283     void ReferStateChanged( CMceRefer& aRefer,
       
   284 				            TInt aStatusCode ); 
       
   285     
       
   286 
       
   287     /**
       
   288     * Return the data container.
       
   289     * When session is the target session of the attended transfer.
       
   290     * @since Series 60 3.2
       
   291     * @return the mce data container
       
   292     */
       
   293     TMceTransactionDataContainer& MceTransactionDataContainer(); 
       
   294     
       
   295     /**
       
   296      * New incoming refer received.
       
   297      * @since Series 60 3.2
       
   298 	 * @param aRefer, the new inbound refer. Ownership is
       
   299 	 *	      transferred.
       
   300      * @param aReferTo SIP specific Refer-to header 
       
   301      * @param aContainer, if present, holds details of incoming refer.
       
   302      */
       
   303     void IncomingReferL( CMceInRefer* aRefer,
       
   304                         const TDesC8& aReferTo,
       
   305                         TMceTransactionDataContainer* aContainer );
       
   306     
       
   307     /**
       
   308      * Checks the MCE refer object.
       
   309      * @since S60 3.2
       
   310      * @param aRefer - refer to check
       
   311      * @return TBool true if same MCE refer object
       
   312      */
       
   313     TBool IsMceRefer( CMceRefer& aRefer ); 
       
   314     
       
   315     /**
       
   316      * Indicates whether call is secured or not
       
   317      * @since S60 3.2
       
   318      * @return TBool ETrue if call is secured
       
   319      */
       
   320     TBool SecureMandatory() const;
       
   321     
       
   322     /**
       
   323      * Is secure call prefered
       
   324      * @since S60 3.2
       
   325      * @return TBool ETrue is secure call is prefered
       
   326      */    
       
   327     TBool SecurePreferred() const;
       
   328     
       
   329     /**
       
   330      * Set secure mandatody flag true or false
       
   331      * @since S60 3.2
       
   332      * @param aSecMandatory flag value
       
   333      */   
       
   334     void SetSecureMandatory( TBool aSecMandatory );
       
   335     
       
   336     /**
       
   337      * Sets secure preferred flag true or false
       
   338      * @since S60 3.2
       
   339      * @param aSecPreferred flag value
       
   340      */    
       
   341     void SetSecurePreferred( TBool aSecPreferred );
       
   342     
       
   343     /**
       
   344      * Sets call event to be sent, used in secure and attended transfer cases.
       
   345      * @since S60 3.2
       
   346      * @param aCallEventToBeSent event value
       
   347      */   
       
   348     void SetCallEventToBeSent( MCCPCallObserver::TCCPCallEvent aCallEventToBeSent );
       
   349 
       
   350     /**
       
   351      * Checks if transfer is attended or unattended.
       
   352      * @since S60 3.2
       
   353      * @return TBool true if attended case
       
   354      */
       
   355     TBool IsAttended( ); 
       
   356 
       
   357     /**
       
   358     * The new recipient of the call can be fetched via this method.
       
   359     * @since S60 3.2
       
   360     * @param none
       
   361     * @return New recipient for the call after transfer
       
   362     */
       
   363     const TDesC& TransferTarget() const;
       
   364 
       
   365     /**
       
   366     * Set transfer data. Add Replaces and Referred-By headers.
       
   367     * Update transfer target url to sips: if secure status 1 or 2,
       
   368     * otherwise url updated to sip:
       
   369     * @since S60 3.2
       
   370     * @param aUserAgentHeaders On completion contains collected transfer headers.
       
   371     * @param aSecureStatus secure status
       
   372     */
       
   373     void SetTransferDataL( CDesC8Array* aUserAgentHeaders, TInt aSecureStatus );
       
   374 
       
   375     /**
       
   376     * Send notify incoming transfer case.
       
   377 	* @param aStatusCode code coming from mce
       
   378     * @since Series60 3.2
       
   379     */
       
   380     void SendNotify( TInt aStatusCode );
       
   381     
       
   382     /**
       
   383     * Finds out if the session has incoming transfer ongoing
       
   384     * @since Series60 3.2
       
   385     * @return ETrue if incoming transfer ongoing, EFalse otherways
       
   386     */
       
   387     TBool IsIncomingTransfer();
       
   388     
       
   389 	/**
       
   390 	* Sets the FromHeader data
       
   391 	* @since S60 3.2
       
   392 	* @param aFromHeader reference to the FromHeader data to store
       
   393 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   394 	*/
       
   395     TInt SetFromHeader( const TDesC8& aFromHeader );
       
   396 
       
   397 	/**
       
   398     * Returns the FromHeader data. 
       
   399 	* @since S60 3.2
       
   400 	* @return pointer to FromHeader data
       
   401 	*/
       
   402     TDesC8* FromHeader();
       
   403 
       
   404 	/**
       
   405 	* Sets the ToHeader data
       
   406 	* @since S60 3.2
       
   407 	* @param aToHeader reference to the ToHeader data to store
       
   408 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   409 	*/
       
   410     TInt SetToHeader( const TDesC8& aToHeader );
       
   411 
       
   412 	/**
       
   413     * Returns the ToHeader data. 
       
   414 	* @since S60 3.2
       
   415 	* @return pointer to ToHeader data
       
   416 	*/
       
   417     TDesC8* ToHeader();
       
   418     
       
   419 	/**
       
   420 	* Sets the CallId data
       
   421 	* @since S60 3.2
       
   422 	* @param aCallId reference to the CallId data to store
       
   423 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   424 	*/
       
   425     TInt SetCallId( const TDesC8& aCallId );
       
   426 
       
   427 	/**
       
   428 	* Returns the CallId data. 
       
   429 	* @since S60 3.2
       
   430 	* @return pointer to CallId data
       
   431 	*/
       
   432     TDesC8* CallId();    
       
   433     
       
   434     /**
       
   435 	* Sets the CSeq header data
       
   436 	* @since S60 3.2
       
   437 	* @param aCSeq reference to the CSeq header data to store
       
   438 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   439 	*/
       
   440     TInt SetCSeqHeader( const TDesC8& aCSeq );
       
   441     
       
   442     /**
       
   443     * Returns the CSeqHeader data. 
       
   444 	* @since S60 3.2
       
   445 	* @return reference to CSeqHeader data
       
   446 	*/
       
   447     const TDesC& CSeqHeader() const;    
       
   448     
       
   449     /**
       
   450     * Method for setting crypto context to secure session
       
   451     * @since S60 3.2
       
   452     */
       
   453     void SetCryptoContextL();
       
   454   
       
   455 	/**
       
   456     * Gets CCP session observer 
       
   457     * @since Series 60 3.2
       
   458     * @return CCP session observer.
       
   459     */
       
   460     MCCPCallObserver& GetCCPSessionObserver( );
       
   461     
       
   462     /**
       
   463     * Handles update failure 
       
   464     * @since Series 60 3.2
       
   465     * @param aSession MCE session reference
       
   466     * @param aStatusCode Status code of the response received
       
   467     * @return None
       
   468     */
       
   469     void UpdateFailed( CMceSession& aSession, TInt aStatusCode );
       
   470     
       
   471     /**
       
   472      * Returns session keepalive timer value
       
   473      * @since Series 60 3.2
       
   474      * @return TInt returns keepalive timer value
       
   475      */
       
   476     TInt GetKeepAliveTime();
       
   477     
       
   478     /**
       
   479      * SVP received INVITE without SDP, this flag is set to
       
   480      * prevent extra incomingcall callback to CCE
       
   481      * @since Series 60 3.2
       
   482      * @return none
       
   483      */
       
   484     void SetEmptyReInvite();
       
   485     
       
   486     /**
       
   487      * Returns ETrue if empty re-INVITE was received by SVP
       
   488      * @since Series 60 3.2
       
   489      * @return TBool Flag value
       
   490      */
       
   491     TBool IsEmptyReInvite();
       
   492     
       
   493     /**
       
   494      * Returns ETrue if iSessionState is still in initial state.
       
   495      * @since Series 60 3.2
       
   496      * @return TBool Flag value
       
   497      */
       
   498     TBool IsIdle();
       
   499 
       
   500     /**
       
   501      * Returns ETrue if anonymous call is on.
       
   502      * @since Series 60 9.2
       
   503      * @return TBool Flag value
       
   504      */
       
   505     TBool IsCLIROnL() const;
       
   506 
       
   507 // dtmf
       
   508 
       
   509     /**
       
   510 	* Cancels asynchronous DTMF string sending.
       
   511 	* @since Series 60 3.2
       
   512 	* @return KErrNone is successful, otherwiee antoher system wide error code
       
   513 	*/
       
   514 	TInt CancelDtmfStringSending();
       
   515 
       
   516 	/**
       
   517 	* Starts the transmission of a single DTMF tone across a
       
   518 	* connected and active call.
       
   519 	* @since S60 3.2
       
   520 	* @param aTone Tone to be played.
       
   521 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   522 	*/
       
   523 	TInt StartDtmfTone( const TChar aTone );
       
   524 
       
   525 	/**
       
   526 	* Stops playing current DTMF tone.
       
   527 	* @since S60 3.2
       
   528     * @param none
       
   529 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   530 	*/
       
   531 	TInt StopDtmfTone();
       
   532 
       
   533 	/**
       
   534 	* Plays DTMF string.
       
   535 	* @since S60 3.2
       
   536 	* @param aString String to be played.
       
   537 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   538 	* KErrArgument if the specified string contains illegal DTMF characters
       
   539 	*/
       
   540 	TInt SendDtmfToneString( const TDesC& aString );  
       
   541     
       
   542 	// from SVPDTMFEventObserver
       
   543     void InbandDtmfEventOccurred( TSVPDtmfEvent aEvent );
       
   544     
       
   545 public: // from base classes: timerobserver
       
   546     
       
   547     /**
       
   548     * Notifies, that the previously set timer has now expired.
       
   549     * Implemented by the class using the timer.
       
   550     * @since Series 60 3.2
       
   551     * @param TInt aTimerId The ID of the timer. Observer can identify 
       
   552     * timers from each other with this ID.
       
   553     * @return 
       
   554     */
       
   555     void TimedOut( TInt aTimerId ); 
       
   556 
       
   557 public: // from MSVPVolumeUpdateObserver
       
   558  
       
   559     /**
       
   560      * CSVPVolumeObserver calls this when volume level changes
       
   561      * changed. 
       
   562      *
       
   563      * @since S60 3.2
       
   564      * @param aVolume New volume level
       
   565      */
       
   566      void VolumeChanged( TInt aVolume );
       
   567     
       
   568 public: // from base classes: MCCPCall
       
   569 		
       
   570     /**
       
   571     * Return if call secure status is specified or not.
       
   572     * @since Series 60 5.0
       
   573     * @param None
       
   574     * @return TBool ETrue if security is specified, else EFalse.
       
   575     */
       
   576     TBool SecureSpecified() const;
       
   577 	    
       
   578 	/**
       
   579     * Sets CCP call observer 
       
   580     * @since Series 60 3.2
       
   581     * @param aObserver observer to be set
       
   582     * @return 
       
   583     */
       
   584     void AddObserverL( const MCCPCallObserver& aObserver );
       
   585     
       
   586     /**
       
   587     * Remove an observer.
       
   588     * @since S60 v3.2
       
   589     * @param none
       
   590     * @param aObserver Observer
       
   591     * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
       
   592     * Any other system error depending on the error.
       
   593     */
       
   594     TInt RemoveObserver( const MCCPCallObserver& aObserver );
       
   595         
       
   596     /**
       
   597     * Answers to an incoming call.
       
   598     * @since Series60 3.2
       
   599     * @return KErrNotSupported
       
   600     */
       
   601     virtual TInt Answer();
       
   602 
       
   603     /**
       
   604     * Starts dialing to recipient
       
   605     * @since Series60 3.2
       
   606     * @return KErrNone or system wide error code
       
   607     */
       
   608     virtual TInt Dial();
       
   609 
       
   610 	/**
       
   611 	* Cancels ongoing dial or answer request
       
   612 	* @since Series60 3.2
       
   613 	* @return KErrNone or system wide error code
       
   614 	*/
       
   615 	virtual TInt Cancel();
       
   616 
       
   617     /**
       
   618     * Ends an ongoing call.
       
   619     * @since Series60 3.2
       
   620     * @return KErrNone or system wide error code
       
   621     */
       
   622     virtual TInt HangUp();
       
   623 
       
   624     /**
       
   625     * Rejects an incoming call.
       
   626     * @since Series 60 3.2
       
   627     * @return KErrNone or system wide error code
       
   628     */
       
   629     virtual TInt Reject();
       
   630 
       
   631     /**
       
   632     * Reguests plug-in to queue the call. 
       
   633     * @since S60 3.2
       
   634     * @return KErrNone or system wide error code
       
   635     */
       
   636     virtual TInt Queue();
       
   637 
       
   638     /**
       
   639     * Call is ringning
       
   640     * @since S60 3.2
       
   641     * @return KErrNone or system wide error code 
       
   642     */
       
   643     virtual TInt Ringing();
       
   644 
       
   645     /**
       
   646     * Puts the specified call on hold.
       
   647     * @since Series60 3.2
       
   648     * @return KErrNone or system wide error code 
       
   649     */
       
   650     virtual TInt Hold();
       
   651 
       
   652     /**
       
   653     * Resumes the call.
       
   654     * @since Series60 3.2
       
   655     * @return KErrNone or system wide error code
       
   656     */
       
   657     virtual TInt Resume();
       
   658     
       
   659     /**
       
   660     * Swaps a connected call to its opposite state, either active or on hold
       
   661     * @since Series60 3.2
       
   662     * @return KErrNone or system wide error code 
       
   663     */
       
   664     virtual TInt Swap();
       
   665 
       
   666     /**
       
   667     * Releases all bindings to call and calls destructor
       
   668     * @since Series60 3.2
       
   669     * @return KErrNone  
       
   670     */
       
   671     virtual TInt Release();
       
   672 
       
   673     /**
       
   674     * Returns the recipient of the call.
       
   675     * @since Series60 3.2
       
   676     * @return recipient address,
       
   677     */
       
   678     virtual const TDesC& RemoteParty() const;
       
   679 
       
   680     /**
       
   681     * Returns display name of the recipient of the call.
       
   682     * @since Series60 3.2
       
   683     * @return Recipient's display name
       
   684     */
       
   685     virtual const TDesC& RemotePartyName();
       
   686 
       
   687     /**
       
   688     * Returns the original dialled party.
       
   689     * @since Series60 3.2
       
   690     * @return Dialled party,
       
   691     */
       
   692     virtual const TDesC& DialledParty() const;
       
   693 
       
   694 	/**
       
   695     * Return boolean value, is incoming call forwarded or not.
       
   696     * @since Series60 3.2
       
   697     * @return ETrue if call is forwarded, else EFalse
       
   698     */
       
   699     virtual TBool IsCallForwarded() const;
       
   700 
       
   701     /**
       
   702     * Returns boolean value, is the call mobile originated.
       
   703     * @since Series60 3.2
       
   704     * @return ETrue if call is mobile originated, otherwise EFalse
       
   705     */
       
   706     virtual TBool IsMobileOriginated() const;
       
   707 
       
   708     /**
       
   709     * Returns the state of the call.
       
   710     * @since Series60 3.2
       
   711     * @return TCCPCallState The current state of the call
       
   712     */
       
   713     virtual MCCPCallObserver::TCCPCallState State() const;
       
   714 
       
   715     /**
       
   716     * Returns TUid of the Plug-In used for this call
       
   717     * @since Series60 3.2
       
   718     * @return TUid Implementation UID of the Plug-In
       
   719     */
       
   720     virtual TUid Uid() const;
       
   721 
       
   722     /**
       
   723     * Returns call control caps for this call This tells for CCE what call can
       
   724     * currently do.
       
   725     * @since Series60 3.2
       
   726     * @return Call control caps defined in MCCPCallObserver::TCCPCallControlCaps.
       
   727     */
       
   728     virtual MCCPCallObserver::TCCPCallControlCaps Caps() const;
       
   729 
       
   730     /**
       
   731     * Get call's secure status.
       
   732     * @since Series 60 3.2
       
   733     * @return TBool ETrue if security is enabled, else EFalse.
       
   734     */
       
   735     virtual TBool IsSecured() const;
       
   736 
       
   737     /**
       
   738 	* Get Conference extension methods
       
   739 	* @since Series 60 3.2
       
   740 	* @return Pointer to MCCPCSCallConfernece if succesfull, NULL if not available
       
   741 	*/
       
   742 	virtual MCCPConferenceCall* ConferenceProviderL( const MCCPConferenceCallObserver& aObserver );
       
   743    
       
   744     /**
       
   745 	* Get Forward provider
       
   746 	* @since Series 60 3.2
       
   747 	* @return Pointer to MCCPForwardProvider if succesfull, NULL if not available
       
   748 	*/
       
   749 	virtual MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
       
   750 	
       
   751 	
       
   752 	 /**
       
   753     * Get Call transfer provider
       
   754     * @since Series 60 3.2
       
   755     * @return Pointer to MCCPTransferProvider if succesfull, NULL if not available
       
   756     */
       
   757 	MCCPTransferProvider* TransferProviderL( const MCCPTransferObserver& aObserver );
       
   758 	
       
   759 	
       
   760 	/**
       
   761 	* Set call parameters.
       
   762 	* @since S60 3.2
       
   763 	* @param aNewParams New call paramater information.
       
   764 	*/
       
   765     void SetParameters( const CCCPCallParameters& aNewParams );
       
   766 
       
   767     /**
       
   768 	* Cet call parameters.
       
   769 	* @since S60 3.2
       
   770 	* @param None
       
   771 	* @return Current call paramater information.
       
   772 	*/
       
   773     virtual const CCCPCallParameters& Parameters() const;
       
   774 
       
   775     /**
       
   776     * Returns currently used tone for the call. Used in case tones are needed to be played.
       
   777 	* See defenition for TCCPTone.
       
   778     * @since S60 3.2
       
   779     * @param None.
       
   780     * @return TCCPTone Used tone.
       
   781     */
       
   782     TCCPTone Tone() const;
       
   783 
       
   784 public: // from SVPHoldObserver
       
   785 
       
   786     /**
       
   787     * Notifies, that session has been holded.
       
   788     * @since Series 60 3.2
       
   789     */
       
   790     virtual void SessionLocallyHeld();
       
   791 
       
   792     /**
       
   793     * Notifies, that session has been resumed.
       
   794     * @since Series 60 3.2
       
   795     */
       
   796     virtual void SessionLocallyResumed();
       
   797     
       
   798     /**
       
   799     * Notifies, that session has been remotely held.
       
   800     * @since Series 60 3.2
       
   801     */
       
   802     virtual void SessionRemoteHeld();
       
   803 
       
   804     /**
       
   805     * Notifies, that session has been remotely resumed.
       
   806     * @since Series 60 3.2
       
   807     */
       
   808     virtual void SessionRemoteResumed();
       
   809     
       
   810     /**
       
   811     * Notifies, that hold request failed.
       
   812     * @since Series 60 3.2
       
   813     */
       
   814     virtual void HoldRequestFailed();
       
   815  
       
   816     /**
       
   817     * Notifies, that resume request failed.
       
   818     * @since Series 60 3.2
       
   819     */
       
   820     virtual void ResumeRequestFailed();
       
   821 
       
   822          
       
   823 public: // from MSVPTransferObserver
       
   824          
       
   825     /**
       
   826     * From MSVPTransferObserver
       
   827     * Notifier for succesful transfer.
       
   828     * @since Series60 3.2
       
   829     * @param aNotifyCode The transfer notify code
       
   830     */
       
   831     virtual void TransferNotification( TInt aNotifyCode );
       
   832 
       
   833     /**
       
   834     * From MSVPTransferObserver
       
   835     * Notifier for transfer failure.
       
   836     * @since Series60 3.2
       
   837     * @param aError The error Id.    
       
   838     */
       
   839     virtual void TransferFailed( TInt aError );     
       
   840     
       
   841 public: // from MSVPPropertyWatchObserver   
       
   842     
       
   843     /**
       
   844     * CSVPPropertyWatch calls this when some property under watching was
       
   845     * changed. 
       
   846     *
       
   847     * @since S60 3.2
       
   848     * @param aKey Property which was changed
       
   849     * @param aValue New value of the property
       
   850     */
       
   851     void ValueChangedL( TInt aKey, TInt aValue );
       
   852     
       
   853     /**
       
   854     * CSVPPropertyWatch calls this when property was deleted.
       
   855     *
       
   856     * @since S60 3.2
       
   857     * @param aKey Property which was deleted
       
   858     */
       
   859     void PropertyDeleted( TInt aKey );
       
   860 
       
   861 protected: // new methods
       
   862 
       
   863     /**
       
   864      * Updates keepalive parameters for session
       
   865      * @since Series 60 3.2
       
   866      * @param aSession Session to be updated
       
   867      * @param aSessionUpdateOngoing Determines whether session needs to be updated
       
   868      * @return 
       
   869      */
       
   870     void UpdateKeepAliveL( CMceSession& aSession, TBool aSessionUpdateOngoing );
       
   871 
       
   872     /**
       
   873      * Worker function for session state change, called from
       
   874      * SessionStateChanged().
       
   875      * @since S60 v3.2
       
   876      * @param aOrigStatus Original status code
       
   877      * @param aError Mapped TCCPError
       
   878      * @param aModStatus Modified status code
       
   879      * @return void
       
   880      */
       
   881     virtual void SessionStateChangedL( TInt aOrigCode, TCCPError aError,
       
   882         TInt aModStatus );
       
   883         
       
   884     /**
       
   885      * Initializes mute P&S property watcher and CenRep volume watcher
       
   886      * @Since S60 3.2
       
   887      * @param
       
   888      * @return instance of session
       
   889      */
       
   890     void InitializePropertyWatchingL();
       
   891     
       
   892     /**
       
   893      * Sets RTP keep-alive timer value and payload
       
   894      * @since Series 60 3.2
       
   895      * @param aSession MCE session
       
   896      * @param aSessionUpdateOngoing Determines whether session needs to be updated
       
   897      * @return void
       
   898      */
       
   899     virtual void SetRtpKeepAliveL( CMceSession* aSession,
       
   900                                    TBool aSessionUpdateOngoing );
       
   901     
       
   902     /**
       
   903      * Executes session observer callback(Cb) if not NULL.
       
   904      * @since Series 60 3.2
       
   905      * @param aError the error code.
       
   906      * @return System wide error code.
       
   907      */
       
   908     TInt ExecCbErrorOccurred( TCCPError aError );
       
   909     
       
   910     /**
       
   911      * Sets new internal call state, and executes session observer callback(Cb)
       
   912      * if not NULL.
       
   913      * @since Series 60 3.2
       
   914      * @param aNewState new state
       
   915      * @return System wide error code.
       
   916      */
       
   917     TInt ExecCbCallStateChanged( MCCPCallObserver::TCCPCallState aNewState );
       
   918     
       
   919     /**
       
   920      * Executes session observer callback(Cb) if not NULL.
       
   921      * @since Series 60 3.2
       
   922      * @param aEvent the new event.
       
   923      * @return System wide error code.
       
   924      */
       
   925     TInt ExecCbCallEventOccurred( MCCPCallObserver::TCCPCallEvent aEvent );
       
   926 
       
   927     /**
       
   928      * Executes supplementary services(Ss) observer callback(Cb) if not NULL.
       
   929      * Events can be e.g. call forward related events
       
   930      * that are not call related to an existing call
       
   931      * @since Series 60 3.2
       
   932      * @param aEvent the new event.
       
   933      * @return System wide error code.
       
   934      */
       
   935     TInt ExecCbSsEventOccurred( MCCPSsObserver::TCCPSsCallForwardEvent aEvent );
       
   936 
       
   937 
       
   938 private: // new methods
       
   939     
       
   940     /**
       
   941      * Method for checking audio priorities in audio streams. Method checks
       
   942      * that correct audio priorities are used in inband/outband DTMF cases and
       
   943      * sets them accordingly to uplink side codecs.
       
   944      * @since S60 v3.2
       
   945      * @param aAudioStreams. Media streams in iSession.
       
   946      * @return void
       
   947      */
       
   948     void CheckMmfPrioritiesForDtmfL(
       
   949         const RPointerArray<CMceMediaStream>& aAudioStreams ) const;
       
   950         
       
   951     /**
       
   952      * Method for seek remote party
       
   953      * Handle possible leave
       
   954      * @since Series 60 3.2
       
   955      * @return void
       
   956      * @leave system error if searching fails
       
   957      */
       
   958     void RemotePartyL() const;
       
   959 
       
   960     /**
       
   961      * Volume level changed
       
   962      * Handle possible leave
       
   963      * @since S60 3.2
       
   964      * @param aVolume New volume level
       
   965      * @return void
       
   966      * @leave system error if volume settings fails
       
   967      */
       
   968     void VolumeChangedL( TInt aVolume );
       
   969     
       
   970     /**
       
   971      * Performs mute / unmute
       
   972      * @since S60 3.2
       
   973      * @param aStreams Media streams
       
   974      * @param aValue Mute change value
       
   975      * @return void
       
   976      * @leave system error if mute/unmute fails
       
   977      */
       
   978     void PerformMuteChangeL( const RPointerArray< CMceMediaStream >& aStreams,
       
   979                              TInt aValue );
       
   980 
       
   981     /**
       
   982      * Sets Flag that indicates Error in UpLink (ICMP -3) happens the 1st Time
       
   983      * @since Series 60 3.2
       
   984      * @return none
       
   985      */
       
   986     void SetErrorInULandDLFirstTime( TBool aFirstTime );
       
   987 
       
   988     /**
       
   989      * Returns is the error in Uplink has happened the only 1st time
       
   990      * @since Series 60 3.2
       
   991      * @return TBool Flag value
       
   992      */
       
   993     TBool IsErrorInULandDLFirstTime();
       
   994     
       
   995     /**
       
   996      * Returns ETrue if both UpLink and DownLink are disabled
       
   997      * @since Series 60 3.2
       
   998      * @return TBool Flag value
       
   999      */
       
  1000     TBool IsBothStreamsDisabledL() const;
       
  1001 
       
  1002     
       
  1003 protected: // protected data
       
  1004     
       
  1005     /**
       
  1006      * Mce session
       
  1007      * Own.
       
  1008      */ 
       
  1009     CMceSession* iSession;
       
  1010     
       
  1011     /**
       
  1012      * Temporary secure session, needed so that old session deletion can be
       
  1013      * performed painlessly.
       
  1014      * Own.
       
  1015      */ 
       
  1016     CMceSession* iTempSecSession;
       
  1017     
       
  1018     /**
       
  1019      * reference to SVP utility class
       
  1020      */ 
       
  1021     CSVPUtility& iSVPUtility;
       
  1022     
       
  1023     /**
       
  1024      * reference to SVP Rtp observer class. Needed for RTCP resetting.
       
  1025      */
       
  1026     CSVPRtpObserver& iRtpObserver;
       
  1027     
       
  1028     /**
       
  1029      * SIP profile id 
       
  1030      */
       
  1031     TUint32 iSipProfileId;
       
  1032     
       
  1033     /**
       
  1034      * Converged call provider call observer
       
  1035      */
       
  1036     MCCPCallObserver* iCCPSessionObserver;
       
  1037     
       
  1038     /**
       
  1039      * Observer for supplementary services events 
       
  1040      */
       
  1041     MCCPSsObserver* iCCPSsObserver;
       
  1042     
       
  1043     /**
       
  1044      * Flag that indicates whether established session is secured or not
       
  1045      */
       
  1046     TBool iSecured;
       
  1047 
       
  1048     /**
       
  1049      * Call event which will be sent in securepreferred or attended transfer cases.
       
  1050      */
       
  1051     MCCPCallObserver::TCCPCallEvent iCallEventToBeSent;
       
  1052 
       
  1053     /**
       
  1054      * Id of VoIP profile
       
  1055      */
       
  1056     TUint32 iVoIPProfileId;
       
  1057     
       
  1058     /**
       
  1059      * Keep-alive timer value
       
  1060      */
       
  1061     TInt iKeepAliveValue;
       
  1062     
       
  1063     /**
       
  1064      * Call parameters
       
  1065      */
       
  1066     CCCPCallParameters* iCallParameters;
       
  1067     
       
  1068     /**
       
  1069      * User tries to call to sips: -uri, secpref 0 is used
       
  1070      * this flag is needed for event notification
       
  1071      */
       
  1072     TBool iTLSNotInUse;
       
  1073     
       
  1074     /**
       
  1075      * Prevents UI notes if error response received to BYE request
       
  1076      */
       
  1077     TBool iAlreadyTerminating;
       
  1078     
       
  1079     /**
       
  1080      * This flag indicates whether preconditions
       
  1081 	 * are required in SIP headers or not 
       
  1082      */
       
  1083     TBool iPreconditions;
       
  1084     
       
  1085 private:    // private data
       
  1086     
       
  1087     /**
       
  1088      * Transaction data container, not owned.
       
  1089      */
       
  1090     TMceTransactionDataContainer& iContainer;
       
  1091     
       
  1092     /*
       
  1093      * Instance of DTMF event generator, used in inband dtmf case
       
  1094      * Own.
       
  1095      */
       
  1096     CSVPDTMFEventGenerator* iEventGenerator;
       
  1097     
       
  1098     /**
       
  1099      * Instance of volume observer, observer CenRep
       
  1100      * Own.
       
  1101      */
       
  1102     CSVPVolumeObserver* iVolObserver;
       
  1103     
       
  1104     /**
       
  1105      * Instance of property watcher using P&S system
       
  1106      * Own.
       
  1107      */
       
  1108     CSVPPropertyWatch* iMutePropertyWatch;
       
  1109     
       
  1110     /**
       
  1111      * Session timers, need an array since there migh be more than one.
       
  1112      */
       
  1113     RPointerArray<CSVPTimer> iTimers;
       
  1114     
       
  1115     /**
       
  1116      * Contains current session state
       
  1117      */
       
  1118     MCCPCallObserver::TCCPCallState iSessionState;
       
  1119     
       
  1120     /**
       
  1121      * From header of the mce session, from headers
       
  1122      * Own.
       
  1123      */  
       
  1124     HBufC8* iFromHeader;
       
  1125     
       
  1126     /**
       
  1127      * To header of the mce session, from headers
       
  1128      * Own.
       
  1129      */    
       
  1130     HBufC8* iToHeader;
       
  1131     
       
  1132     /**
       
  1133      * Call id of the mce session, from headers
       
  1134      * Own.
       
  1135      */
       
  1136     HBufC8* iCallId;
       
  1137     
       
  1138     /**
       
  1139      * CSeq header of the mce session, from headers
       
  1140      * Own.
       
  1141      */
       
  1142     HBufC* iCSeqHeader;
       
  1143     
       
  1144     /**
       
  1145      * The address of the recipient of the SIP session.
       
  1146      * Own.
       
  1147      */
       
  1148     mutable HBufC* iRecipient;
       
  1149 
       
  1150     /**
       
  1151      * Display name of the recipient of the SIP session.
       
  1152      * Own.
       
  1153      */
       
  1154     HBufC* iDisplayName;
       
  1155     
       
  1156     /**
       
  1157      * Pointer to a SVP hold controller.
       
  1158      * Own.
       
  1159      */
       
  1160     CSVPHoldController* iHoldController;
       
  1161     
       
  1162     /**
       
  1163      * Pointer to transfer controller.
       
  1164      * Own.
       
  1165      */    
       
  1166     CSVPTransferController* iTransferController;
       
  1167     
       
  1168     /**
       
  1169      * Terminating timeout time repeat control value when incoming transfer
       
  1170      * ongoing.
       
  1171      */ 
       
  1172     TInt iTerminatingRepeat;
       
  1173     
       
  1174     /**
       
  1175      * CCP DTMF observer
       
  1176      */
       
  1177     MCCPDTMFObserver* iCCPDtmfObserver;
       
  1178     
       
  1179     /**
       
  1180      * SVP session observer
       
  1181      */
       
  1182     MSVPSessionObserver& iObserver;
       
  1183     
       
  1184     /**
       
  1185      * Flag to indicate secure preference value 1 -> secure is preferred
       
  1186      */
       
  1187     TBool iSecurePreferred;
       
  1188     
       
  1189     /**
       
  1190      * Flag to indicate secure preference value 2 -> secure call mandatory
       
  1191      */
       
  1192     TBool iSecureMandatory;
       
  1193     
       
  1194     /**
       
  1195      * Mute flag
       
  1196      */
       
  1197     TBool iMuted;
       
  1198     
       
  1199     /**
       
  1200     * Flag that indicates that handling of received re-INVITE 
       
  1201     * without is SDP is ongoing
       
  1202     */
       
  1203     TBool iEmptyReInvite;
       
  1204     
       
  1205     /**
       
  1206      * Tone information. Updated everytime session state changes.
       
  1207      */
       
  1208     TCCPTone iTone;
       
  1209     
       
  1210     /* 
       
  1211      * Contains DTMF tone sent. Used with inband DTMF. 
       
  1212      */  
       
  1213     TChar iDtmfTone;
       
  1214     
       
  1215     /* 
       
  1216      * Contains DTMF string sent. Used with inband DTMF. 
       
  1217      */
       
  1218     HBufC* iDtmfString;
       
  1219     
       
  1220     /* 
       
  1221      * Keeps count of the current tone sent. Used with inband DTMF
       
  1222      */
       
  1223     TLex iDtmfLex;  
       
  1224 
       
  1225     /**
       
  1226     * Flag that indicates that the case MediaStreams are 
       
  1227     * Disabled (ICMP -3 error) happens 1st time
       
  1228     */
       
  1229     TBool iErrorInULandDLFirstTime;
       
  1230 
       
  1231     /**
       
  1232      * Flag that indicates whether earlymedia event should 
       
  1233 	 * be sent again in ringing case
       
  1234      */
       
  1235     TBool iEarlyMediaOngoing;
       
  1236     
       
  1237 private:
       
  1238     
       
  1239 	// For testing
       
  1240     SVP_UT_DEFS
       
  1241     
       
  1242     };
       
  1243 
       
  1244 #endif // SVPSESSIONBASE_H