MT#61912 AmB2BSession: move `established_body` to dlg level

Move it to the dlg level, because of complex visibility.
In other words, when working on the dialog level and e.g.
generating new SDP body using `dlg.oa`, there is no way
to save it.

Moving it to the dlg level, gives a control over it on
the whole amount of inheritance levels plus dlg.

Change-Id: Iebb13e3e58f2558dc060e23270d99d690fa54572
mr13.3.1
Donat Zenichev 11 months ago
parent 0a5449a47d
commit a28baa26f1

@ -1018,7 +1018,7 @@ int CallLeg::resumeHeldImpl()
updateLocalSdp(sdp);
updateLocalSdpOrigin(sdp);
AmMimeBody body(established_body);
AmMimeBody body(dlg->established_body);
sdp2body(sdp, body);
if (dlg->reinvite("", &body, SIP_FLAGS_VERBATIM) != 0) {
ERROR("re-INVITE failed\n");
@ -1500,16 +1500,16 @@ void CallLeg::addCallee(CallLeg *callee, const string &hdrs)
{
if (!non_hold_sdp.media.empty()) {
// use non-hold SDP if possible
AmMimeBody body(established_body);
AmMimeBody body(dlg->established_body);
sdp2body(non_hold_sdp, body);
addNewCallee(callee, new ConnectLegEvent(hdrs, body));
}
else addNewCallee(callee, new ConnectLegEvent(hdrs, established_body));
else addNewCallee(callee, new ConnectLegEvent(hdrs, dlg->established_body));
}
/*void CallLeg::addCallee(CallLeg *callee, const string &hdrs, AmB2BSession::RTPRelayMode mode)
{
addNewCallee(callee, new ConnectLegEvent(hdrs, established_body), mode);
addNewCallee(callee, new ConnectLegEvent(hdrs, dlg->established_body), mode);
}*/
void CallLeg::replaceExistingLeg(const string &session_tag, const AmSipRequest &relayed_invite)
@ -1554,7 +1554,7 @@ void CallLeg::replaceExistingLeg(const string &session_tag, const string &hdrs)
}
else b.media_session = NULL;
ReconnectLegEvent *rev = new ReconnectLegEvent(a_leg ? ReconnectLegEvent::B : ReconnectLegEvent::A, getLocalTag(), hdrs, established_body);
ReconnectLegEvent *rev = new ReconnectLegEvent(a_leg ? ReconnectLegEvent::B : ReconnectLegEvent::A, getLocalTag(), hdrs, dlg->established_body);
rev->setMedia(b.media_session, rtp_relay_mode);
ReplaceLegEvent *ev = new ReplaceLegEvent(getLocalTag(), rev);
// TODO: what about the RTP relay and other settings? send them as well?

@ -383,7 +383,7 @@ class CallLeg: public AmB2BSession
/** add given already existing session as our B leg */
void addCallee(const string &session_tag, const AmSipRequest &relayed_invite);
void addCallee(const string &session_tag, const string &hdrs)
{ addExistingCallee(session_tag, new ReconnectLegEvent(a_leg ? ReconnectLegEvent::B : ReconnectLegEvent::A, getLocalTag(), hdrs, established_body)); }
{ addExistingCallee(session_tag, new ReconnectLegEvent(a_leg ? ReconnectLegEvent::B : ReconnectLegEvent::A, getLocalTag(), hdrs, dlg->established_body)); }
/** add given call leg as our B leg (only stored SDP is used, we don't need
* to have INVITE request.
@ -391,7 +391,7 @@ class CallLeg: public AmB2BSession
* Additional headers may be specified - these are used in outgoing INVITE
* to the callee's destination. */
void addCallee(CallLeg *callee, const string &hdrs);
// void addCallee(CallLeg *callee, const string &hdrs, AmB2BSession::RTPRelayMode mode) { addNewCallee(callee, new ConnectLegEvent(hdrs, established_body), mode); }
// void addCallee(CallLeg *callee, const string &hdrs, AmB2BSession::RTPRelayMode mode) { addNewCallee(callee, new ConnectLegEvent(hdrs, dlg->established_body), mode); }
/** Replace given already existing session in a B2B call. We become new

@ -1824,7 +1824,7 @@ void SBCCallLeg::createHoldRequest(AmSdp &sdp)
// FIXME: fix SDP versioning! (remember generated versions and increase the
// version number in every SDP passing through?)
AmMimeBody *s = established_body.hasContentType(SIP_APPLICATION_SDP);
AmMimeBody *s = dlg->established_body.hasContentType(SIP_APPLICATION_SDP);
if (s) sdp.parse((const char*)s->getPayload());
if (sdp.media.empty()) {

@ -933,7 +933,7 @@ bool AmB2BSession::saveSessionDescription(const AmMimeBody& body) {
DBG("saving session description (%s, %.*s...)\n",
sdp_body->getCTStr().c_str(), 50, sdp_body->getPayload());
established_body = *sdp_body;
dlg->established_body = *sdp_body;
const char* cmp_body_begin = (const char*)sdp_body->getPayload();
size_t cmp_body_length = sdp_body->getLen();
@ -982,7 +982,7 @@ bool AmB2BSession::updateSessionDescription(const AmMimeBody& body) {
DBG("session description changed - saving (%s, %.*s...)\n",
sdp_body->getCTStr().c_str(), 50, sdp_body->getPayload());
body_hash = new_body_hash;
established_body = body;
dlg->established_body = body;
return true;
}
@ -990,7 +990,7 @@ bool AmB2BSession::updateSessionDescription(const AmMimeBody& body) {
}
int AmB2BSession::sendEstablishedReInvite(const std::string &hdrs) {
if (established_body.empty()) {
if (dlg->established_body.empty()) {
ERROR("trying to re-INVITE with saved description, but none saved\n");
return -1;
}
@ -998,7 +998,7 @@ int AmB2BSession::sendEstablishedReInvite(const std::string &hdrs) {
DBG("sending re-INVITE with saved session description\n");
try {
AmMimeBody body(established_body); // contains only SDP
AmMimeBody body(dlg->established_body); // contains only SDP
updateLocalBody(body);
return dlg->reinvite(hdrs, &body, SIP_FLAGS_VERBATIM);
} catch (const string& s) {

@ -191,8 +191,6 @@ private:
/** SUBSCRIBE/NOTIFY handling */
AmSipSubscription* subs;
/** body of established session */
AmMimeBody established_body;
/** hash of body (from o-line) */
uint32_t body_hash;
/** save current session description (SDP) */

@ -56,6 +56,12 @@ protected:
AmOfferAnswer oa;
bool offeranswer_enabled;
public:
/** body of established session */
AmMimeBody established_body;
protected:
// Reliable provisional reply support
Am100rel rel100;

Loading…
Cancel
Save