diff --git a/apps/sbc/SBCCallLeg.cpp b/apps/sbc/SBCCallLeg.cpp index 577966ad..7c91d58c 100644 --- a/apps/sbc/SBCCallLeg.cpp +++ b/apps/sbc/SBCCallLeg.cpp @@ -605,8 +605,12 @@ SBCCallLeg::~SBCCallLeg() void SBCCallLeg::onBeforeDestroy() { for (vector::iterator i = cc_ext.begin(); i != cc_ext.end(); ++i) { - (*i)->onDestroyLeg(this); + try { + (*i)->onDestroyLeg(this); + } + catch (...) { /* ignore errors */ } } + CallLeg::onBeforeDestroy(); } UACAuthCred* SBCCallLeg::getCredentials() { diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 30d248ed..f5000601 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -116,10 +116,15 @@ AmB2BSession::AmB2BSession(const string& other_local_tag, AmSipDialog* p_dlg, if(!subs) subs = new AmSipSubscription(dlg,this); } -AmB2BSession::~AmB2BSession() +void AmB2BSession::onBeforeDestroy() { + // cleanup before the instance is destroyed clearRtpReceiverRelay(); + AmSession::onBeforeDestroy(); +} +AmB2BSession::~AmB2BSession() +{ ILOG_DLG(L_DBG, "relayed_req.size() = %zu\n",relayed_req.size()); map::iterator it = recvd_req.begin(); diff --git a/core/AmB2BSession.h b/core/AmB2BSession.h index 5720f646..410166ee 100644 --- a/core/AmB2BSession.h +++ b/core/AmB2BSession.h @@ -342,6 +342,8 @@ private: virtual ~AmB2BSession(); + virtual void onBeforeDestroy(); + /** flag to enable RTP relay mode */ RTPRelayMode rtp_relay_mode; /** force symmetric RTP */