[asterisk-commits] res pjsip session: Release media resources on session end qu... (asterisk[15])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 1 16:30:16 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/6106 )

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: I3c6a82fe7d2c50b9dc9197cb12ef22f20d337501
---
M channels/chan_pjsip.c
M res/res_pjsip_session.c
2 files changed, 13 insertions(+), 3 deletions(-)



diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index ebda6c7..dd03b74 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -2273,7 +2273,6 @@
 static void clear_session_and_channel(struct ast_sip_session *session, struct ast_channel *ast)
 {
 	session->channel = NULL;
-	set_channel_on_rtp_instance(session, "");
 	ast_channel_tech_pvt_set(ast, NULL);
 }
 
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index bb349a4..40b197b 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1872,8 +1872,12 @@
 
 	ast_taskprocessor_unreference(session->serializer);
 	ao2_cleanup(session->datastores);
-	ast_sip_session_media_state_free(session->active_media_state);
-	ast_sip_session_media_state_free(session->pending_media_state);
+	if (session->active_media_state) {
+		ast_sip_session_media_state_free(session->active_media_state);
+	}
+	if (session->pending_media_state) {
+		ast_sip_session_media_state_free(session->pending_media_state);
+	}
 
 	AST_LIST_HEAD_DESTROY(&session->supplements);
 	while ((delay = AST_LIST_REMOVE_HEAD(&session->delayed_requests, next))) {
@@ -3134,6 +3138,13 @@
 			iter->session_end(session);
 		}
 	}
+
+	/* Release any media resources. */
+	ast_sip_session_media_state_free(session->active_media_state);
+	session->active_media_state = NULL;
+	ast_sip_session_media_state_free(session->pending_media_state);
+	session->pending_media_state = NULL;
+
 	return 0;
 }
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I3c6a82fe7d2c50b9dc9197cb12ef22f20d337501
Gerrit-Change-Number: 6106
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170801/82fcb7ce/attachment.html>


More information about the asterisk-commits mailing list