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() ...@@ -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& SIPAccountBase&
SIPCall::getSIPAccount() const SIPCall::getSIPAccount() const
{ {
...@@ -337,6 +322,9 @@ void SIPCall::answer() ...@@ -337,6 +322,9 @@ void SIPCall::answer()
void void
SIPCall::hangup(int reason) SIPCall::hangup(int reason)
{ {
// Stop all RTP streams
stopAllMedias();
if (not inv or not inv->dlg) if (not inv or not inv->dlg)
throw VoipLinkException("No invite session for this call"); throw VoipLinkException("No invite session for this call");
...@@ -372,6 +360,7 @@ SIPCall::hangup(int reason) ...@@ -372,6 +360,7 @@ SIPCall::hangup(int reason)
sip_utils::addContactHeader(&contactStr, tdata); sip_utils::addContactHeader(&contactStr, tdata);
if (pjsip_inv_send_msg(inv.get(), tdata) != PJ_SUCCESS) { if (pjsip_inv_send_msg(inv.get(), tdata) != PJ_SUCCESS) {
RING_ERR("Error sending hangup message");
inv.reset(); inv.reset();
return; return;
} }
...@@ -379,9 +368,6 @@ SIPCall::hangup(int reason) ...@@ -379,9 +368,6 @@ SIPCall::hangup(int reason)
// Make sure user data is NULL in callbacks // Make sure user data is NULL in callbacks
inv->mod_data[getSIPVoIPLink()->getModId()] = NULL; inv->mod_data[getSIPVoIPLink()->getModId()] = NULL;
// Stop all RTP streams
stopRtpIfCurrent();
removeCall(); removeCall();
} }
...@@ -706,6 +692,9 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc) ...@@ -706,6 +692,9 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc)
void void
SIPCall::peerHungup() SIPCall::peerHungup()
{ {
// Stop all RTP streams
stopAllMedias();
if (not inv) if (not inv)
throw VoipLinkException("No invite session for this call"); throw VoipLinkException("No invite session for this call");
...@@ -722,9 +711,6 @@ SIPCall::peerHungup() ...@@ -722,9 +711,6 @@ SIPCall::peerHungup()
inv.reset(); inv.reset();
sip_utils::sip_strerror(ret); sip_utils::sip_strerror(ret);
} }
// Stop all RTP streams
stopRtpIfCurrent();
} }
void void
...@@ -967,3 +953,17 @@ SIPCall::startAllMedia() ...@@ -967,3 +953,17 @@ SIPCall::startAllMedia()
RING_ERR("%s", rtpException.what()); 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 ...@@ -198,7 +198,7 @@ class SIPCall : public Call
std::map<std::string, std::string> std::map<std::string, std::string>
createHistoryEntry() const; createHistoryEntry() const;
void stopRtpIfCurrent(); void stopAllMedias();
/** /**
* Transfer method used for both type of transfer * 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