[Opalvoip-svn] SF.net SVN: opalvoip: [18747] opal/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <cso...@us...> - 2007-10-23 01:40:24
|
Revision: 18747 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=18747&view=rev Author: csoutheren Date: 2007-10-22 18:40:28 -0700 (Mon, 22 Oct 2007) Log Message: ----------- Applied OpenH323 patch 1789256 - Fixed handling of RTP padding. Thanks to Boris Pavacic Applied OpenH323 patch 1799686 - Fixed RTP aggregation handling. Thanks to Simon Zwahlen Applied OpenH323 patch 1800896 - Add SIPEndPoint::GetContactURL override. Thanks to Simon Zwahlen Applied OpenH323 patch 1800899 - Add SIP URL proxy parameter. Thanks to Simon Zwahlen Applied OpenH323 patch 1800937 - Fix media channel after openLogicalChannel reject. Thanks to Simon Zwahlen Applied OpenH323 patch 1800997 - Adde support for SIP asserted identity headers. Thanks to Simon Zwahlen Modified Paths: -------------- opal/trunk/include/rtp/jitter.h opal/trunk/include/rtp/rtp.h opal/trunk/include/sip/sipep.h opal/trunk/include/sip/sippdu.h opal/trunk/src/h323/h323.cxx opal/trunk/src/rtp/jitter.cxx opal/trunk/src/rtp/rtp.cxx opal/trunk/src/sip/handlers.cxx opal/trunk/src/sip/sippdu.cxx Modified: opal/trunk/include/rtp/jitter.h =================================================================== --- opal/trunk/include/rtp/jitter.h 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/include/rtp/jitter.h 2007-10-23 01:40:28 UTC (rev 18747) @@ -136,9 +136,6 @@ PCLASSINFO(OpalJitterBuffer, PObject); public: -#if OPAL_RTP_AGGREGATE - friend class RTP_AggregatedHandle; -#endif /**Constructor for this jitter buffer. The size of this buffer can be altered later with the SetDelay method */ OpalJitterBuffer( @@ -149,7 +146,7 @@ ); /**Destructor, which closes this down and deletes the internal list of frames */ - ~OpalJitterBuffer(); + virtual ~OpalJitterBuffer(); /**Report the statistics for this jitter instance */ void PrintOn(ostream & strm ) const; @@ -210,7 +207,7 @@ /**Start jitter thread */ - void Resume(PHandleAggregator * aggregator = NULL); + virtual void Resume(PHandleAggregator * aggregator = NULL); PDECLARE_NOTIFIER(PThread, OpalJitterBuffer, JitterThreadMain); @@ -262,8 +259,6 @@ PThread * jitterThread; PINDEX jitterStackSize; - RTP_AggregatedHandle * aggregratedHandle; - BOOL Init(Entry * & currentReadFrame, BOOL & markerWarning); BOOL PreRead(Entry * & currentReadFrame, BOOL & markerWarning); BOOL OnRead(Entry * & currentReadFrame, BOOL & markerWarning, BOOL loop); @@ -278,6 +273,9 @@ PCLASSINFO(RTP_JitterBuffer, OpalJitterBuffer); public: +#if OPAL_RTP_AGGREGATE + friend class RTP_AggregatedHandle; +#endif RTP_JitterBuffer( RTP_Session & session, ///< Associated RTP session tor ead data from unsigned minJitterDelay, ///< Minimum delay in RTP timestamp units @@ -285,8 +283,8 @@ unsigned timeUnits = 8, ///< Time units, usually 8 or 16 PINDEX stackSize = 30000 ///< Stack size for jitter thread ); + virtual ~RTP_JitterBuffer(); - /**This class instance collects data from the outside world in this method. @@ -296,9 +294,14 @@ BOOL loop ///< If TRUE, loop as long as data is available, if FALSE, only process once ) ; + /**Start jitter thread + */ + virtual void Resume(PHandleAggregator * aggregator = NULL); + protected: /**This class extracts data from the outside world by reading from this session variable */ RTP_Session & session; + RTP_AggregatedHandle * aggregatedHandle; }; Modified: opal/trunk/include/rtp/rtp.h =================================================================== --- opal/trunk/include/rtp/rtp.h 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/include/rtp/rtp.h 2007-10-23 01:40:28 UTC (rev 18747) @@ -443,6 +443,11 @@ BOOL GetMarker() const { return (theArray[1]&0x80) != 0; } void SetMarker(BOOL m); + BOOL GetPadding() const; + void SetPadding(BOOL v); + + unsigned GetPaddingSize() const; + PayloadTypes GetPayloadType() const { return (PayloadTypes)(theArray[1]&0x7f); } void SetPayloadType(PayloadTypes t); Modified: opal/trunk/include/sip/sipep.h =================================================================== --- opal/trunk/include/sip/sipep.h 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/include/sip/sipep.h 2007-10-23 01:40:28 UTC (rev 18747) @@ -953,7 +953,7 @@ * If the transport is not running, the first listener transport * will be used, if any. */ - SIPURL GetLocalURL( + virtual SIPURL GetLocalURL( const OpalTransport & transport, ///< Transport on which we can receive new requests const PString & userName = PString::Empty() ///< The user name part of the contact field ); Modified: opal/trunk/include/sip/sippdu.h =================================================================== --- opal/trunk/include/sip/sippdu.h 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/include/sip/sippdu.h 2007-10-23 01:40:28 UTC (rev 18747) @@ -392,6 +392,12 @@ PString GetFrom() const; void SetFrom(const PString & v); + PString GetPAssertedIdentity() const; + void SetPAssertedIdentity(const PString & v); + + PString GetPPreferredIdentity() const; + void SetPPreferredIdentity(const PString & v); + PString GetAccept() const; void SetAccept(const PString & v); Modified: opal/trunk/src/h323/h323.cxx =================================================================== --- opal/trunk/src/h323/h323.cxx 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/src/h323/h323.cxx 2007-10-23 01:40:28 UTC (rev 18747) @@ -4072,6 +4072,15 @@ } if (!fromRemote) { + // close the source media stream so it will be re-established + OpalMediaStream* stream = NULL; + stream = conflictingChannel.GetMediaStream(); + if (stream != NULL) { + OpalMediaPatch * patch = stream->GetPatch(); + if (patch != NULL) + patch->GetSource().Close(); + } + conflictingChannel.Close(); H323Capability * capability = remoteCapabilities.FindCapability(channel->GetCapability()); if (capability == NULL) { Modified: opal/trunk/src/rtp/jitter.cxx =================================================================== --- opal/trunk/src/rtp/jitter.cxx 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/src/rtp/jitter.cxx 2007-10-23 01:40:28 UTC (rev 18747) @@ -385,10 +385,6 @@ #else analyser = NULL; #endif - -#if OPAL_RTP_AGGREGATE - aggregratedHandle = NULL; -#endif } @@ -396,24 +392,13 @@ { shuttingDown = TRUE; -#if OPAL_RTP_AGGREGATE - if (jitterThread == NULL) { - if (aggregatedHandle != NULL) { - aggregratedHandle->Remove(); - delete aggregratedHandle; - aggregratedHandle = NULL; - } - } else -#endif - { - if (jitterThread != NULL) { - PTRACE(3, "RTP\tRemoving jitter buffer " << this << ' ' << jitterThread->GetThreadName()); - PAssert(jitterThread->WaitForTermination(10000), "Jitter buffer thread did not terminate"); - delete jitterThread; - jitterThread = NULL; - } else { - PTRACE(1, "RTP\tJitter buffer thread is null, when the OpalJitterBuffer destructor runs"); - } + if (jitterThread != NULL) { + PTRACE(3, "RTP\tRemoving jitter buffer " << this << ' ' << jitterThread->GetThreadName()); + PAssert(jitterThread->WaitForTermination(10000), "Jitter buffer thread did not terminate"); + delete jitterThread; + jitterThread = NULL; + } else { + PTRACE(1, "RTP\tJitter buffer thread is null, when the OpalJitterBuffer destructor runs"); } bufferMutex.Wait(); @@ -510,21 +495,8 @@ bufferMutex.Signal(); } -void OpalJitterBuffer::Resume(PHandleAggregator * -#if OPAL_RTP_AGGREGATE - aggregator -#endif - ) +void OpalJitterBuffer::Resume(PHandleAggregator * /*aggregator */) { -#if OPAL_RTP_AGGREGATE - // if we are aggregating RTP threads, add the socket to the RTP aggregator - if (aggregator != NULL) { - aggregratedHandle = new RTP_AggregatedHandle(aggregator, *this); - aggregator->AddHandle(aggregratedHandle); - return; - } -#endif - // otherwise create a seperate thread as per the old design jitterThread = PThread::Create(PCREATE_NOTIFIER(JitterThreadMain), 0, PThread::NoAutoDeleteThread, PThread::HighestPriority, "RTP Jitter:%x", jitterStackSize); jitterThread->Resume(); @@ -1019,10 +991,24 @@ PINDEX stackSize) : OpalJitterBuffer(minJitterDelay, maxJitterDelay, time, stackSize), session(sess) +#if OPAL_RTP_AGGREGATE + , aggregatedHandle(NULL) +#endif { PTRACE(6, "RTP_JitterBuffer\tConstructor" << *this); } +RTP_JitterBuffer::~RTP_JitterBuffer() +{ +#if OPAL_RTP_AGGREGATE + if (aggregatedHandle != NULL) { + aggregatedHandle->Remove(); + delete aggregatedHandle; + aggregatedHandle = NULL; + } +#endif +} + BOOL RTP_JitterBuffer::OnReadPacket(RTP_DataFrame & frame, BOOL loop) { @@ -1031,8 +1017,22 @@ return success; } +void RTP_JitterBuffer::Resume(PHandleAggregator * aggregator) +{ +#if OPAL_RTP_AGGREGATE + // if we are aggregating RTP threads, add the socket to the RTP aggregator + if (aggregator != NULL) { + aggregatedHandle = new RTP_AggregatedHandle(aggregator, *this); + aggregator->AddHandle(aggregatedHandle); + return; + } +#endif + OpalJitterBuffer::Resume(aggregator); +} + + ///////////////////////////////////////////////////////////////////////////// Modified: opal/trunk/src/rtp/rtp.cxx =================================================================== --- opal/trunk/src/rtp/rtp.cxx 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/src/rtp/rtp.cxx 2007-10-23 01:40:28 UTC (rev 18747) @@ -765,6 +765,12 @@ strm << hex << setfill('0') << PBYTEArray(GetPayloadPtr(), GetPayloadSize(), false) << setfill(' ') << dec; } +unsigned RTP_DataFrame::GetPaddingSize() const +{ + if (!GetPadding()) + return 0; + return theArray[payloadSize-1]; +} #if PTRACING static const char * const PayloadTypesNames[RTP_DataFrame::LastKnownPayloadType] = { Modified: opal/trunk/src/sip/handlers.cxx =================================================================== --- opal/trunk/src/sip/handlers.cxx 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/src/sip/handlers.cxx 2007-10-23 01:40:28 UTC (rev 18747) @@ -115,12 +115,24 @@ targetAddress.Parse(to); remotePartyAddress = targetAddress.AsQuotedString(); - transport = endpoint.CreateTransport(targetAddress.GetHostAddress()); - authenticationAttempts = 0; - const SIPURL & proxy = endpoint.GetProxy(); + // Look for a "proxy" parameter to override default proxy + const PStringToString& params = targetAddress.GetParamVars(); + SIPURL proxy; + if (params.Contains("proxy")) { + proxy.Parse(params("proxy")); + targetAddress.SetParamVar("proxy", PString::Empty()); + } + if (proxy.IsEmpty()) + proxy = endpoint.GetProxy(); + + if (!proxy.IsEmpty()) + transport = endpoint.CreateTransport(proxy.GetHostAddress()); + else + transport = endpoint.CreateTransport(targetAddress.GetHostAddress()); + // Default routeSet if there is a proxy if (!proxy.IsEmpty() && routeSet.GetSize() == 0) routeSet += "sip:" + proxy.GetHostName() + ':' + PString(proxy.GetPort()) + ";lr"; Modified: opal/trunk/src/sip/sippdu.cxx =================================================================== --- opal/trunk/src/sip/sippdu.cxx 2007-10-23 01:10:01 UTC (rev 18746) +++ opal/trunk/src/sip/sippdu.cxx 2007-10-23 01:40:28 UTC (rev 18747) @@ -985,7 +985,26 @@ SetAt(compactForm ? "f" : "From", v); } +PString SIPMIMEInfo::GetPAssertedIdentity() const +{ + return (*this)["P-Asserted-Identity"]; +} +void SIPMIMEInfo::SetPAssertedIdentity(const PString & v) +{ + SetAt("P-Asserted-Identity", v); +} + +PString SIPMIMEInfo::GetPPreferredIdentity() const +{ + return (*this)["P-Preferred-Identity"]; +} + +void SIPMIMEInfo::SetPPreferredIdentity(const PString & v) +{ + SetAt("P-Preferred-Identity", v); +} + PString SIPMIMEInfo::GetCallID() const { return GetFullOrCompact("Call-ID", 'i'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |