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

Re: [reSIProcate] Printing parameters in ExtensionHeader


> --------------------------------------------------
> char* msg2str(SipMessage* msg){
>
>         resip::Data& DatatoSend = msg->getEncoded();
>         DatatoSend.clear();
>         resip::DataStream encodeStream(DatatoSend);
>         msg->encode(encodeStream);
>         encodeStream.flush();   // pronto per partire
>
>         return (char*)DatatoSend.c_str();
> }

You are returning a pointer to stack memory that is going out of scope
when the function returns. I think what you want is the following
instead.

SipMessage msg;
cerr << Data::from(msg).c_str();

Jason