sipvoipprovider/inc/svpsessionbase.h
changeset 0 a4daefaec16c
child 16 df4dfb214df5
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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 // dtmf
       
   502 
       
   503     /**
       
   504 	* Cancels asynchronous DTMF string sending.
       
   505 	* @since Series 60 3.2
       
   506 	* @return KErrNone is successful, otherwiee antoher system wide error code
       
   507 	*/
       
   508 	TInt CancelDtmfStringSending();
       
   509 
       
   510 	/**
       
   511 	* Starts the transmission of a single DTMF tone across a
       
   512 	* connected and active call.
       
   513 	* @since S60 3.2
       
   514 	* @param aTone Tone to be played.
       
   515 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   516 	*/
       
   517 	TInt StartDtmfTone( const TChar aTone );
       
   518 
       
   519 	/**
       
   520 	* Stops playing current DTMF tone.
       
   521 	* @since S60 3.2
       
   522     * @param none
       
   523 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   524 	*/
       
   525 	TInt StopDtmfTone();
       
   526 
       
   527 	/**
       
   528 	* Plays DTMF string.
       
   529 	* @since S60 3.2
       
   530 	* @param aString String to be played.
       
   531 	* @return KErrNone if succesfull, otherwise another system wide error code
       
   532 	* KErrArgument if the specified string contains illegal DTMF characters
       
   533 	*/
       
   534 	TInt SendDtmfToneString( const TDesC& aString );  
       
   535     
       
   536 	// from SVPDTMFEventObserver
       
   537     void InbandDtmfEventOccurred( TSVPDtmfEvent aEvent );
       
   538     
       
   539 public: // from base classes: timerobserver
       
   540     
       
   541     /**
       
   542     * Notifies, that the previously set timer has now expired.
       
   543     * Implemented by the class using the timer.
       
   544     * @since Series 60 3.2
       
   545     * @param TInt aTimerId The ID of the timer. Observer can identify 
       
   546     * timers from each other with this ID.
       
   547     * @return 
       
   548     */
       
   549     void TimedOut( TInt aTimerId ); 
       
   550 
       
   551 public: // from MSVPVolumeUpdateObserver
       
   552  
       
   553     /**
       
   554      * CSVPVolumeObserver calls this when volume level changes
       
   555      * changed. 
       
   556      *
       
   557      * @since S60 3.2
       
   558      * @param aVolume New volume level
       
   559      */
       
   560      void VolumeChanged( TInt aVolume );
       
   561     
       
   562 public: // from base classes: MCCPCall
       
   563 		
       
   564     /**
       
   565     * Return if call secure status is specified or not.
       
   566     * @since Series 60 5.0
       
   567     * @param None
       
   568     * @return TBool ETrue if security is specified, else EFalse.
       
   569     */
       
   570     TBool SecureSpecified() const;
       
   571 	    
       
   572 	/**
       
   573     * Sets CCP call observer 
       
   574     * @since Series 60 3.2
       
   575     * @param aObserver observer to be set
       
   576     * @return 
       
   577     */
       
   578     void AddObserverL( const MCCPCallObserver& aObserver );
       
   579     
       
   580     /**
       
   581     * Remove an observer.
       
   582     * @since S60 v3.2
       
   583     * @param none
       
   584     * @param aObserver Observer
       
   585     * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
       
   586     * Any other system error depending on the error.
       
   587     */
       
   588     TInt RemoveObserver( const MCCPCallObserver& aObserver );
       
   589         
       
   590     /**
       
   591     * Answers to an incoming call.
       
   592     * @since Series60 3.2
       
   593     * @return KErrNotSupported
       
   594     */
       
   595     virtual TInt Answer();
       
   596 
       
   597     /**
       
   598     * Starts dialing to recipient
       
   599     * @since Series60 3.2
       
   600     * @return KErrNone or system wide error code
       
   601     */
       
   602     virtual TInt Dial();
       
   603 
       
   604 	/**
       
   605 	* Cancels ongoing dial or answer request
       
   606 	* @since Series60 3.2
       
   607 	* @return KErrNone or system wide error code
       
   608 	*/
       
   609 	virtual TInt Cancel();
       
   610 
       
   611     /**
       
   612     * Ends an ongoing call.
       
   613     * @since Series60 3.2
       
   614     * @return KErrNone or system wide error code
       
   615     */
       
   616     virtual TInt HangUp();
       
   617 
       
   618     /**
       
   619     * Rejects an incoming call.
       
   620     * @since Series 60 3.2
       
   621     * @return KErrNone or system wide error code
       
   622     */
       
   623     virtual TInt Reject();
       
   624 
       
   625     /**
       
   626     * Reguests plug-in to queue the call. 
       
   627     * @since S60 3.2
       
   628     * @return KErrNone or system wide error code
       
   629     */
       
   630     virtual TInt Queue();
       
   631 
       
   632     /**
       
   633     * Call is ringning
       
   634     * @since S60 3.2
       
   635     * @return KErrNone or system wide error code 
       
   636     */
       
   637     virtual TInt Ringing();
       
   638 
       
   639     /**
       
   640     * Puts the specified call on hold.
       
   641     * @since Series60 3.2
       
   642     * @return KErrNone or system wide error code 
       
   643     */
       
   644     virtual TInt Hold();
       
   645 
       
   646     /**
       
   647     * Resumes the call.
       
   648     * @since Series60 3.2
       
   649     * @return KErrNone or system wide error code
       
   650     */
       
   651     virtual TInt Resume();
       
   652     
       
   653     /**
       
   654     * Swaps a connected call to its opposite state, either active or on hold
       
   655     * @since Series60 3.2
       
   656     * @return KErrNone or system wide error code 
       
   657     */
       
   658     virtual TInt Swap();
       
   659 
       
   660     /**
       
   661     * Releases all bindings to call and calls destructor
       
   662     * @since Series60 3.2
       
   663     * @return KErrNone  
       
   664     */
       
   665     virtual TInt Release();
       
   666 
       
   667     /**
       
   668     * Returns the recipient of the call.
       
   669     * @since Series60 3.2
       
   670     * @return recipient address,
       
   671     */
       
   672     virtual const TDesC& RemoteParty() const;
       
   673 
       
   674     /**
       
   675     * Returns display name of the recipient of the call.
       
   676     * @since Series60 3.2
       
   677     * @return Recipient's display name
       
   678     */
       
   679     virtual const TDesC& RemotePartyName();
       
   680 
       
   681     /**
       
   682     * Returns the original dialled party.
       
   683     * @since Series60 3.2
       
   684     * @return Dialled party,
       
   685     */
       
   686     virtual const TDesC& DialledParty() const;
       
   687 
       
   688 	/**
       
   689     * Return boolean value, is incoming call forwarded or not.
       
   690     * @since Series60 3.2
       
   691     * @return ETrue if call is forwarded, else EFalse
       
   692     */
       
   693     virtual TBool IsCallForwarded() const;
       
   694 
       
   695     /**
       
   696     * Returns boolean value, is the call mobile originated.
       
   697     * @since Series60 3.2
       
   698     * @return ETrue if call is mobile originated, otherwise EFalse
       
   699     */
       
   700     virtual TBool IsMobileOriginated() const;
       
   701 
       
   702     /**
       
   703     * Returns the state of the call.
       
   704     * @since Series60 3.2
       
   705     * @return TCCPCallState The current state of the call
       
   706     */
       
   707     virtual MCCPCallObserver::TCCPCallState State() const;
       
   708 
       
   709     /**
       
   710     * Returns TUid of the Plug-In used for this call
       
   711     * @since Series60 3.2
       
   712     * @return TUid Implementation UID of the Plug-In
       
   713     */
       
   714     virtual TUid Uid() const;
       
   715 
       
   716     /**
       
   717     * Returns call control caps for this call This tells for CCE what call can
       
   718     * currently do.
       
   719     * @since Series60 3.2
       
   720     * @return Call control caps defined in MCCPCallObserver::TCCPCallControlCaps.
       
   721     */
       
   722     virtual MCCPCallObserver::TCCPCallControlCaps Caps() const;
       
   723 
       
   724     /**
       
   725     * Get call's secure status.
       
   726     * @since Series 60 3.2
       
   727     * @return TBool ETrue if security is enabled, else EFalse.
       
   728     */
       
   729     virtual TBool IsSecured() const;
       
   730 
       
   731     /**
       
   732 	* Get Conference extension methods
       
   733 	* @since Series 60 3.2
       
   734 	* @return Pointer to MCCPCSCallConfernece if succesfull, NULL if not available
       
   735 	*/
       
   736 	virtual MCCPConferenceCall* ConferenceProviderL( const MCCPConferenceCallObserver& aObserver );
       
   737    
       
   738     /**
       
   739 	* Get Forward provider
       
   740 	* @since Series 60 3.2
       
   741 	* @return Pointer to MCCPForwardProvider if succesfull, NULL if not available
       
   742 	*/
       
   743 	virtual MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
       
   744 	
       
   745 	
       
   746 	 /**
       
   747     * Get Call transfer provider
       
   748     * @since Series 60 3.2
       
   749     * @return Pointer to MCCPTransferProvider if succesfull, NULL if not available
       
   750     */
       
   751 	MCCPTransferProvider* TransferProviderL( const MCCPTransferObserver& aObserver );
       
   752 	
       
   753 	
       
   754 	/**
       
   755 	* Set call parameters.
       
   756 	* @since S60 3.2
       
   757 	* @param aNewParams New call paramater information.
       
   758 	*/
       
   759     void SetParameters( const CCCPCallParameters& aNewParams );
       
   760 
       
   761     /**
       
   762 	* Cet call parameters.
       
   763 	* @since S60 3.2
       
   764 	* @param None
       
   765 	* @return Current call paramater information.
       
   766 	*/
       
   767     virtual const CCCPCallParameters& Parameters() const;
       
   768 
       
   769     /**
       
   770     * Returns currently used tone for the call. Used in case tones are needed to be played.
       
   771 	* See defenition for TCCPTone.
       
   772     * @since S60 3.2
       
   773     * @param None.
       
   774     * @return TCCPTone Used tone.
       
   775     */
       
   776     TCCPTone Tone() const;
       
   777 
       
   778 public: // from SVPHoldObserver
       
   779 
       
   780     /**
       
   781     * Notifies, that session has been holded.
       
   782     * @since Series 60 3.2
       
   783     */
       
   784     virtual void SessionLocallyHeld();
       
   785 
       
   786     /**
       
   787     * Notifies, that session has been resumed.
       
   788     * @since Series 60 3.2
       
   789     */
       
   790     virtual void SessionLocallyResumed();
       
   791     
       
   792     /**
       
   793     * Notifies, that session has been remotely held.
       
   794     * @since Series 60 3.2
       
   795     */
       
   796     virtual void SessionRemoteHeld();
       
   797 
       
   798     /**
       
   799     * Notifies, that session has been remotely resumed.
       
   800     * @since Series 60 3.2
       
   801     */
       
   802     virtual void SessionRemoteResumed();
       
   803     
       
   804     /**
       
   805     * Notifies, that hold request failed.
       
   806     * @since Series 60 3.2
       
   807     */
       
   808     virtual void HoldRequestFailed();
       
   809  
       
   810     /**
       
   811     * Notifies, that resume request failed.
       
   812     * @since Series 60 3.2
       
   813     */
       
   814     virtual void ResumeRequestFailed();
       
   815 
       
   816          
       
   817 public: // from MSVPTransferObserver
       
   818          
       
   819     /**
       
   820     * From MSVPTransferObserver
       
   821     * Notifier for succesful transfer.
       
   822     * @since Series60 3.2
       
   823     * @param aNotifyCode The transfer notify code
       
   824     */
       
   825     virtual void TransferNotification( TInt aNotifyCode );
       
   826 
       
   827     /**
       
   828     * From MSVPTransferObserver
       
   829     * Notifier for transfer failure.
       
   830     * @since Series60 3.2
       
   831     * @param aError The error Id.    
       
   832     */
       
   833     virtual void TransferFailed( TInt aError );     
       
   834     
       
   835 public: // from MSVPPropertyWatchObserver   
       
   836     
       
   837     /**
       
   838     * CSVPPropertyWatch calls this when some property under watching was
       
   839     * changed. 
       
   840     *
       
   841     * @since S60 3.2
       
   842     * @param aKey Property which was changed
       
   843     * @param aValue New value of the property
       
   844     */
       
   845     void ValueChangedL( TInt aKey, TInt aValue );
       
   846     
       
   847     /**
       
   848     * CSVPPropertyWatch calls this when property was deleted.
       
   849     *
       
   850     * @since S60 3.2
       
   851     * @param aKey Property which was deleted
       
   852     */
       
   853     void PropertyDeleted( TInt aKey );
       
   854 
       
   855 protected: // new methods
       
   856 
       
   857     /**
       
   858      * Updates keepalive parameters for session
       
   859      * @since Series 60 3.2
       
   860      * @param aSession Session to be updated
       
   861      * @param aSessionUpdateOngoing Determines whether session needs to be updated
       
   862      * @return 
       
   863      */
       
   864     void UpdateKeepAliveL( CMceSession& aSession, TBool aSessionUpdateOngoing );
       
   865 
       
   866     /**
       
   867      * Worker function for session state change, called from
       
   868      * SessionStateChanged().
       
   869      * @since S60 v3.2
       
   870      * @param aOrigStatus Original status code
       
   871      * @param aError Mapped TCCPError
       
   872      * @param aModStatus Modified status code
       
   873      * @return void
       
   874      */
       
   875     virtual void SessionStateChangedL( TInt aOrigCode, TCCPError aError,
       
   876         TInt aModStatus );
       
   877         
       
   878     /**
       
   879      * Initializes mute P&S property watcher and CenRep volume watcher
       
   880      * @Since S60 3.2
       
   881      * @param
       
   882      * @return instance of session
       
   883      */
       
   884     void InitializePropertyWatchingL();
       
   885     
       
   886     /**
       
   887      * Sets RTP keep-alive timer value and payload
       
   888      * @since Series 60 3.2
       
   889      * @param aSession MCE session
       
   890      * @param aSessionUpdateOngoing Determines whether session needs to be updated
       
   891      * @return void
       
   892      */
       
   893     virtual void SetRtpKeepAliveL( CMceSession* aSession,
       
   894                                    TBool aSessionUpdateOngoing );
       
   895     
       
   896     /**
       
   897      * Executes session observer callback(Cb) if not NULL.
       
   898      * @since Series 60 3.2
       
   899      * @param aError the error code.
       
   900      * @return System wide error code.
       
   901      */
       
   902     TInt ExecCbErrorOccurred( TCCPError aError );
       
   903     
       
   904     /**
       
   905      * Sets new internal call state, and executes session observer callback(Cb)
       
   906      * if not NULL.
       
   907      * @since Series 60 3.2
       
   908      * @param aNewState new state
       
   909      * @return System wide error code.
       
   910      */
       
   911     TInt ExecCbCallStateChanged( MCCPCallObserver::TCCPCallState aNewState );
       
   912     
       
   913     /**
       
   914      * Executes session observer callback(Cb) if not NULL.
       
   915      * @since Series 60 3.2
       
   916      * @param aEvent the new event.
       
   917      * @return System wide error code.
       
   918      */
       
   919     TInt ExecCbCallEventOccurred( MCCPCallObserver::TCCPCallEvent aEvent );
       
   920 
       
   921     /**
       
   922      * Executes supplementary services(Ss) observer callback(Cb) if not NULL.
       
   923      * Events can be e.g. call forward related events
       
   924      * that are not call related to an existing call
       
   925      * @since Series 60 3.2
       
   926      * @param aEvent the new event.
       
   927      * @return System wide error code.
       
   928      */
       
   929     TInt ExecCbSsEventOccurred( MCCPSsObserver::TCCPSsCallForwardEvent aEvent );
       
   930 
       
   931 
       
   932 private: // new methods
       
   933     
       
   934     /**
       
   935      * Method for checking audio priorities in audio streams. Method checks
       
   936      * that correct audio priorities are used in inband/outband DTMF cases and
       
   937      * sets them accordingly to uplink side codecs.
       
   938      * @since S60 v3.2
       
   939      * @param aAudioStreams. Media streams in iSession.
       
   940      * @return void
       
   941      */
       
   942     void CheckMmfPrioritiesForDtmfL(
       
   943         const RPointerArray<CMceMediaStream>& aAudioStreams ) const;
       
   944         
       
   945     /**
       
   946      * Method for seek remote party
       
   947      * Handle possible leave
       
   948      * @since Series 60 3.2
       
   949      * @return void
       
   950      * @leave system error if searching fails
       
   951      */
       
   952     void RemotePartyL() const;
       
   953 
       
   954     /**
       
   955      * Volume level changed
       
   956      * Handle possible leave
       
   957      * @since S60 3.2
       
   958      * @param aVolume New volume level
       
   959      * @return void
       
   960      * @leave system error if volume settings fails
       
   961      */
       
   962     void VolumeChangedL( TInt aVolume );
       
   963     
       
   964     /**
       
   965      * Performs mute / unmute
       
   966      * @since S60 3.2
       
   967      * @param aStreams Media streams
       
   968      * @param aValue Mute change value
       
   969      * @return void
       
   970      * @leave system error if mute/unmute fails
       
   971      */
       
   972     void PerformMuteChangeL( const RPointerArray< CMceMediaStream >& aStreams,
       
   973                              TInt aValue );
       
   974 
       
   975     /**
       
   976      * Sets Flag that indicates Error in UpLink (ICMP -3) happens the 1st Time
       
   977      * @since Series 60 3.2
       
   978      * @return none
       
   979      */
       
   980     void SetErrorInULandDLFirstTime( TBool aFirstTime );
       
   981 
       
   982     /**
       
   983      * Returns is the error in Uplink has happened the only 1st time
       
   984      * @since Series 60 3.2
       
   985      * @return TBool Flag value
       
   986      */
       
   987     TBool IsErrorInULandDLFirstTime();
       
   988     
       
   989     /**
       
   990      * Returns ETrue if both UpLink and DownLink are disabled
       
   991      * @since Series 60 3.2
       
   992      * @return TBool Flag value
       
   993      */
       
   994     TBool IsBothStreamsDisabledL() const;
       
   995 
       
   996     
       
   997 protected: // protected data
       
   998     
       
   999     /**
       
  1000      * Mce session
       
  1001      * Own.
       
  1002      */ 
       
  1003     CMceSession* iSession;
       
  1004     
       
  1005     /**
       
  1006      * Temporary secure session, needed so that old session deletion can be
       
  1007      * performed painlessly.
       
  1008      * Own.
       
  1009      */ 
       
  1010     CMceSession* iTempSecSession;
       
  1011     
       
  1012     /**
       
  1013      * reference to SVP utility class
       
  1014      */ 
       
  1015     CSVPUtility& iSVPUtility;
       
  1016     
       
  1017     /**
       
  1018      * reference to SVP Rtp observer class. Needed for RTCP resetting.
       
  1019      */
       
  1020     CSVPRtpObserver& iRtpObserver;
       
  1021     
       
  1022     /**
       
  1023      * SIP profile id 
       
  1024      */
       
  1025     TUint32 iSipProfileId;
       
  1026     
       
  1027     /**
       
  1028      * Converged call provider call observer
       
  1029      */
       
  1030     MCCPCallObserver* iCCPSessionObserver;
       
  1031     
       
  1032     /**
       
  1033      * Observer for supplementary services events 
       
  1034      */
       
  1035     MCCPSsObserver* iCCPSsObserver;
       
  1036     
       
  1037     /**
       
  1038      * Flag that indicates whether established session is secured or not
       
  1039      */
       
  1040     TBool iSecured;
       
  1041 
       
  1042     /**
       
  1043      * Call event which will be sent in securepreferred or attended transfer cases.
       
  1044      */
       
  1045     MCCPCallObserver::TCCPCallEvent iCallEventToBeSent;
       
  1046 
       
  1047     /**
       
  1048      * Id of VoIP profile
       
  1049      */
       
  1050     TUint32 iVoIPProfileId;
       
  1051     
       
  1052     /**
       
  1053      * Keep-alive timer value
       
  1054      */
       
  1055     TInt iKeepAliveValue;
       
  1056     
       
  1057     /**
       
  1058      * Call parameters
       
  1059      */
       
  1060     CCCPCallParameters* iCallParameters;
       
  1061     
       
  1062     /**
       
  1063      * User tries to call to sips: -uri, secpref 0 is used
       
  1064      * this flag is needed for event notification
       
  1065      */
       
  1066     TBool iTLSNotInUse;
       
  1067     
       
  1068     /**
       
  1069      * Prevents UI notes if error response received to BYE request
       
  1070      */
       
  1071     TBool iAlreadyTerminating;
       
  1072     
       
  1073     /**
       
  1074      * This flag indicates whether preconditions
       
  1075 	 * are required in SIP headers or not 
       
  1076      */
       
  1077     TBool iPreconditions;
       
  1078     
       
  1079 private:    // private data
       
  1080     
       
  1081     /**
       
  1082      * Transaction data container, not owned.
       
  1083      */
       
  1084     TMceTransactionDataContainer& iContainer;
       
  1085     
       
  1086     /*
       
  1087      * Instance of DTMF event generator, used in inband dtmf case
       
  1088      * Own.
       
  1089      */
       
  1090     CSVPDTMFEventGenerator* iEventGenerator;
       
  1091     
       
  1092     /**
       
  1093      * Instance of volume observer, observer CenRep
       
  1094      * Own.
       
  1095      */
       
  1096     CSVPVolumeObserver* iVolObserver;
       
  1097     
       
  1098     /**
       
  1099      * Instance of property watcher using P&S system
       
  1100      * Own.
       
  1101      */
       
  1102     CSVPPropertyWatch* iMutePropertyWatch;
       
  1103     
       
  1104     /**
       
  1105      * Session timers, need an array since there migh be more than one.
       
  1106      */
       
  1107     RPointerArray<CSVPTimer> iTimers;
       
  1108     
       
  1109     /**
       
  1110      * Contains current session state
       
  1111      */
       
  1112     MCCPCallObserver::TCCPCallState iSessionState;
       
  1113     
       
  1114     /**
       
  1115      * From header of the mce session, from headers
       
  1116      * Own.
       
  1117      */  
       
  1118     HBufC8* iFromHeader;
       
  1119     
       
  1120     /**
       
  1121      * To header of the mce session, from headers
       
  1122      * Own.
       
  1123      */    
       
  1124     HBufC8* iToHeader;
       
  1125     
       
  1126     /**
       
  1127      * Call id of the mce session, from headers
       
  1128      * Own.
       
  1129      */
       
  1130     HBufC8* iCallId;
       
  1131     
       
  1132     /**
       
  1133      * CSeq header of the mce session, from headers
       
  1134      * Own.
       
  1135      */
       
  1136     HBufC* iCSeqHeader;
       
  1137     
       
  1138     /**
       
  1139      * The address of the recipient of the SIP session.
       
  1140      * Own.
       
  1141      */
       
  1142     mutable HBufC* iRecipient;
       
  1143 
       
  1144     /**
       
  1145      * Display name of the recipient of the SIP session.
       
  1146      * Own.
       
  1147      */
       
  1148     HBufC* iDisplayName;
       
  1149     
       
  1150     /**
       
  1151      * Pointer to a SVP hold controller.
       
  1152      * Own.
       
  1153      */
       
  1154     CSVPHoldController* iHoldController;
       
  1155     
       
  1156     /**
       
  1157      * Pointer to transfer controller.
       
  1158      * Own.
       
  1159      */    
       
  1160     CSVPTransferController* iTransferController;
       
  1161     
       
  1162     /**
       
  1163      * Terminating timeout time repeat control value when incoming transfer
       
  1164      * ongoing.
       
  1165      */ 
       
  1166     TInt iTerminatingRepeat;
       
  1167     
       
  1168     /**
       
  1169      * CCP DTMF observer
       
  1170      */
       
  1171     MCCPDTMFObserver* iCCPDtmfObserver;
       
  1172     
       
  1173     /**
       
  1174      * SVP session observer
       
  1175      */
       
  1176     MSVPSessionObserver& iObserver;
       
  1177     
       
  1178     /**
       
  1179      * Flag to indicate secure preference value 1 -> secure is preferred
       
  1180      */
       
  1181     TBool iSecurePreferred;
       
  1182     
       
  1183     /**
       
  1184      * Flag to indicate secure preference value 2 -> secure call mandatory
       
  1185      */
       
  1186     TBool iSecureMandatory;
       
  1187     
       
  1188     /**
       
  1189      * Mute flag
       
  1190      */
       
  1191     TBool iMuted;
       
  1192     
       
  1193     /**
       
  1194     * Flag that indicates that handling of received re-INVITE 
       
  1195     * without is SDP is ongoing
       
  1196     */
       
  1197     TBool iEmptyReInvite;
       
  1198     
       
  1199     /**
       
  1200      * Tone information. Updated everytime session state changes.
       
  1201      */
       
  1202     TCCPTone iTone;
       
  1203     
       
  1204     /* 
       
  1205      * Contains DTMF tone sent. Used with inband DTMF. 
       
  1206      */  
       
  1207     TChar iDtmfTone;
       
  1208     
       
  1209     /* 
       
  1210      * Contains DTMF string sent. Used with inband DTMF. 
       
  1211      */
       
  1212     HBufC* iDtmfString;
       
  1213     
       
  1214     /* 
       
  1215      * Keeps count of the current tone sent. Used with inband DTMF
       
  1216      */
       
  1217     TLex iDtmfLex;  
       
  1218 
       
  1219     /**
       
  1220     * Flag that indicates that the case MediaStreams are 
       
  1221     * Disabled (ICMP -3 error) happens 1st time
       
  1222     */
       
  1223     TBool iErrorInULandDLFirstTime;
       
  1224 
       
  1225     /**
       
  1226      * Flag that indicates whether earlymedia event should 
       
  1227 	 * be sent again in ringing case
       
  1228      */
       
  1229     TBool iEarlyMediaOngoing;
       
  1230     
       
  1231 private:
       
  1232     
       
  1233 	// For testing
       
  1234     SVP_UT_DEFS
       
  1235     
       
  1236     };
       
  1237 
       
  1238 #endif // SVPSESSIONBASE_H