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

Re: [reSIProcate] SDP Contents not getting created.....


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.

2005/12/7, John Draper <lists@xxxxxxxxxxxxxxxx>:
> Hi,
>
> I'm having a problem creating an "sdp" record prior to my INVITE
> request.  The code below is supposed to create an "sdp" record
> and insert my IP address in it.  Note the <----- indicating line
> of interest and narration afterwards.
>
> void
> InviteClient::Create_sdp(char *myDestURI)
> {
>    char *mysdpString;
>
>    char    sdpArray[2048];
>    char    *sdpstr = &sdpArray[0];    <---- I do this to make it easier
> to examine.
>
>    // Make a "to" NameAddr
>    NameAddr to(myDestURI);
>
>    Data host(to.uri().host());
>    const char *ipadr = [mBridge getMyIP];    <---- Gets my IP as a
> dotted string.
>
>    int result = sprintf(sdpstr, "v=0\r\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);    <----- Checked the data,  it appears to
> be the "sdp" rec.
>
>     hfv = new HeaderFieldValue(txt->data(), txt->size());   <----
> Checks out OK.
>     Mime type("application", "sdp");
>
>     sdp = new SdpContents(hfv, type);    <---- But this is the problem
> for me.
>
> I would presume this would go to the "Content" constructor,  instead,
> It goes
> to "iostream",  where "namespace std" stuff is declared.
>
> I'm constructing the "InviteClient" client slightly differently then the
> "test"
> example, but my call to allocate a SdpConntents object and initialize it to
> my sdp record just results in an empty "sdp".
>
> I'm sending this to TWO mailing lists...
>
>  resip-devel - to address the resipricate part.
>  x-Code users to address and explain how I'm intergrating C++ with Obj C.
>
> < rest of code not important >
>
> The "sdp" is an instance variable in my "InviteClient" class,  defined
> (in part)
> below.
>
> class InviteClient : public InviteSessionHandler, public OutOfDialogHandler
> {
>   public:
>      bool connected;
>      ClientRegistrationHandle registerHandle;
>
>      // More instance variables
>      bool                 done;
>      SdpContents*         sdp;       <----- This is what I'm trying to
> populate.
>      HeaderFieldValue* hfv;
>      Data*             txt;
>      time_t*             pHangupAt;
>      const SipMessage& reqresponse;
>
>        < rest not important >
>
>  From the source level debugger, when I step into the "new
> SdpContents(hfv, type)"
> you see above,  I don't get to the SdpContents constructor,  instead I go to
> "iostream".  Has anyone else had this problem?  Can someone please shed some
> light on whats going on?
>
> John
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>