< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] Workaround for invalid SDP generated by Sonus_UAC


On Mon, 16 Feb 2009 at 20:54 +0300, Dmitry Semyonov wrote:

I recently discovered that some Sonus equipment (identified by Sonus_UAC in SDP) produces invalid SDP contents which reSIProcate is not capable of dealing with:
 [...]
I most likely will be able to workaround this Sonus bug by playing with original offer SDP, but I'd also like to warn everyone on this list about the issue, and provide possible workaround idea for reSIProcate parser (untested).

Well, it turned out that this patch became necessary for us to complete interoperability tests. So, actually working version is provided below.

It tolerates invalid ordering of c= b= k= a= lines within m= section of incoming SDP.


Index: resip/stack/SdpContents.cxx
===================================================================
--- resip/stack/SdpContents.cxx (revision 8346)
+++ resip/stack/SdpContents.cxx (working copy)
@@ -1327,6 +1327,10 @@
       skipEol(pb);
    }

+  const char *pos;
+  do { // workaround for broken SDP implementations (e.g. Sonus_UAC) that can 
put a= before c=
+   pos = (const char *)pb.position();
+
    while (!pb.eof() && *pb.position() == 'c')
    {
       addConnection(Connection());
@@ -1392,6 +1396,8 @@
    }

    mAttributeHelper.parse(pb);
+
+  } while (!pb.eof() && pos != (const char *)pb.position());
 }

 EncodeStream&

--
...Bye..Dmitry.