Re: [reSIProcate] SDP Contents not getting created.....
FCG ZHAO Hongbin wrote:
>I think you should call it like this:
> ...................................................
> sdp = new SdpContents(hfv, type); <---- But this is the problem for me.
> sdp->checkParsed();
> ............................................
>
>Because sdpArray is a local variable allocated on stack. On leave this
>function, the memory will be released.
>After called sdp->checkParsed(), a memory will be created for sdp object on
>heap.
>
>
Ok, I took your suggestion and called this routine in my Create_sdp
function. Partial code is here...
void
InviteClient::Create_sdp(char *myDestURI)
{
char *mysdpString;
char sdpArray[2048];
char *sdpstr = &sdpArray[0];
// Make a "to" NameAddr
NameAddr to(myDestURI);
Data host(to.uri().host());
const char *ipadr = [mBridge getMyIP];
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);
txt = new Data(sdpstr);
hfv = new HeaderFieldValue(txt->data(), txt->size());
Mime type("application", "sdp");
sdp = new SdpContents(hfv, type);
sdp->checkParsed(); <---- I added this as you suggest
// now take the sdp data and ask the bridge to put it
// into the text edit box in the GUI
[mBridge PutSdpText:sdpstr];
}
Got following stack trace...
#5 0x000a2158 in resip::ParseBuffer::fail(char const*, unsigned,
resip::Data const&) const at ParseBuffer.cxx:896
#6 0x0009f398 in resip::ParseBuffer::skipChar(char) at ParseBuffer.cxx:85
#7 0x000104fc in
resip::SdpContents::Session::Origin::parse(resip::ParseBuffer&) at
SdpContents.cxx:267
#8 0x00014100 in resip::SdpContents::Session::parse(resip::ParseBuffer&)
at SdpContents.cxx:955
#9 0x0000fd4c in resip::SdpContents::parse(resip::ParseBuffer&) at
SdpContents.cxx:181
#10 0x0009da1c in resip::LazyParser::checkParsed() const at
LazyParser.cxx:79
#11 0x0000ba8c in InviteClient::Create_sdp(char*) at Siphandlers.cpp:185
#12 0x0000a0ac in -[SipBridge makeCallTo:] at SipBridge.mm:278
Here is log output...
DEBUG | 1133997963 | 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:85
/Users/johndraper/Documents/SIP/Open_source/resiprocate-0.9.0-5019/resiprocate/os/ParseBuffer.cxx:85,
Parse failed expected 'o' in context: Contents
v=0[CRLF]
^[CRLF]
*o=0 0 IN IP4 192.168.0.4
*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
WTF, and what am I doing wrong...
John