Exclude from SDP media with no supported formats.

git-svn-id: http://yate.null.ro/svn/yate/trunk@1416 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-08-03 12:58:08 +00:00
parent a1a2745423
commit 0361ca65e4
1 changed files with 13 additions and 6 deletions

View File

@ -2397,12 +2397,13 @@ MimeSdpBody* YateSIPConnection::createSDP(const char* addr, ObjList* mediaList)
for (ObjList* ml = mediaList->skipNull(); ml; ml = ml->skipNext()) {
NetMedia* m = static_cast<NetMedia*>(ml->get());
String frm(m->fmtList());
ObjList* l = frm.split(',',false);
frm = *m;
frm << " " << (m->localPort() ? m->localPort().c_str() : "0") << " " << m->transport();
String mline(m->fmtList());
ObjList* l = mline.split(',',false);
mline = *m;
mline << " " << (m->localPort() ? m->localPort().c_str() : "0") << " " << m->transport();
ObjList* map = m->mappings().split(',',false);
ObjList rtpmap;
String frm;
int ptime = 0;
ObjList* f = l;
for (; f; f = f->next()) {
@ -2450,19 +2451,25 @@ MimeSdpBody* YateSIPConnection::createSDP(const char* addr, ObjList* mediaList)
TelEngine::destruct(l);
TelEngine::destruct(map);
if (*m == "audio") {
if (frm && m->isAudio()) {
// always claim to support telephone events
frm << " 101";
rtpmap.append(new String("rtpmap:101 telephone-event/8000"));
}
if (frm.null()) {
Debug(this,DebugMild,"No formats for '%s', excluding from SDP [%p]",
m->c_str(),this);
continue;
}
if (ptime) {
String* temp = new String("ptime:");
*temp << ptime;
rtpmap.append(temp);
}
sdp->addLine("m",frm);
sdp->addLine("m",mline + frm);
for (f = rtpmap.skipNull(); f; f = f->skipNext()) {
String* s = static_cast<String*>(f->get());
if (s)