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