[asterisk-commits] file: branch group/pimp_my_sip r379931 - in /team/group/pimp_my_sip: channels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 14:35:31 CST 2013


Author: file
Date: Tue Jan 22 14:35:27 2013
New Revision: 379931

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379931
Log:
Fix session reference count in chan_gulp, and call session_end when the session is ended, not when it is destroyed.

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379931&r1=379930&r2=379931
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Tue Jan 22 14:35:27 2013
@@ -156,6 +156,8 @@
 	}
 
 	ast_channel_tech_set(chan, &gulp_tech);
+
+	ao2_ref(session, +1);
 	ast_channel_tech_pvt_set(chan, session);
 
 	ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->codecs);
@@ -181,7 +183,7 @@
 	ast_channel_exten_set(chan, S_OR(exten, "s"));
 	ast_channel_priority_set(chan, 1);
 
-       return chan;
+	return chan;
 }
 
 /*! \brief Function called by core when we should answer a Gulp session */
@@ -467,6 +469,8 @@
 	session->channel = NULL;
 	ast_channel_tech_pvt_set(ast, NULL);
 
+	ao2_cleanup(session);
+
 	return (status == PJ_SUCCESS) ? 0 : -1;
 }
 

Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379931&r1=379930&r2=379931
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Tue Jan 22 14:35:27 2013
@@ -414,9 +414,6 @@
 
 	ast_debug(3, "Destroying SIP session\n");
 	while ((supplement = AST_LIST_REMOVE_HEAD(&session->supplements, next))) {
-		if (supplement->session_end) {
-			supplement->session_end(session);
-		}
 		ast_free(supplement);
 	}
 	ast_sip_destroy_work(session->work);
@@ -866,7 +863,16 @@
 	}
 
 	if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
+		struct ast_sip_session_supplement *iter;
+
 		/* Session is dead. Let's get rid of the reference to the session */
+		AST_LIST_TRAVERSE(&session->supplements, iter, next) {
+			if (iter->session_end) {
+				iter->session_end(session);
+			}
+		}
+
+		inv->mod_data[session_module.id] = NULL;
 		ao2_cleanup(session);
 	}
 }




More information about the asterisk-commits mailing list