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

[reSIProcate] "sdp" problem...


Ok,

I narrowed the problem down a little more.  It was the leading tabs that
broke the parser.  Ok,  so I took them out,  and now I get this...

DEBUG | 1134000558 | SipPhone | RESIP | /Users/johndraper/Documents/SIP/Open_source/resiprocate-0.9.0-5019/resiprocate/os/BaseException.cxx:17 | BaseException at /Users/johndraper/Documents/SIP/Open_source/resiprocate-0.9.0-5019/resiprocate/os/ParseBuffer.cxx:748 /Users/johndraper/Documents/SIP/Open_source/resiprocate-0.9.0-5019/resiprocate/os/ParseBuffer.cxx:748, Parse failed Expected a digit, got: IN IP4 192.168.0.4 <---- So, it gags here.

s=WhitePhone Mac
c=IN IP4 192.168.0.4
t=0 0
m=audio 10976 RTP/AVP 0 8 3 97 101
a=rtpmap:0 pcmu/8000
a=rtpmap:8 pcma/8000
a=rtpmap:3 gsm/8000
a=rtpmap:97 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

I modified the code to take out the leading tabs like this:

   int result = sprintf(sdpstr, "v=0\n\
o=0 0 IN IP4 %s\r\n\
s=WhitePhone Mac\r\n\
c=IN IP4 %s\r\n\
t=0 0\r\n\
m=audio 10976 RTP/AVP 0 8 3 97 101\r\n\
a=rtpmap:0 pcmu/8000\r\n\
a=rtpmap:8 pcma/8000\r\n\
a=rtpmap:3 gsm/8000\r\n\
a=rtpmap:97 speex/8000\r\n\
a=rtpmap:101 telephone-event/8000\r\n\
a=fmtp:101 0-15\r\n", ipadr, ipadr);
in context: Contents
v=0 <---- NOTE here, the logs repeat it.
o=0 0 IN IP4 192.168.0.4[CRLF]
     ^[CRLF]
s=WhitePhone Mac
c=IN IP4 192.168.0.4
t=0 0
m=audio 10976 RTP/AVP 0 8 3 97 101
a=rtpmap:0 pcmu/8000
a=rtpmap:8 pcma/8000
a=rtpmap:3 gsm/8000
a=rtpmap:97 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

*UInt64
ParseBuffer::unsignedLongLong()
{
  if (this->eof())
  {

     fail(__FILE__, __LINE__,"Expected a digit, got eof ");
  }

  const char* p = mPosition;
  assert(p);
  char c = *p;

  if (!isdigit(c))
  {
     Data msg("Expected a digit, got: ");
     msg += Data(mPosition, (mEnd - mPosition));
     fail(__FILE__, __LINE__,msg);
  }
*
the char *p points to:     0 IN IP4 192.168.0.4......

Then,  I continue and it gets called again...  this time "p" points to

IN IP4 192.168.0.4

So,  first time it digested the "0" and processed it,  but the 2nd time,
it's now pointing to the next non-white character,  the "I".

So now,  the statement:    char c = *p;  c is now "I",

  if (!isdigit(c))
  {
Data msg("Expected a digit, got: "); <----- So, this is executed
     msg += Data(mPosition, (mEnd - mPosition));
     fail(__FILE__, __LINE__,msg);
  }

I happen to know from reading the rfc2327 that there is nothing
wrong with the line:   c=0 IN IP4 192.168.0.4

So why is it gagging?   Is this a resip bug?

John