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

Re: [reSIProcate] how to get "char *sdp_string" from "SdpContents sdp"?


Use this:

SdpContents contents;
Data encoded = Data::from(contents);
const char* buf = encoded.c_str();


On 9/22/05, Kenneth Ho <kenho@xxxxxxxxxxxxxx> wrote:
> something like this:
>
> #include <resiprocate/SdpContents.hxx>
> #include <sstream>
> #include <string>
>
> void foo (const SdpContents& sdp)
> {
>   std::ostringstream buf;
>   buf << sdp;
>   std::string txt(buf.str());
>   // do whatever you need to with *txt*
> }
>
> Ken
>
> 常铮 wrote:
> > Hi all
> > I know I can get "SdpContents sdp" from "char *sdp_string" by
> >     SdpContents* sdp;
> >     HeaderFieldValue* hfv;
> >     Data* txt;
> >     char *sdp_string = "v=...\r\no=...\r\nc=...\r\n........";
> >     txt = new Data(sdp_string);
> >     hfv = new HeaderFieldValue(txt->data(), txt->size());
> >     Mime type("application", "sdp");
> >     sdp = new SdpContents(hfv, type);
> >
> > Now, in
> > InviteSessionHandler::onAnswer(InviteSessionHandle, const SipMessage& msg, 
> > const SdpContents& sdp)
> > {
> > ..............
> > }
> > how to get "char *sdp_string" from "SdpContents sdp" ?
> >
> > Waiting for your answer online.
> > Thank you very much.
> >
> > ZhengChang
> > Beijing, China
> >
> >
> > _______________________________________________
> > resiprocate-devel mailing list
> > resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> > https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>