1 /* |
|
2 * Copyright (c) 2005-2007 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: Sent capability query (OPTIONS) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "musavacapabilityquerybase.h" |
|
20 #include "muscleanupresetanddestroy.h" |
|
21 #include <escapeutils.h> |
|
22 #include <sipconnection.h> |
|
23 #include <sipprofile.h> |
|
24 #include <sipclienttransaction.h> |
|
25 #include <sipmessageelements.h> |
|
26 #include <siprequestelements.h> |
|
27 #include <sipextensionheader.h> |
|
28 #include <sipacceptcontactheader.h> |
|
29 #include <sipcontactheader.h> |
|
30 #include <sipacceptheader.h> |
|
31 #include <sipstrings.h> |
|
32 #include <sipstrconsts.h> |
|
33 #include <sipresponseelements.h> |
|
34 #include <sipaddress.h> |
|
35 #include <sipfromheader.h> |
|
36 #include <sdpdocument.h> |
|
37 #include <sdporiginfield.h> |
|
38 #include <sdpconnectionfield.h> |
|
39 #include <sdpattributefield.h> |
|
40 #include <sdpmediafield.h> |
|
41 #include <e32math.h> |
|
42 #include <e32property.h> |
|
43 |
|
44 #include "mussettings.h" |
|
45 #include "muslogger.h" |
|
46 #include "mmusavacapabilityqueryobserver.h" |
|
47 #include "musavacapability.h" |
|
48 #include "musavacapabilityexchange.h" |
|
49 #include "musavaterminal.h" |
|
50 #include "musavacapabilitycontext.h" |
|
51 #include "musavasipheaderutil.h" |
|
52 #include "mussesseioninformationapi.h" |
|
53 |
|
54 // -------------------------------------------------------------------------- |
|
55 // C++ constructor |
|
56 // -------------------------------------------------------------------------- |
|
57 // |
|
58 CMusAvaCapabilityQueryBase::CMusAvaCapabilityQueryBase( |
|
59 CMusAvaCapability& aCapability, |
|
60 CSIPConnection& aSIPConnection, |
|
61 CSIPProfile& aProfile ) |
|
62 : iCapability( aCapability ), |
|
63 iSIPConnection( aSIPConnection ), |
|
64 iProfile( aProfile ), |
|
65 iState( ECapabilityQueryCreated ), |
|
66 iResult( KCapabilityQueryNotReady ) |
|
67 { |
|
68 } |
|
69 |
|
70 // -------------------------------------------------------------------------- |
|
71 // C++ destructor |
|
72 // -------------------------------------------------------------------------- |
|
73 // |
|
74 CMusAvaCapabilityQueryBase::~CMusAvaCapabilityQueryBase() |
|
75 { |
|
76 MUS_LOG( |
|
77 "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::~CMusAvaCapabilityQueryBase" ) |
|
78 |
|
79 delete iRegisteredContact; |
|
80 delete iOriginator; |
|
81 if ( iTerminal ) |
|
82 { |
|
83 iTerminal->DetachQuery( *this ); |
|
84 } |
|
85 ResetAndDestroyTrx(); |
|
86 MUS_LOG( "mus: [MUSAVA] -> StringPools are getting closed." ) |
|
87 MUS_LOG( |
|
88 "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::~CMusAvaCapabilityQueryBase" ) |
|
89 } |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CMusAvaCapabilityQueryBase::ConstructL |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 void CMusAvaCapabilityQueryBase::ConstructL( const TDesC& aSipAddress ) |
|
96 { |
|
97 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::ConstructL" ) |
|
98 |
|
99 // If string pool is opened already , then dont care. |
|
100 |
|
101 User::LeaveIfError( aSipAddress.Length() > 0 ? KErrNone : KErrArgument ); |
|
102 |
|
103 // If it is not registered , just leave. |
|
104 TBool isRegistered = ETrue; |
|
105 iProfile.GetParameter( KSIPProfileRegistered, isRegistered ); |
|
106 User::LeaveIfError( isRegistered ? KErrNone : KErrArgument ); |
|
107 |
|
108 TInt err( KErrNotFound ); |
|
109 const TDesC8* registeredContact( NULL ); |
|
110 err = iProfile.GetParameter( KSIPRegisteredContact, registeredContact ); |
|
111 if( err ) |
|
112 { |
|
113 MUS_LOG1( "mus: [MUSAVA] iProfile.GetParameter Contact -> %d", err ) |
|
114 User::LeaveIfError( err ); |
|
115 } |
|
116 |
|
117 // contactHeader array will only contain one instance of CSIPContactHeader, |
|
118 // since only one registered contact is decoded |
|
119 RPointerArray<CSIPContactHeader> contactHeader = |
|
120 CSIPContactHeader::DecodeL( *registeredContact ); |
|
121 MusCleanupResetAndDestroyPushL( contactHeader ); |
|
122 |
|
123 // leave if there is at least one contact not present |
|
124 if ( contactHeader.Count() < 1 ) |
|
125 { |
|
126 MUS_LOG1( "mus: [MUSAVA] contactHeader has %d instances, instead of 1", |
|
127 contactHeader.Count() ); |
|
128 User::Leave( KErrNotFound ); |
|
129 } |
|
130 |
|
131 // if more contact than pick the first one. Sip assures in idle case |
|
132 // it should always return only one registered contact. |
|
133 CSIPAddress* sipAddress = contactHeader[0]->SIPAddress(); |
|
134 if ( !sipAddress ) |
|
135 { |
|
136 MUS_LOG( "mus: [MUSAVA] name-address not present") |
|
137 User::Leave( KErrNotFound ); |
|
138 } |
|
139 iRegisteredContact = CUri8::NewL( sipAddress->Uri8().Uri() ); |
|
140 MUS_LOG_TDESC8( " mus: [MUSAVA] iRegisteredContact : ", (iRegisteredContact->Uri().UriDes())); |
|
141 CleanupStack::PopAndDestroy( &contactHeader ); |
|
142 |
|
143 sipAddress = NULL; |
|
144 const MDesC8Array* aors = NULL; |
|
145 User::LeaveIfError(iProfile.GetParameter( KSIPRegisteredAors, aors )); |
|
146 MUS_LOG( "mus: [MUSAVA] iProfile.GetParameter -> OK " ) |
|
147 if( !aors || aors->MdcaCount() <= 0 ) User::Leave(KErrArgument); |
|
148 MUS_LOG_TDESC8( " mus: [MUSAVA] AOR -> 0 : ", aors->MdcaPoint(0)); |
|
149 sipAddress = CSIPAddress::DecodeL( aors->MdcaPoint(0) ); |
|
150 MUS_LOG( "mus: [MUSAVA] CSIPAddress::DecodeL -> OK " ) |
|
151 CleanupStack::PushL( sipAddress ); |
|
152 iOriginator = CUri8::NewL(sipAddress->Uri8().Uri()); |
|
153 MUS_LOG_TDESC8( " mus: [MUSAVA] iOriginator : ", (iOriginator->Uri().UriDes())); |
|
154 CleanupStack::PopAndDestroy(sipAddress); |
|
155 |
|
156 HBufC8* sipAddress8 = EscapeUtils::ConvertFromUnicodeToUtf8L( aSipAddress ); |
|
157 CleanupStack::PushL( sipAddress8 ); |
|
158 iTerminal = &Capability().Exchange().TerminalL( sipAddress8->Des() ); |
|
159 CleanupStack::PopAndDestroy( sipAddress8 ) ; |
|
160 iTerminal->AttachQuery( *this ); |
|
161 |
|
162 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::ConstructL" ) |
|
163 } |
|
164 |
|
165 // -------------------------------------------------------------------------- |
|
166 // CMusAvaCapabilityQueryBase::Capability |
|
167 // -------------------------------------------------------------------------- |
|
168 // |
|
169 const CMusAvaCapability& CMusAvaCapabilityQueryBase::Capability() const |
|
170 { |
|
171 return iCapability; |
|
172 } |
|
173 |
|
174 // -------------------------------------------------------------------------- |
|
175 // CMusAvaCapabilityQueryBase::SetState |
|
176 // -------------------------------------------------------------------------- |
|
177 // |
|
178 void CMusAvaCapabilityQueryBase::SetState( |
|
179 CMusAvaCapabilityQueryBase::TState aState ) |
|
180 { |
|
181 iState = aState; |
|
182 } |
|
183 |
|
184 // -------------------------------------------------------------------------- |
|
185 // CMusAvaCapabilityQueryBase::SetResult |
|
186 // -------------------------------------------------------------------------- |
|
187 // |
|
188 void CMusAvaCapabilityQueryBase::SetResult( TInt aResult ) |
|
189 { |
|
190 iResult = aResult; |
|
191 } |
|
192 |
|
193 // -------------------------------------------------------------------------- |
|
194 // CMusAvaCapabilityQueryBase::Terminal |
|
195 // -------------------------------------------------------------------------- |
|
196 // |
|
197 CMusAvaTerminal& CMusAvaCapabilityQueryBase::Terminal() |
|
198 { |
|
199 return *iTerminal; |
|
200 } |
|
201 |
|
202 // -------------------------------------------------------------------------- |
|
203 // CMusAvaCapabilityQueryBase::ExecuteL |
|
204 // -------------------------------------------------------------------------- |
|
205 // |
|
206 void CMusAvaCapabilityQueryBase::ExecuteL() |
|
207 { |
|
208 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::ExecuteL" ) |
|
209 |
|
210 __ASSERT_ALWAYS( |
|
211 State() != ECapabilityQueryPrepared, User::Leave( KErrGeneral ) ); |
|
212 |
|
213 if ( State() == ECapabilityQueryCreated ) |
|
214 { |
|
215 RPointerArray<CSIPHeaderBase> headers; |
|
216 CSIPHeaderBase::PushLC( &headers ); |
|
217 |
|
218 Prepare( headers ); |
|
219 |
|
220 if ( State() == ECapabilityQueryPrepared ) |
|
221 { |
|
222 CMusAvaSipheaderUtil::AddAcceptContactHeaderL( headers, |
|
223 Capability().Feature() ); |
|
224 MUS_LOG( "mus: [MUSAVA] AddAcceptContactHeaderL -> Success ") |
|
225 CMusAvaSipheaderUtil::AddAcceptEncodingHeaderL(headers); |
|
226 MUS_LOG( "mus: [MUSAVA] AddAcceptEncodingHeaderL -> Success ") |
|
227 CMusAvaSipheaderUtil::AddAcceptLanguageHeaderL(headers); |
|
228 MUS_LOG( "mus: [MUSAVA] AddAcceptLanguageHeaderL -> Success ") |
|
229 CMusAvaSipheaderUtil::AddAcceptSdpHeaderL(headers); |
|
230 MUS_LOG( "mus: [MUSAVA] AddAcceptSDPHeaderL -> Success ") |
|
231 CMusAvaSipheaderUtil::AddPreferredIdentityHeaderL(headers, |
|
232 iOriginator->Uri().UriDes()); |
|
233 MUS_LOG( "mus: [MUSAVA] AddPreferredIdentityHeaderL -> Success ") |
|
234 AddContactHeaderL( headers ); |
|
235 MUS_LOG( "mus: [MUSAVA] AddContactHeaderL -> Success ") |
|
236 |
|
237 TBool usePrivacy = MultimediaSharingSettings::PrivacySetting(); |
|
238 if ( usePrivacy ) |
|
239 { |
|
240 NMusSessionInformationApi::TMusClirSetting clir = |
|
241 NMusSessionInformationApi::ESendOwnNumber; |
|
242 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
243 NMusSessionInformationApi::KMusClirSetting, |
|
244 reinterpret_cast<TInt&>( clir ) ); |
|
245 usePrivacy = ( clir == NMusSessionInformationApi::EDoNotSendOwnNumber ); |
|
246 } |
|
247 |
|
248 if (usePrivacy) |
|
249 { |
|
250 CMusAvaSipheaderUtil::AddPrivacyHeaderL( headers ); |
|
251 MUS_LOG( "mus: [MUSAVA] AddPrivacyHeaderL -> Success ") |
|
252 } |
|
253 //terminal ID |
|
254 if ( Capability().Exchange().TerminalId().Length() > 0 ) |
|
255 { |
|
256 MUS_LOG( "mus: [MUSAVA] Adding User-Agent header" ) |
|
257 CSIPHeaderBase* userAgent = |
|
258 MusAvaCapabilityContext::UserAgentHeaderLC( |
|
259 Capability().Exchange().TerminalId() ); |
|
260 headers.AppendL( userAgent ); |
|
261 CleanupStack::Pop( userAgent ); |
|
262 } |
|
263 |
|
264 //remote uri ( will be used as ToHeader ) |
|
265 CUri8* remoteUri = |
|
266 MusAvaCapabilityContext::ToUriL( Terminal().Uri() ); |
|
267 CleanupStack::PushL( remoteUri ); |
|
268 CSIPRequestElements* request = |
|
269 CSIPRequestElements::NewL( remoteUri ); |
|
270 CleanupStack::Pop( remoteUri ); |
|
271 CleanupStack::PushL( request ); |
|
272 |
|
273 if (usePrivacy) |
|
274 { |
|
275 _LIT8( KAnonymous, |
|
276 "\"Anonymous\" <sip:anonymous@anonymous.invalid>" ); |
|
277 CSIPFromHeader* from = CSIPFromHeader::DecodeL( KAnonymous ); |
|
278 CleanupStack::PushL( from ); |
|
279 request->SetFromHeaderL( from ); |
|
280 CleanupStack::Pop( from ); |
|
281 } |
|
282 |
|
283 request->SetMethodL( |
|
284 SIPStrings::StringF( SipStrConsts::EOptions ) ); |
|
285 |
|
286 CSIPMessageElements& message = request->MessageElements(); |
|
287 message.SetUserHeadersL( headers ); |
|
288 |
|
289 HBufC8* content = ContentLC(); |
|
290 CMusAvaSipheaderUtil::AddSdpL(request,content); |
|
291 CleanupStack::Pop(content) ; |
|
292 |
|
293 ResetAndDestroyTrx(); |
|
294 |
|
295 MUS_LOG( "mus: [MUSAVA] Sending OPTIONS request ...." ) |
|
296 iTrx = iSIPConnection.SendRequestL( request, iProfile ); |
|
297 CleanupStack::Pop( request ); |
|
298 |
|
299 iState = ECapabilityQueryExecuting; |
|
300 MUS_LOG( "mus: [MUSAVA] OPTIONS request sent" ) |
|
301 } |
|
302 |
|
303 CleanupStack::PopAndDestroy( &headers ); |
|
304 } |
|
305 |
|
306 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::ExecuteL" ) |
|
307 } |
|
308 |
|
309 // -------------------------------------------------------------------------- |
|
310 // CMusAvaCapabilityQueryBase::CompletedL |
|
311 // -------------------------------------------------------------------------- |
|
312 // |
|
313 void CMusAvaCapabilityQueryBase::CompletedL( |
|
314 const CSIPClientTransaction& aResponse ) |
|
315 { |
|
316 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::CompletedL" ) |
|
317 |
|
318 if ( iTrx && *iTrx == aResponse ) |
|
319 { |
|
320 TUint statusCode = aResponse.ResponseElements()->StatusCode(); |
|
321 if ( 100 <= statusCode && statusCode < 200 ) |
|
322 { |
|
323 return; |
|
324 } |
|
325 DoCompletedL( aResponse ); |
|
326 if ( State() == ECapabilityQueryCompleted ) |
|
327 { |
|
328 MUS_LOG( "mus: [MUSAVA] query completed" ) |
|
329 Capability().Exchange().QueryObserver().CapabilitiesResolved( |
|
330 *this ); |
|
331 } |
|
332 } |
|
333 |
|
334 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::CompletedL" ) |
|
335 } |
|
336 |
|
337 // -------------------------------------------------------------------------- |
|
338 // CMusAvaCapabilityQueryBase::Canceled |
|
339 // -------------------------------------------------------------------------- |
|
340 // |
|
341 void CMusAvaCapabilityQueryBase::Canceled( |
|
342 const CSIPClientTransaction& aTransaction ) |
|
343 { |
|
344 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::Canceled" ) |
|
345 if ( iTrx && *iTrx == aTransaction ) |
|
346 { |
|
347 MUS_LOG( "mus: [MUSAVA] query canceled" ) |
|
348 |
|
349 SetState( ECapabilityQueryCompleted ); |
|
350 SetResult( KCapabilityCapabilitesNotFound ); |
|
351 Capability().Exchange().QueryObserver().CapabilitiesResolved( |
|
352 *this ); |
|
353 } |
|
354 |
|
355 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::Canceled" ) |
|
356 } |
|
357 |
|
358 |
|
359 // -------------------------------------------------------------------------- |
|
360 // CMusAvaCapabilityQueryBase::AddContactHeaderL |
|
361 // -------------------------------------------------------------------------- |
|
362 // |
|
363 void CMusAvaCapabilityQueryBase::AddContactHeaderL( |
|
364 RPointerArray<CSIPHeaderBase>& aRequestHeaders ) |
|
365 { |
|
366 |
|
367 MUS_LOG( |
|
368 "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::AddContactHeaderL" ) |
|
369 CSIPContactHeader* contact = |
|
370 MusAvaCapabilityContext::ContactHeaderLC( *iRegisteredContact, |
|
371 Capability().Feature() ); |
|
372 aRequestHeaders.AppendL( contact ); |
|
373 CleanupStack::Pop( contact ); |
|
374 MUS_LOG( |
|
375 "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::AddContactHeaderL" ) |
|
376 } |
|
377 |
|
378 // -------------------------------------------------------------------------- |
|
379 // CMusAvaCapabilityQueryBase::State |
|
380 // -------------------------------------------------------------------------- |
|
381 // |
|
382 CMusAvaCapabilityQueryBase::TState CMusAvaCapabilityQueryBase::State() const |
|
383 { |
|
384 return iState; |
|
385 } |
|
386 |
|
387 // -------------------------------------------------------------------------- |
|
388 // CMusAvaCapabilityQueryBase::Result |
|
389 // -------------------------------------------------------------------------- |
|
390 // |
|
391 TInt CMusAvaCapabilityQueryBase::Result() const |
|
392 { |
|
393 return iResult; |
|
394 } |
|
395 |
|
396 // -------------------------------------------------------------------------- |
|
397 // CMusAvaCapabilityQueryBase::ResetAndDestroyTrx |
|
398 // -------------------------------------------------------------------------- |
|
399 // |
|
400 void CMusAvaCapabilityQueryBase::ResetAndDestroyTrx() |
|
401 { |
|
402 delete iTrx; |
|
403 iTrx = NULL; |
|
404 } |
|
405 |
|
406 // -------------------------------------------------------------------------- |
|
407 // CMusAvaCapabilityQueryBase::LocalAddress |
|
408 // -------------------------------------------------------------------------- |
|
409 // |
|
410 const CUri8& CMusAvaCapabilityQueryBase::LocalAddress() const |
|
411 { |
|
412 return *iOriginator; |
|
413 } |
|
414 |
|
415 // -------------------------------------------------------------------------- |
|
416 // CMusAvaCapabilityQueryBase::ResponseContentLC |
|
417 // -------------------------------------------------------------------------- |
|
418 // |
|
419 HBufC8* CMusAvaCapabilityQueryBase::ContentLC() |
|
420 |
|
421 { |
|
422 MUS_LOG("mus: [MUSAVA]: -> CMusAvaCapabilityQueryBase::ContentLC" ) |
|
423 |
|
424 CSdpDocument* content = CSdpDocument::NewLC(); |
|
425 |
|
426 RStringPool strPool = SdpCodecStringPool::StringPoolL(); |
|
427 RStringF netType = |
|
428 MusAvaCapabilityContext::SDPStringL( SdpCodecStringConstants::ENetType ); |
|
429 |
|
430 _LIT8(KOriginFieldUser1, "-"); |
|
431 _LIT8(KSessionName, "-"); |
|
432 content->SetSessionNameL( KSessionName ); |
|
433 |
|
434 TPtrC8 localHost; |
|
435 RStringF hostType; |
|
436 |
|
437 TTime now; |
|
438 now.UniversalTime(); |
|
439 TInt64 rand = now.Int64(); |
|
440 TInt64 sessionID = Math::Rand( rand ); |
|
441 |
|
442 hostType = strPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, |
|
443 SdpCodecStringPool::StringTableL() ); |
|
444 MUS_LOG( "EAddressTypeIP4 from string pool" ) |
|
445 |
|
446 TInetAddr aAddr(0); |
|
447 iSIPConnection.GetLocalAddrL(aAddr); |
|
448 TBuf<50> ipAddress; |
|
449 aAddr.Output(ipAddress); |
|
450 MUS_LOG_TDESC( "mus: [MUSAVA]: LocalIP Address",ipAddress ) |
|
451 HBufC8 * ipaddr8=HBufC8::NewLC(ipAddress.Length()); |
|
452 ipaddr8->Des().Copy(ipAddress); |
|
453 |
|
454 MUS_LOG( "mus: [MUSAVA]: SetOriginField" ) |
|
455 CSdpOriginField* originField = CSdpOriginField::NewL( KOriginFieldUser1, |
|
456 sessionID, |
|
457 sessionID, |
|
458 netType, |
|
459 hostType, |
|
460 *ipaddr8); |
|
461 content->SetOriginField( originField ); |
|
462 // Connection field |
|
463 MUS_LOG( "mus: [MUSAVA]: SetConnectionField" ) |
|
464 CSdpConnectionField* connectionField = |
|
465 CSdpConnectionField::NewL( netType, hostType,*ipaddr8); |
|
466 content->SetConnectionField( connectionField ); |
|
467 CleanupStack::PopAndDestroy(ipaddr8); |
|
468 |
|
469 OtherSDPHeadersL(*content); |
|
470 |
|
471 MUS_LOG( "mus: [MUSAVA]: Constructing the Sdp Content" ) |
|
472 CBufFlat* encBuf = CBufFlat::NewL( KMUSAVAMaxLengthOfSDPMessage ); |
|
473 CleanupStack::PushL( encBuf ); |
|
474 RBufWriteStream writeStream( *encBuf, 0 ); |
|
475 writeStream.PushL(); |
|
476 content->EncodeL( writeStream ); |
|
477 CleanupStack::PopAndDestroy();//writeStream |
|
478 HBufC8* textContent = encBuf->Ptr( 0 ).AllocL(); |
|
479 CleanupStack::PopAndDestroy( encBuf ); |
|
480 |
|
481 CleanupStack::PopAndDestroy(content); |
|
482 |
|
483 CleanupStack::PushL(textContent); |
|
484 |
|
485 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::ContentLC" ) |
|
486 return textContent; |
|
487 } |
|
488 |
|
489 // -------------------------------------------------------------------------- |
|
490 // CMusAvaCapabilityQueryBase::OtherSDPHeadersL |
|
491 // -------------------------------------------------------------------------- |
|
492 // |
|
493 void CMusAvaCapabilityQueryBase::OtherSDPHeadersL( CSdpDocument& aResponseContent ) |
|
494 |
|
495 { |
|
496 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapabilityQueryBase::OtherSDPHeadersL" ) |
|
497 |
|
498 MUS_LOG( "mus: [MUSAVA] Adding application attribute to SDP" ) |
|
499 //application |
|
500 CSdpAttributeField* application = CSdpAttributeField::NewLC( |
|
501 MusAvaCapabilityContext::SDPStringL( |
|
502 SdpCodecStringConstants::EMediaApplication ), |
|
503 KCapabilitySwisApplication ); |
|
504 |
|
505 aResponseContent.AttributeFields().AppendL( application ); |
|
506 CleanupStack::Pop( application ); |
|
507 |
|
508 MUS_LOG( "mus: [MUSAVA] Adding type attribute to SDP" ) |
|
509 //type |
|
510 RStringF typeStr = MusAvaCapabilityContext::SDPStringL( |
|
511 KCapabilitySDPAttributeNameType ); |
|
512 CleanupClosePushL( typeStr ); |
|
513 CSdpAttributeField* type = |
|
514 CSdpAttributeField::NewL( typeStr, KCapabilitySDPAttributeType ); |
|
515 CleanupStack::PopAndDestroy();//typeStr |
|
516 CleanupStack::PushL( type ); |
|
517 |
|
518 aResponseContent.AttributeFields().AppendL( type ); |
|
519 CleanupStack::Pop( type ); |
|
520 |
|
521 MUS_LOG( "mus: [MUSAVA] Adding media line to SDP" ) |
|
522 //media line |
|
523 CSdpMediaField* mediaLine=CSdpMediaField::NewLC( |
|
524 MusAvaCapabilityContext::SDPStringL |
|
525 (SdpCodecStringConstants::EMediaVideo ), |
|
526 NULL, |
|
527 MusAvaCapabilityContext::SDPStringL |
|
528 (SdpCodecStringConstants::EProtocolRtpAvp ), |
|
529 KCapabilitySwisFormatListH263Only ); |
|
530 |
|
531 //adding H.264 codec to SDP |
|
532 if( !MultimediaSharingSettings::IsAvcDisabled()) |
|
533 { |
|
534 MUS_LOG( "mus: [MUSAVA] - Adding avc to supported codec list" ) |
|
535 // reconstruct media line with H264 and H263 |
|
536 CleanupStack::PopAndDestroy(mediaLine); |
|
537 mediaLine = CSdpMediaField::NewLC( |
|
538 MusAvaCapabilityContext::SDPStringL |
|
539 (SdpCodecStringConstants::EMediaVideo ), |
|
540 NULL, |
|
541 MusAvaCapabilityContext::SDPStringL |
|
542 (SdpCodecStringConstants::EProtocolRtpAvp ), |
|
543 KCapabilitySwisFormatList ); |
|
544 |
|
545 CSdpFmtAttributeField* rtpMapH264 = |
|
546 CMusAvaCapability::RtpMapLineLC( KCapabilitySDPAttributeCodecH264, |
|
547 KCapabilitySDPAttributePayloadTypeH264, |
|
548 KCapabilitySDPAttributeClockrate ); |
|
549 |
|
550 mediaLine->FormatAttributeFields().AppendL( rtpMapH264 ); |
|
551 CleanupStack::Pop( rtpMapH264 ); |
|
552 } |
|
553 |
|
554 //H.263 codec |
|
555 MUS_LOG( "mus: [ENGINE] - Adding h263 to supported codec list" ) |
|
556 CSdpFmtAttributeField* rtpMapH263 = |
|
557 CMusAvaCapability::RtpMapLineLC( KCapabilitySDPAttributeCodecH263, |
|
558 KCapabilitySDPAttributePayloadType, |
|
559 KCapabilitySDPAttributeClockrate ); |
|
560 |
|
561 mediaLine->FormatAttributeFields().AppendL( rtpMapH263 ); |
|
562 CleanupStack::Pop( rtpMapH263 ); |
|
563 |
|
564 aResponseContent.MediaFields().AppendL( mediaLine ); |
|
565 CleanupStack::Pop( mediaLine ); |
|
566 |
|
567 |
|
568 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapabilityQueryBase::OtherSDPHeadersL" ) |
|
569 } |
|
570 |
|
571 |
|