Skip to content
Snippets Groups Projects
Commit cac91e03 authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez
Browse files

sipcall: stop rtp when call is closed

Refs #63196

Change-Id: Id21496098bd2f446500efa3d7cb8bc3d72a10dcc
parent 4ef5e293
Branches
Tags
No related merge requests found
......@@ -148,21 +148,6 @@ SIPCall::~SIPCall()
}
}
void
SIPCall::stopRtpIfCurrent()
{
if (Manager::instance().isCurrentCall(*this)) {
#if USE_CCRTP
audiortp_.stop();
#else
avformatrtp_->stop();
#endif
#ifdef RING_VIDEO
videortp_.stop();
#endif
}
}
SIPAccountBase&
SIPCall::getSIPAccount() const
{
......@@ -337,6 +322,9 @@ void SIPCall::answer()
void
SIPCall::hangup(int reason)
{
// Stop all RTP streams
stopAllMedias();
if (not inv or not inv->dlg)
throw VoipLinkException("No invite session for this call");
......@@ -372,6 +360,7 @@ SIPCall::hangup(int reason)
sip_utils::addContactHeader(&contactStr, tdata);
if (pjsip_inv_send_msg(inv.get(), tdata) != PJ_SUCCESS) {
RING_ERR("Error sending hangup message");
inv.reset();
return;
}
......@@ -379,9 +368,6 @@ SIPCall::hangup(int reason)
// Make sure user data is NULL in callbacks
inv->mod_data[getSIPVoIPLink()->getModId()] = NULL;
// Stop all RTP streams
stopRtpIfCurrent();
removeCall();
}
......@@ -706,6 +692,9 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc)
void
SIPCall::peerHungup()
{
// Stop all RTP streams
stopAllMedias();
if (not inv)
throw VoipLinkException("No invite session for this call");
......@@ -722,9 +711,6 @@ SIPCall::peerHungup()
inv.reset();
sip_utils::sip_strerror(ret);
}
// Stop all RTP streams
stopRtpIfCurrent();
}
void
......@@ -967,3 +953,17 @@ SIPCall::startAllMedia()
RING_ERR("%s", rtpException.what());
}
}
void
SIPCall::stopAllMedias()
{
RING_DBG("SIPCall %s: stopping all medias", getCallId().c_str());
#if USE_CCRTP
audiortp_.stop();
#else
avformatrtp_->stop();
#endif
#ifdef RING_VIDEO
videortp_.stop();
#endif
}
......@@ -198,7 +198,7 @@ class SIPCall : public Call
std::map<std::string, std::string>
createHistoryEntry() const;
void stopRtpIfCurrent();
void stopAllMedias();
/**
* Transfer method used for both type of transfer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment