Increment the SDP session version only if the hash of the body (except version) has changed.
This helps with some SIP endpoints that reject any SDP change. git-svn-id: http://yate.null.ro/svn/yate/trunk@5861 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
5578f5ce60
commit
8f8fe9ad85
|
@ -29,7 +29,7 @@ namespace TelEngine {
|
|||
SDPSession::SDPSession(SDPParser* parser)
|
||||
: m_parser(parser), m_mediaStatus(MediaMissing),
|
||||
m_rtpForward(false), m_sdpForward(false), m_rtpMedia(0),
|
||||
m_sdpSession(0), m_sdpVersion(0),
|
||||
m_sdpSession(0), m_sdpVersion(0), m_sdpHash(YSTRING_INIT_HASH),
|
||||
m_secure(m_parser->m_secure), m_rfc2833(m_parser->m_rfc2833),
|
||||
m_ipv6(false), m_enabler(0), m_ptr(0)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ SDPSession::SDPSession(SDPParser* parser)
|
|||
SDPSession::SDPSession(SDPParser* parser, NamedList& params)
|
||||
: m_parser(parser), m_mediaStatus(MediaMissing),
|
||||
m_rtpForward(false), m_sdpForward(false), m_rtpMedia(0),
|
||||
m_sdpSession(0), m_sdpVersion(0),
|
||||
m_sdpSession(0), m_sdpVersion(0), m_sdpHash(YSTRING_INIT_HASH),
|
||||
m_ipv6(false), m_enabler(0), m_ptr(0)
|
||||
{
|
||||
setSdpDebug();
|
||||
|
@ -328,9 +328,7 @@ MimeSdpBody* SDPSession::createSDP(const char* addr, ObjList* mediaList)
|
|||
// if we got no media descriptors we simply create no SDP
|
||||
if (!mediaList)
|
||||
return 0;
|
||||
if (m_sdpSession)
|
||||
++m_sdpVersion;
|
||||
else
|
||||
if (!m_sdpSession)
|
||||
m_sdpVersion = m_sdpSession = Time::secNow();
|
||||
|
||||
// override the address with the externally advertised if needed
|
||||
|
@ -340,15 +338,14 @@ MimeSdpBody* SDPSession::createSDP(const char* addr, ObjList* mediaList)
|
|||
m_originAddr = addr ? addr : m_host.safe();
|
||||
// no address means on hold or muted
|
||||
String origin;
|
||||
origin << "yate " << m_sdpSession << " " << m_sdpVersion;
|
||||
origin << " ";
|
||||
int f = addIP(origin,m_originAddr);
|
||||
String conn;
|
||||
addIP(conn,addr,f);
|
||||
|
||||
MimeSdpBody* sdp = new MimeSdpBody;
|
||||
MimeSdpBody* sdp = new MimeSdpBody(true);
|
||||
sdp->addLine("v","0");
|
||||
sdp->addLine("o",origin);
|
||||
// insert incomplete origin just for hashing purpose
|
||||
NamedString* org = sdp->addLine("o",origin);
|
||||
sdp->addLine("s",m_parser->m_sessionName);
|
||||
sdp->addLine("c",conn);
|
||||
sdp->addLine("t","0 0");
|
||||
|
@ -549,6 +546,14 @@ MimeSdpBody* SDPSession::createSDP(const char* addr, ObjList* mediaList)
|
|||
sdp->addLine("a","encryption:optional");
|
||||
}
|
||||
}
|
||||
// increment version if body hash changed
|
||||
if ((YSTRING_INIT_HASH != m_sdpHash) && (sdp->hash() != m_sdpHash))
|
||||
m_sdpVersion++;
|
||||
m_sdpHash = sdp->hash();
|
||||
// insert version in the origin line
|
||||
origin.clear();
|
||||
origin << "yate " << m_sdpSession << " " << m_sdpVersion << " " << *org;
|
||||
*org = origin;
|
||||
|
||||
return sdp;
|
||||
}
|
||||
|
|
|
@ -640,6 +640,7 @@ protected:
|
|||
ObjList* m_rtpMedia; // List of media descriptors
|
||||
int m_sdpSession; // Unique SDP session number
|
||||
int m_sdpVersion; // SDP version number, incremented each time we generate a new SDP
|
||||
unsigned int m_sdpHash; // SDP content hash
|
||||
String m_host;
|
||||
bool m_secure;
|
||||
int m_rfc2833; // Payload of RFC 2833 for remote party
|
||||
|
|
Loading…
Reference in New Issue