MT#61574 DSM: re-use previous SDP if new given empty

Re-use previously offered SDP body, when processing
a call session with an involvement of DSM, and getting
newer SIP invite having no SDP offer.

This affects applications using the B2B `connectCollee()`
functionality and doesn't actually touch the B2B core itself.
(Which would be wrong if changed in a usual core SDP
processing, whereas original request can be empty and
an offer/answer is postponed to 200OK/ACK exchange)

(Re)invites towards DSM applications technically must
not be empty, because DSMs don't support late offering.
In order to overcome that just pretend that empty
re-INVITEs are using previous body version.

Change-Id: I252eb9f32e7dc073454a2258b176f77bf15d35c9
mr13.1
Donat Zenichev 2 years ago
parent 63b3f4db79
commit f97ff25ae5

@ -98,11 +98,19 @@ void DSMCall::onStart()
void DSMCall::onInvite(const AmSipRequest& req) {
// make B2B dialogs work in onInvite as well
/* save SDP body to re-use if newer request has no SDP */
AmMimeBody previous_body(invite_req.body);
invite_req = req;
if (invite_req.body.empty() && !previous_body.empty()) {
invite_req.body = previous_body;
DBG("Currently processed INVITE has no SDP body, use the one from previous offer.\n");
}
if (!process_invite) {
// re-INVITEs
AmB2BCallerSession::onInvite(req);
AmB2BCallerSession::onInviteKeepSDP(req);
return;
}
process_invite = false;
@ -126,7 +134,7 @@ void DSMCall::onInvite(const AmSipRequest& req) {
}
if (run_session_invite)
AmB2BCallerSession::onInvite(req);
AmB2BCallerSession::onInviteKeepSDP(req);
}
void DSMCall::onInvite2xx(const AmSipReply& reply) {

@ -1419,6 +1419,22 @@ void AmB2BCallerSession::onInvite(const AmSipRequest& req)
AmB2BSession::onInvite(req);
}
void AmB2BCallerSession::onInviteKeepSDP(const AmSipRequest& req)
{
/* save SDP body to re-use if newer request has no SDP */
AmMimeBody previous_body(invite_req.body);
invite_req = req;
if (invite_req.body.empty() && !previous_body.empty()) {
invite_req.body = previous_body;
DBG("Currently processed INVITE has no SDP body, use the one from previous offer.\n");
}
est_invite_cseq = req.cseq;
AmB2BSession::onInvite(req);
}
void AmB2BCallerSession::onInvite2xx(const AmSipReply& reply)
{
invite_req.cseq = reply.cseq;

@ -434,6 +434,7 @@ class AmB2BCallerSession: public AmB2BSession
// @see AmSession
void onInvite(const AmSipRequest& req);
void onInviteKeepSDP(const AmSipRequest& req); /* keeps previous SDP if given INVITE has empty SDP */
void onInvite2xx(const AmSipReply& reply);
void onCancel(const AmSipRequest& req);
void onBye(const AmSipRequest& req);

Loading…
Cancel
Save