From b85bc42808b2fd930c196ad1d62ccddc901b3ea6 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 16 Feb 2023 17:34:33 +0100 Subject: [PATCH] MT#56321 AmB2BSession::onB2BEvent() - refresh caller if 183 media forced B2BSipReply We have to update the media session with the caller, if the 183 response with the 'P-Early-Announce: force' has been received. Change-Id: Ib39dc124ef5e8934ff617d562b222bd07dfcacc1 --- core/AmB2BSession.cpp | 27 ++++++++++++++++++++++++--- core/AmSipDialog.h | 6 ++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 3347e2ec..ff5fd63e 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -312,10 +312,31 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev) DBG("reply to establishing INVITE request - not refreshing\n"); } } - } - /* processing of the playback completion from DSM applications */ - if (reply_ev->reply.code == 480 && dlg->getStatus() == AmSipDialog::Connected) { + /* 183 - coming from DSM application */ + } else if (reply_ev->reply.code == 183 && + dlg->getForcedEarlyAnnounce() && + !reply_ev->reply.body.empty()) { + + if (updateSessionDescription(reply_ev->reply.body)) { + if (dlg->getUACInvTransPending()) { + DBG("changed session, but UAC INVITE trans pending\n"); + } else { + DBG("Received 183 with P-Early-Announce: force, refreshing media session.\n"); + + setMute(true); + AmMediaProcessor::instance()->removeSession(this); + + if (sendEstablishedReInvite() < 0) { + ERROR("could not re-Invite after locally initiated request" + "in B2B leg changed session (this='%s', other='%s')\n", + getLocalTag().c_str(), other_id.c_str()); + } + } + } + + /* 480 - processing of the playback completion from DSM applications */ + } else if (reply_ev->reply.code == 480 && dlg->getStatus() == AmSipDialog::Connected) { string p_dsm_app = getHeader(reply_ev->reply.hdrs, SIP_HDR_P_DSM_APP, true); diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index 36ec3eef..9efe3502 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -76,6 +76,12 @@ protected: bool onRxReqStatus(const AmSipRequest& req); bool onRxReplySanity(const AmSipReply& reply); + + /* this function updates the status of the dialog (AmBasicSipDialog) + * and sets this to: Trying, Proceeding, Cancelling, Early, Connected etc. + * Additionally it updates remote tags with setRemoteTag() + * and updates route set with setRouteSet() + */ bool onRxReplyStatus(const AmSipReply& reply);