williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Name : sipreferdialogassoc.h
|
williamr@2
|
16 |
* Part of : SIP Client
|
williamr@2
|
17 |
* Interface : SDK API, SIP Client API
|
williamr@2
|
18 |
* Version : 1.0
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#ifndef CSIPREFERDIALOGASSOC_H
|
williamr@2
|
25 |
#define CSIPREFERDIALOGASSOC_H
|
williamr@2
|
26 |
|
williamr@2
|
27 |
// INCLUDES
|
williamr@2
|
28 |
#include "sipdialogassocbase.h"
|
williamr@2
|
29 |
|
williamr@2
|
30 |
// CONSTANTS
|
williamr@2
|
31 |
|
williamr@2
|
32 |
// FORWARD DECLARATIONS
|
williamr@2
|
33 |
class CUri8;
|
williamr@2
|
34 |
class CSIPToHeader;
|
williamr@2
|
35 |
class CSIPFromHeader;
|
williamr@2
|
36 |
class CSIPContactHeader;
|
williamr@2
|
37 |
class CSIPReferToHeader;
|
williamr@2
|
38 |
class MSIPRegistrationContext;
|
williamr@2
|
39 |
class CSIPConnection;
|
williamr@2
|
40 |
|
williamr@2
|
41 |
// CLASS DECLARATION
|
williamr@2
|
42 |
|
williamr@2
|
43 |
/**
|
williamr@2
|
44 |
* @publishedAll
|
williamr@2
|
45 |
* @released
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* Class for managing SIP REFER dialog associations.
|
williamr@2
|
48 |
* It provides services for creating, using and terminating SIP REFER
|
williamr@2
|
49 |
* dialog associations. User can have multiple REFER dialog associations
|
williamr@2
|
50 |
* per same SIP dialog.
|
williamr@2
|
51 |
* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
|
williamr@2
|
52 |
* local and remote tags;
|
williamr@2
|
53 |
* User is responsible for "Refer-to" header semantics.
|
williamr@2
|
54 |
* @lib sipclient.lib
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
class CSIPReferDialogAssoc: public CSIPDialogAssocBase
|
williamr@2
|
57 |
{
|
williamr@2
|
58 |
public: // Constructors and destructor
|
williamr@2
|
59 |
|
williamr@2
|
60 |
/**
|
williamr@2
|
61 |
* Two-phased constructor.
|
williamr@2
|
62 |
* Should be used if response to the SIP request to be sent
|
williamr@2
|
63 |
* will create a SIP dialog association.
|
williamr@2
|
64 |
* @pre aReferTo != 0
|
williamr@2
|
65 |
* @param aDialog a dialog to be associated with
|
williamr@4
|
66 |
* @param aReferTo referred-to resource;
|
williamr@4
|
67 |
* Ownership is transferred
|
williamr@2
|
68 |
* @return New object; the ownership is transferred
|
williamr@2
|
69 |
* @leave KErrArgument if aReferTo == 0
|
williamr@2
|
70 |
*/
|
williamr@2
|
71 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
72 |
NewL(CSIPDialog& aDialog,
|
williamr@2
|
73 |
CSIPReferToHeader* aReferTo);
|
williamr@2
|
74 |
|
williamr@2
|
75 |
/**
|
williamr@2
|
76 |
* Two-phased constructor.
|
williamr@2
|
77 |
* Must be used if response to the SIP request to be sent
|
williamr@2
|
78 |
* will create a SIP dialog association.
|
williamr@2
|
79 |
* @pre aReferTo != 0
|
williamr@2
|
80 |
* @param aDialog a dialog to be associated with
|
williamr@4
|
81 |
* @param aReferTo referred-to resource;
|
williamr@4
|
82 |
* Ownership is transferred
|
williamr@2
|
83 |
* @return New object; the ownership is transferred
|
williamr@2
|
84 |
* @leave KErrArgument if aReferTo == 0
|
williamr@2
|
85 |
*/
|
williamr@2
|
86 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
87 |
NewLC(CSIPDialog& aDialog,
|
williamr@2
|
88 |
CSIPReferToHeader* aReferTo);
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/**
|
williamr@2
|
91 |
* Two-phased constructor
|
williamr@2
|
92 |
* @pre aFrom != 0
|
williamr@2
|
93 |
* @pre aReferTo != 0
|
williamr@2
|
94 |
* @pre aRemoteUri != 0
|
williamr@2
|
95 |
* The user of the class must not define tags in From-header
|
williamr@2
|
96 |
* and To-header.
|
williamr@2
|
97 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
98 |
* dialog association
|
williamr@2
|
99 |
* @param aFrom originator's address; the ownership is transfered
|
williamr@2
|
100 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
101 |
* the request is addressed to.
|
williamr@4
|
102 |
* @param aReferTo referred-to resource;
|
williamr@4
|
103 |
* Ownership is transferred
|
williamr@2
|
104 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
105 |
* the remote target uri will be used for To-header
|
williamr@2
|
106 |
* construction; the ownership is transfered
|
williamr@2
|
107 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
108 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
109 |
* the ownership is transfered
|
williamr@2
|
110 |
* @return New object; the ownership is transferred.
|
williamr@2
|
111 |
* @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
114 |
NewL(CSIPConnection& aConnection,
|
williamr@2
|
115 |
CSIPFromHeader* aFrom,
|
williamr@2
|
116 |
CUri8* aRemoteUri,
|
williamr@2
|
117 |
CSIPReferToHeader* aReferTo,
|
williamr@2
|
118 |
CSIPToHeader* aTo=0,
|
williamr@2
|
119 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
120 |
|
williamr@2
|
121 |
/**
|
williamr@2
|
122 |
* Two-phased constructor
|
williamr@2
|
123 |
* @pre aFrom != 0
|
williamr@2
|
124 |
* @pre aReferTo != 0
|
williamr@2
|
125 |
* @pre aRemoteUri != 0
|
williamr@2
|
126 |
* The user of the class must not define tags in From-header
|
williamr@2
|
127 |
* and To-header.
|
williamr@2
|
128 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
129 |
* dialog association
|
williamr@2
|
130 |
* @param aFrom originator's address; the ownership is transfered
|
williamr@2
|
131 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
132 |
* the request is addressed to.
|
williamr@4
|
133 |
* @param aReferTo referred-to resource;
|
williamr@4
|
134 |
* Ownership is transferred
|
williamr@2
|
135 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
136 |
* the remote target uri will be used for To-header
|
williamr@2
|
137 |
* construction; the ownership is transfered
|
williamr@2
|
138 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
139 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
140 |
* the ownership is transfered
|
williamr@2
|
141 |
* @return New object; the ownership is transferred.
|
williamr@2
|
142 |
* @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
|
williamr@2
|
143 |
*/
|
williamr@2
|
144 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
145 |
NewLC(CSIPConnection& aConnection,
|
williamr@2
|
146 |
CSIPFromHeader* aFrom,
|
williamr@2
|
147 |
CUri8* aRemoteUri,
|
williamr@2
|
148 |
CSIPReferToHeader* aReferTo,
|
williamr@2
|
149 |
CSIPToHeader* aTo=0,
|
williamr@2
|
150 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
151 |
|
williamr@2
|
152 |
/**
|
williamr@2
|
153 |
* Two-phased constructor
|
williamr@2
|
154 |
* @pre aReferTo != 0
|
williamr@2
|
155 |
* @pre aRemoteUri != 0
|
williamr@2
|
156 |
* The user of the class must not define tags in From-header
|
williamr@2
|
157 |
* and To-header.
|
williamr@2
|
158 |
* @pre aContext.IsContextActive() == ETrue
|
williamr@2
|
159 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
160 |
* dialog association
|
williamr@2
|
161 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
162 |
* the request is targeted to.
|
williamr@2
|
163 |
* @param aContext used for selecting outbound
|
williamr@2
|
164 |
* proxy and originator's address (AOR) and contact
|
williamr@4
|
165 |
* @param aReferTo referred-to resource;
|
williamr@4
|
166 |
* Ownership is transferred
|
williamr@2
|
167 |
* @param aFrom originator's address. If not defined it will
|
williamr@2
|
168 |
* constructed using registration context (User's AOR);
|
williamr@2
|
169 |
* the ownership is transfered
|
williamr@2
|
170 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
171 |
* the remote target uri will be used for To-header
|
williamr@2
|
172 |
* construction; the ownership is transfered
|
williamr@2
|
173 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
174 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
175 |
* the ownership is transfered
|
williamr@2
|
176 |
* @return New object: the ownership is transferred.
|
williamr@2
|
177 |
* @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
|
williamr@2
|
178 |
* @leave KErrSIPInvalidRegistrationState
|
williamr@2
|
179 |
* if aContext.IsContextActive() == EFalse
|
williamr@2
|
180 |
*/
|
williamr@2
|
181 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
182 |
NewL(CSIPConnection& aConnection,
|
williamr@2
|
183 |
CUri8* aRemoteUri,
|
williamr@2
|
184 |
const MSIPRegistrationContext& aContext,
|
williamr@2
|
185 |
CSIPReferToHeader* aReferTo,
|
williamr@2
|
186 |
CSIPFromHeader* aFrom=0,
|
williamr@2
|
187 |
CSIPToHeader* aTo=0,
|
williamr@2
|
188 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/**
|
williamr@2
|
191 |
* Two-phased constructor
|
williamr@2
|
192 |
* @pre aReferTo != 0
|
williamr@2
|
193 |
* @pre aRemoteUri != 0
|
williamr@2
|
194 |
* The user of the class must not define tags in From-header
|
williamr@2
|
195 |
* and To-header.
|
williamr@2
|
196 |
* @pre aContext.IsContextActive()==ETrue
|
williamr@2
|
197 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
198 |
* dialog association
|
williamr@2
|
199 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
200 |
* the request is targeted to.
|
williamr@2
|
201 |
* @param aContext used for selecting outbound
|
williamr@2
|
202 |
* proxy and originator's address (AOR) and contact
|
williamr@4
|
203 |
* @param aReferTo referred-to resource;
|
williamr@4
|
204 |
* Ownership is transferred
|
williamr@2
|
205 |
* @param aFrom originator's address. If not defined it will
|
williamr@2
|
206 |
* constructed using registration context (User's AOR);
|
williamr@2
|
207 |
* the ownership is transfered
|
williamr@2
|
208 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
209 |
* the remote target uri will be used for To-header
|
williamr@2
|
210 |
* construction; the ownership is transfered
|
williamr@2
|
211 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
212 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
213 |
* the ownership is transfered
|
williamr@2
|
214 |
* @return New object; the ownership is transferred.
|
williamr@2
|
215 |
* @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
|
williamr@2
|
216 |
* @leave KErrSIPInvalidRegistrationState
|
williamr@2
|
217 |
* if aContext.IsContextActive() == EFalse
|
williamr@2
|
218 |
*/
|
williamr@2
|
219 |
IMPORT_C static CSIPReferDialogAssoc*
|
williamr@2
|
220 |
NewLC(CSIPConnection& aConnection,
|
williamr@2
|
221 |
CUri8* aRemoteUri,
|
williamr@2
|
222 |
const MSIPRegistrationContext& aContext,
|
williamr@2
|
223 |
CSIPReferToHeader* aReferTo,
|
williamr@2
|
224 |
CSIPFromHeader* aFrom=0,
|
williamr@2
|
225 |
CSIPToHeader* aTo=0,
|
williamr@2
|
226 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
227 |
|
williamr@2
|
228 |
/**
|
williamr@2
|
229 |
* Destructor
|
williamr@2
|
230 |
*/
|
williamr@2
|
231 |
IMPORT_C ~CSIPReferDialogAssoc();
|
williamr@2
|
232 |
|
williamr@2
|
233 |
public: //New functions
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/**
|
williamr@2
|
236 |
* Creates REFER and sends it to the remote target.
|
williamr@2
|
237 |
* leaves on failure.
|
williamr@2
|
238 |
* 101-199 or 2xx response will create REFER dialog
|
williamr@2
|
239 |
* association in case of first REFER request within
|
williamr@2
|
240 |
* this dialog association.
|
williamr@2
|
241 |
* @pre Dialog().Connection().State()==EActive
|
williamr@2
|
242 |
* @pre Dialog().State()==CSIPDialog::EInit ||
|
williamr@2
|
243 |
* Dialog().State()==CSIPDialog::EConfirmed
|
williamr@2
|
244 |
* @param aElements optional SIP message headers and body. Ownership is
|
williamr@2
|
245 |
* transferred.
|
williamr@2
|
246 |
* @return REFER SIP transaction. Ownership is transferred.
|
williamr@2
|
247 |
* @leave KErrSIPInvalidDialogState if dialog is in wrong state
|
williamr@2
|
248 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
249 |
* object has been deleted.
|
williamr@2
|
250 |
* @capability NetworkServices
|
williamr@2
|
251 |
*/
|
williamr@2
|
252 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
253 |
SendReferL(CSIPMessageElements* aElements=0);
|
williamr@2
|
254 |
|
williamr@2
|
255 |
/**
|
williamr@2
|
256 |
* Gets referred-to resouce
|
williamr@2
|
257 |
* @return referred-to resource
|
williamr@2
|
258 |
*/
|
williamr@2
|
259 |
IMPORT_C const CSIPReferToHeader& ReferTo() const;
|
williamr@2
|
260 |
|
williamr@2
|
261 |
public: // New functions, for internal use
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/**
|
williamr@2
|
264 |
* Sends a REFER request.
|
williamr@2
|
265 |
*
|
williamr@2
|
266 |
* @pre Dialog().Connection().State()==EActive
|
williamr@2
|
267 |
* @param aElements optional SIP message headers and body.
|
williamr@2
|
268 |
* Ownership is transferred.
|
williamr@2
|
269 |
* @param aWithinDialog ETrue if REFER is sent within dialog,
|
williamr@2
|
270 |
* EFalse if REFER creates the dialog.
|
williamr@2
|
271 |
* @return REFER SIP transaction. Ownership is transferred.
|
williamr@2
|
272 |
*/
|
williamr@2
|
273 |
CSIPClientTransaction* DoSendReferL(CSIPMessageElements* aElements,
|
williamr@2
|
274 |
TBool aWithinDialog);
|
williamr@2
|
275 |
|
williamr@2
|
276 |
private: // Constructors
|
williamr@2
|
277 |
|
williamr@2
|
278 |
CSIPReferDialogAssoc();
|
williamr@2
|
279 |
|
williamr@2
|
280 |
static CSIPReferDialogAssoc* NewLC(CSIPConnection& aConnection,
|
williamr@2
|
281 |
CUri8* aRemoteUri,
|
williamr@2
|
282 |
CSIPReferToHeader* aReferTo,
|
williamr@2
|
283 |
CSIPFromHeader* aFrom,
|
williamr@2
|
284 |
CSIPToHeader* aTo,
|
williamr@2
|
285 |
CSIPContactHeader* aContact,
|
williamr@2
|
286 |
const MSIPRegistrationContext* aContext);
|
williamr@2
|
287 |
|
williamr@2
|
288 |
private: // Data
|
williamr@2
|
289 |
|
williamr@2
|
290 |
CSIPReferToHeader* iReferTo;
|
williamr@2
|
291 |
};
|
williamr@2
|
292 |
|
williamr@2
|
293 |
#endif
|