[Asterisk-code-review] res pjsip session: Release media resources on session end qu... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Sat Aug 5 06:44:22 CDT 2017


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/6166


Change subject: res_pjsip_session: Release media resources on session end quicker.
......................................................................

res_pjsip_session: Release media resources on session end quicker.

A change was made long ago where the session was kept around
until the underlying INVITE session had been destroyed. This
had the side effect of also keeping the underlying media resources
around for this time as well.

This change ensures that when we know the session is ending we
release the media resources immediately.

ASTERISK-27110

Change-Id: I643e431d5c3bf05cda220c1d39e824a505a29b82
---
M res/res_pjsip_session.c
1 file changed, 17 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/66/6166/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index bb349a4..103b526 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -3134,6 +3134,23 @@
 			iter->session_end(session);
 		}
 	}
+
+	if (session->channel) {
+		ast_channel_lock(session->channel);
+	}
+
+	/* To simplify things we guarantee that the media states will exist,
+	 * but remain empty, until the session itself is destroyed. This ensures
+	 * that if the channel is going to read data it can return a null frame
+	 * gracefully.
+	 */
+	SWAP(session->active_media_state, session->pending_media_state);
+	ast_sip_session_media_state_reset(session->pending_media_state);
+
+	if (session->channel) {
+		ast_channel_unlock(session->channel);
+	}
+
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/6166
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I643e431d5c3bf05cda220c1d39e824a505a29b82
Gerrit-Change-Number: 6166
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170805/1280aaee/attachment.html>


More information about the asterisk-code-review mailing list