RE: [reSIProcate] SipMessage and RTP
Oops I misunderstood - I thought you wanted to store the SDP Contents from
the invite - not create an SDP response.
By the way - you shouldn't modify the To/From fields like you are doing
response->header(h_To) = msg->header(h_From);
response->header(h_From) = msg->header(h_To);
The To and From in a response is always supposed to be the same as the
request. The message returned from makeResponse should be right already.
Scott
-----Original Message-----
From: Dan Weber [mailto:dan@xxxxxxxxxxxxxx]
Sent: Monday, January 17, 2005 11:14 AM
To: Scott Godin
Subject: RE: [reSIProcate] SipMessage and RTP
I figured it out but did it slightly differently.
void SipHandler::handleInvite(SipMessage* msg) {
assert(isInvite(msg));
NameAddr addr(mLocalUri);
NameAddrs contact;
// sendResponse(msg,200);
SipMessage* response = resip::Helper::makeResponse(*msg, 200);
SdpContents* contents = createSdpContents();
response->setContents(contents);
contact.push_front(addr);
response->header(h_Contacts) = contact;
response->header(h_To) = msg->header(h_From);
response->header(h_From) = msg->header(h_To);
send(*response);
delete response;
delete contents;
}
SdpContents* SipHandler::createSdpContents () {
SdpContents* sdp = new SdpContents();
sdp->session() = createSdpContentsSession();
return sdp;
}
SdpContents::Session SipHandler::createSdpContentsSession () {
SdpContents::Session session;
Data ip(mLocalUri.host());
resip::SdpContents::Session::Origin origin = session.origin();
origin.setAddress(ip);
origin.user() = "obr3";
resip::SdpContents::Session::Connection
con((resip::SdpContents::AddrType)1,ip);
session.addMedium(createMedium());
session.name() = "mysession";
session.connection() = con;
session.origin() = origin;
return session;
}
SdpContents::Session::Medium SipHandler::createMedium () {
Data name("audio");
Data protocol("RTP/AVP");
SdpContents::Session::Medium med(name,5004,0,protocol);
med.addCodec(resip::SdpContents::Session::Codec::ULaw_8000);
med.addCodec(resip::SdpContents::Session::Codec::ALaw_8000);
med.addCodec(resip::SdpContents::Session::Codec::G729_8000);
med.addCodec(resip::SdpContents::Session::Codec::TelephoneEvent);
return med;
}
On Mon, 2005-01-17 at 09:23 -0500, Scott Godin wrote:
> Here is an example:
>
> SdpContents sdp;
> if(pMsg->exists(h_ContentType) && pMsg->getContents()->getType() ==
> Mime("application", "sdp"))
> {
> sdp = *(dynamic_cast<SdpContents*>(pMsg->getContents()));
> }
>
> Scott
>
> -----Original Message-----
> From: Dan Weber [mailto:dan@xxxxxxxxxxxxxx]
> Sent: Sunday, January 16, 2005 12:15 AM
> To: resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [reSIProcate] SipMessage and RTP
>
> using the helper makeResponse, I've created a response to the siprequest
> I have received after processing. Now what I'd like to do is store the
> rtp information in the packet. What is the best way to do this?
>
> Dan
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel