williamr@2: /* williamr@2: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Name : sipreferdialogassoc.h williamr@2: * Part of : SIP Client williamr@2: * Interface : SDK API, SIP Client API williamr@2: * Version : 1.0 williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CSIPREFERDIALOGASSOC_H williamr@2: #define CSIPREFERDIALOGASSOC_H williamr@2: williamr@2: // INCLUDES williamr@2: #include "sipdialogassocbase.h" williamr@2: williamr@2: // CONSTANTS williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CUri8; williamr@2: class CSIPToHeader; williamr@2: class CSIPFromHeader; williamr@2: class CSIPContactHeader; williamr@2: class CSIPReferToHeader; williamr@2: class MSIPRegistrationContext; williamr@2: class CSIPConnection; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * @publishedAll williamr@2: * @released williamr@2: * williamr@2: * Class for managing SIP REFER dialog associations. williamr@2: * It provides services for creating, using and terminating SIP REFER williamr@2: * dialog associations. User can have multiple REFER dialog associations williamr@2: * per same SIP dialog. williamr@2: * Implementation handles SUBSCRIBE on the dialog level defined by Call-Id, williamr@2: * local and remote tags; williamr@2: * User is responsible for "Refer-to" header semantics. williamr@2: * @lib sipclient.lib williamr@2: */ williamr@2: class CSIPReferDialogAssoc: public CSIPDialogAssocBase williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * Should be used if response to the SIP request to be sent williamr@2: * will create a SIP dialog association. williamr@2: * @pre aReferTo != 0 williamr@2: * @param aDialog a dialog to be associated with williamr@2: * @param aReferTo referred-to resource williamr@2: * @return New object; the ownership is transferred williamr@2: * @leave KErrArgument if aReferTo == 0 williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewL(CSIPDialog& aDialog, williamr@2: CSIPReferToHeader* aReferTo); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * Must be used if response to the SIP request to be sent williamr@2: * will create a SIP dialog association. williamr@2: * @pre aReferTo != 0 williamr@2: * @param aDialog a dialog to be associated with williamr@2: * @param aReferTo referred-to resource williamr@2: * @return New object; the ownership is transferred williamr@2: * @leave KErrArgument if aReferTo == 0 williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewLC(CSIPDialog& aDialog, williamr@2: CSIPReferToHeader* aReferTo); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor williamr@2: * @pre aFrom != 0 williamr@2: * @pre aReferTo != 0 williamr@2: * @pre aRemoteUri != 0 williamr@2: * The user of the class must not define tags in From-header williamr@2: * and To-header. williamr@2: * @param aConnection a SIP connection to be used with williamr@2: * dialog association williamr@2: * @param aFrom originator's address; the ownership is transfered williamr@2: * @param aRemoteUri a remote target URI that identifies a resource that williamr@2: * the request is addressed to. williamr@2: * @param aReferTo referred-to resource williamr@2: * @param aTo logical recipient's address; if not defined williamr@2: * the remote target uri will be used for To-header williamr@2: * construction; the ownership is transfered williamr@2: * @param aContact a contact to be used in dialog creation. Must be williamr@2: * given only if user intends to re-direct future requests; williamr@2: * the ownership is transfered williamr@2: * @return New object; the ownership is transferred. williamr@2: * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0 williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewL(CSIPConnection& aConnection, williamr@2: CSIPFromHeader* aFrom, williamr@2: CUri8* aRemoteUri, williamr@2: CSIPReferToHeader* aReferTo, williamr@2: CSIPToHeader* aTo=0, williamr@2: CSIPContactHeader* aContact=0); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor williamr@2: * @pre aFrom != 0 williamr@2: * @pre aReferTo != 0 williamr@2: * @pre aRemoteUri != 0 williamr@2: * The user of the class must not define tags in From-header williamr@2: * and To-header. williamr@2: * @param aConnection a SIP connection to be used with williamr@2: * dialog association williamr@2: * @param aFrom originator's address; the ownership is transfered williamr@2: * @param aRemoteUri a remote target URI that identifies a resource that williamr@2: * the request is addressed to. williamr@2: * @param aReferTo referred-to resource williamr@2: * @param aTo logical recipient's address; if not defined williamr@2: * the remote target uri will be used for To-header williamr@2: * construction; the ownership is transfered williamr@2: * @param aContact a contact to be used in dialog creation. Must be williamr@2: * given only if user intends to re-direct future requests; williamr@2: * the ownership is transfered williamr@2: * @return New object; the ownership is transferred. williamr@2: * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0 williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewLC(CSIPConnection& aConnection, williamr@2: CSIPFromHeader* aFrom, williamr@2: CUri8* aRemoteUri, williamr@2: CSIPReferToHeader* aReferTo, williamr@2: CSIPToHeader* aTo=0, williamr@2: CSIPContactHeader* aContact=0); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor williamr@2: * @pre aReferTo != 0 williamr@2: * @pre aRemoteUri != 0 williamr@2: * The user of the class must not define tags in From-header williamr@2: * and To-header. williamr@2: * @pre aContext.IsContextActive() == ETrue williamr@2: * @param aConnection a SIP connection to be used with williamr@2: * dialog association williamr@2: * @param aRemoteUri a remote target URI that identifies a resource that williamr@2: * the request is targeted to. williamr@2: * @param aContext used for selecting outbound williamr@2: * proxy and originator's address (AOR) and contact williamr@2: * @param aReferTo referred-to resource williamr@2: * @param aFrom originator's address. If not defined it will williamr@2: * constructed using registration context (User's AOR); williamr@2: * the ownership is transfered williamr@2: * @param aTo logical recipient's address; if not defined williamr@2: * the remote target uri will be used for To-header williamr@2: * construction; the ownership is transfered williamr@2: * @param aContact a contact to be used in dialog creation. Must be williamr@2: * given only if user intends to re-direct future requests; williamr@2: * the ownership is transfered williamr@2: * @return New object: the ownership is transferred. williamr@2: * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0 williamr@2: * @leave KErrSIPInvalidRegistrationState williamr@2: * if aContext.IsContextActive() == EFalse williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewL(CSIPConnection& aConnection, williamr@2: CUri8* aRemoteUri, williamr@2: const MSIPRegistrationContext& aContext, williamr@2: CSIPReferToHeader* aReferTo, williamr@2: CSIPFromHeader* aFrom=0, williamr@2: CSIPToHeader* aTo=0, williamr@2: CSIPContactHeader* aContact=0); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor williamr@2: * @pre aReferTo != 0 williamr@2: * @pre aRemoteUri != 0 williamr@2: * The user of the class must not define tags in From-header williamr@2: * and To-header. williamr@2: * @pre aContext.IsContextActive()==ETrue williamr@2: * @param aConnection a SIP connection to be used with williamr@2: * dialog association williamr@2: * @param aRemoteUri a remote target URI that identifies a resource that williamr@2: * the request is targeted to. williamr@2: * @param aContext used for selecting outbound williamr@2: * proxy and originator's address (AOR) and contact williamr@2: * @param aReferTo referred-to resource williamr@2: * @param aFrom originator's address. If not defined it will williamr@2: * constructed using registration context (User's AOR); williamr@2: * the ownership is transfered williamr@2: * @param aTo logical recipient's address; if not defined williamr@2: * the remote target uri will be used for To-header williamr@2: * construction; the ownership is transfered williamr@2: * @param aContact a contact to be used in dialog creation. Must be williamr@2: * given only if user intends to re-direct future requests; williamr@2: * the ownership is transfered williamr@2: * @return New object; the ownership is transferred. williamr@2: * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0 williamr@2: * @leave KErrSIPInvalidRegistrationState williamr@2: * if aContext.IsContextActive() == EFalse williamr@2: */ williamr@2: IMPORT_C static CSIPReferDialogAssoc* williamr@2: NewLC(CSIPConnection& aConnection, williamr@2: CUri8* aRemoteUri, williamr@2: const MSIPRegistrationContext& aContext, williamr@2: CSIPReferToHeader* aReferTo, williamr@2: CSIPFromHeader* aFrom=0, williamr@2: CSIPToHeader* aTo=0, williamr@2: CSIPContactHeader* aContact=0); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CSIPReferDialogAssoc(); williamr@2: williamr@2: public: //New functions williamr@2: williamr@2: /** williamr@2: * Creates REFER and sends it to the remote target. williamr@2: * leaves on failure. williamr@2: * 101-199 or 2xx response will create REFER dialog williamr@2: * association in case of first REFER request within williamr@2: * this dialog association. williamr@2: * @pre Dialog().Connection().State()==EActive williamr@2: * @pre Dialog().State()==CSIPDialog::EInit || williamr@2: * Dialog().State()==CSIPDialog::EConfirmed williamr@2: * @param aElements optional SIP message headers and body. Ownership is williamr@2: * transferred. williamr@2: * @return REFER SIP transaction. Ownership is transferred. williamr@2: * @leave KErrSIPInvalidDialogState if dialog is in wrong state williamr@2: * @leave KErrSIPResourceNotAvailable if a required SIP Client API williamr@2: * object has been deleted. williamr@2: * @capability NetworkServices williamr@2: */ williamr@2: IMPORT_C CSIPClientTransaction* williamr@2: SendReferL(CSIPMessageElements* aElements=0); williamr@2: williamr@2: /** williamr@2: * Gets referred-to resouce williamr@2: * @return referred-to resource williamr@2: */ williamr@2: IMPORT_C const CSIPReferToHeader& ReferTo() const; williamr@2: williamr@2: public: // New functions, for internal use williamr@2: williamr@2: /** williamr@2: * Sends a REFER request. williamr@2: * williamr@2: * @pre Dialog().Connection().State()==EActive williamr@2: * @param aElements optional SIP message headers and body. williamr@2: * Ownership is transferred. williamr@2: * @param aWithinDialog ETrue if REFER is sent within dialog, williamr@2: * EFalse if REFER creates the dialog. williamr@2: * @return REFER SIP transaction. Ownership is transferred. williamr@2: */ williamr@2: CSIPClientTransaction* DoSendReferL(CSIPMessageElements* aElements, williamr@2: TBool aWithinDialog); williamr@2: williamr@2: private: // Constructors williamr@2: williamr@2: CSIPReferDialogAssoc(); williamr@2: williamr@2: static CSIPReferDialogAssoc* NewLC(CSIPConnection& aConnection, williamr@2: CUri8* aRemoteUri, williamr@2: CSIPReferToHeader* aReferTo, williamr@2: CSIPFromHeader* aFrom, williamr@2: CSIPToHeader* aTo, williamr@2: CSIPContactHeader* aContact, williamr@2: const MSIPRegistrationContext* aContext); williamr@2: williamr@2: private: // Data williamr@2: williamr@2: CSIPReferToHeader* iReferTo; williamr@2: }; williamr@2: williamr@2: #endif