Fixed bug: check for repeated 'Accept' header to detect if SDP is accepted.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6538 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2022-02-01 10:12:26 +00:00
parent 8ca99f45a5
commit 9c9129aa98
1 changed files with 13 additions and 2 deletions

View File

@ -2037,8 +2037,19 @@ static void copyPrivacy(SIPMessage& sip, const NamedList& msg)
static bool sdpAccept(const SIPMessage* sip, bool def)
{
static const Regexp r("\\(^\\|,\\) *application/sdp *\\($\\|[,;]\\)",false,true);
const MimeHeaderLine* hl = sip ? sip->getHeader("Accept") : 0;
return hl ? r.matches(*hl) : def;
if (sip) {
for (ObjList* o = sip->header.skipNull(); o; o = o->skipNext()) {
const MimeHeaderLine* hl = static_cast<const MimeHeaderLine*>(o->get());
if (hl->name() |= "Accept")
continue;
if (r.matches(*hl))
return true;
// Header found but not matching: reset def val
def = false;
}
}
return def;
}
// Copy message body to yate message