[reSIProcate] multipart/alternative content-type

Scott Godin sgodin at sipspectrum.com
Thu Jul 21 10:14:44 CDT 2016


Have you seen the code in InviteSession::makeOfferAnswer?  It might help.

Scott



On Wed, Jul 20, 2016 at 2:43 PM, Diego Carvalho Domingos <
ddomingos at daitangroup.com> wrote:

> Hi,
> Sometime ago I asked how to parse a message with content-type
> multipart/alternative to get the two SDPs. Now I would like some help to
> build a multipart/alternative message. This is how I build a message with a
> single SDP:
>
>
>
> Data* txt = new Data(sdpString.c_str());
>
> HeaderFieldValue* hfv = new HeaderFieldValue(txt->data(), (unsigned int)
> txt->size());
>
> Mime type("application", "sdp");
>
> SdpContents sdp((const HeaderFieldValue&) *hfv, (const Mime&) type);
>
>
>
> I know there is a MultipartAlternativeContents but I don’t know how to
> use it, specially what would be the HeaderFieldValue that I would pass in
> the constructor. Is it possible to build such message using Parts() from
> two SdpContents? Any help is appreciated. Thanks,
>
>
>
> Diego
>
>
>
> *From:* Diego Carvalho Domingos
> *Sent:* terça-feira, 17 de maio de 2016 13:19
> *To:* 'Scott Godin' <sgodin at sipspectrum.com>
> *Cc:* resiprocate-devel at resiprocate.org
> *Subject:* RE: [reSIProcate] multipart/alternative content-type
>
>
>
> This is exactly what I wanted. Thank you very much. Regards,
> Diego
>
>
>
> *From:* slgodin at gmail.com [mailto:slgodin at gmail.com <slgodin at gmail.com>] *On
> Behalf Of *Scott Godin
> *Sent:* terça-feira, 17 de maio de 2016 12:12
> *To:* Diego Carvalho Domingos <ddomingos at daitangroup.com>
> *Cc:* resiprocate-devel at resiprocate.org
> *Subject:* Re: [reSIProcate] multipart/alternative content-type
>
>
>
> There is a setting on the InviteSessionHandler constructor that will tell
> DUM to provide you with the entire body back instead of just Sdp bodies.
> Check out the following comment in InviteSessionHandler.hxx
>
>
>
> /**
>
>     Base class for class InviteSessionHandler.  The application must
> override this class
>
>     and provide an imlementation of the handlers below.  The class must
> then be set as
>
>     an invite session handler on dum
> (DialogUsageManager::setInviteSessionHandler()).
>
>
>
>     If you wish to handle invite session offer/answers using generic
> contents instead of
>
>     SDP, then construct this class with a bool argument of true, and be
> sure to add
>
>     implementations of all of the handlers below that take a Contents
> parameter type
>
>     (ie. onEarlyMedia, onOffer, onAnswer, and onRemoteAnswerChanged).
> Overriding these
>
>     methods will cause their SdpContent counterparts to not be called.
> You can then provide
>
>     a basic empty body implementation of these SdpContent versions of the
> callbacks.
>
>
>
>     Example handler for generic (non-sdp only) invite sessions:
>
>     class MyInviteSessionHandler : public InviteSessionHandler
>
>     {
>
>        MyInviteSessionHandler() : InviteSessionHandler(true) {};
>
>        ...
>
>        virtual void onOffer(InviteSessionHandle, const SipMessage& msg,
> const SdpContents&)
>
>        {}  // No body required
>
>        virtual void onOffer(InviteSessionHandle, const SipMessage& msg,
> const Contents&)
>
>        {
>
>           // Add handler body here
>
>        }
>
>        ...
>
>     };
>
> */
>
>
>
> Scott
>
>
>
> On Tue, May 17, 2016 at 10:02 AM, Diego Carvalho Domingos <
> ddomingos at daitangroup.com> wrote:
>
> Thanks for answering, Scott
> But where I would get the whole multipart contents from?
> Like I said, I’m using the getContents method from the SipMessage class,
> and this is returning a SdpContents already (otherwise the dynamic_cast
> would fail), not a MultipartAlternativeContents.
> Regards,
>
>
>
> Diego
>
>
>
> *From:* slgodin at gmail.com [mailto:slgodin at gmail.com] *On Behalf Of *Scott
> Godin
> *Sent:* segunda-feira, 16 de maio de 2016 15:18
> *To:* Diego Carvalho Domingos <ddomingos at daitangroup.com>
> *Cc:* resiprocate-devel at resiprocate.org
> *Subject:* Re: [reSIProcate] multipart/alternative content-type
>
>
>
> There is a great helper method for this.  Check out resip/Helper.hxx/cxx
> and the getSdp method.  If it doesn't do exactly what you want, it's a
> great starting ground for whatever you need.
>
>
>
> Scott
>
>
>
> On Thu, May 12, 2016 at 2:11 PM, Diego Carvalho Domingos <
> ddomingos at daitangroup.com> wrote:
>
> Hi all,
>
> How do I access multiple SDP’s of an INVITE which the content-type is
> multipart/alternative? In my case the INVITE contains two SDP’s and for
> some reason, the way I get the SDP is getting the second one. For instance,
> in the onNewSession method:
> onNewSession(ClientInviteSessionHandle, InviteSession::OfferAnswerType
> oat, const SipMessage& msg)
> I do:
> SdpContents* contents = dynamic_cast<SdpContents*>(msg.getContents());
>
> Why this is getting me the second one? How do I access the first one? I
> saw that there is a subclass of Contents called
> MultipartAlternativeContents but I don’t think this is the one returned by
> getContents because if so the dynamic_cast would fail.
>
> I appreciate any help. Thanks in advance.
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
>
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20160721/b88c1e52/attachment.htm>


More information about the resiprocate-devel mailing list