[svn-commits] mmichelson: branch group/pimp_my_sip r379918 - /team/group/pimp_my_sip/res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jan 22 14:04:10 CST 2013


Author: mmichelson
Date: Tue Jan 22 14:04:06 2013
New Revision: 379918

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379918
Log:
Destroy the SIP session when the inv_state is DISCONNECTED.

Now the session is actually getting destroyed on an incoming call.


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

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=379918&r1=379917&r2=379918
==============================================================================
--- 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:04:06 2013
@@ -411,8 +411,12 @@
 {
 	struct ast_sip_session *session = obj;
 	struct ast_sip_session_supplement *supplement;
+
+	ast_debug(3, "Destroying SIP session\n");
 	while ((supplement = AST_LIST_REMOVE_HEAD(&session->supplements, next))) {
-		supplement->session_end(session);
+		if (supplement->session_end) {
+			supplement->session_end(session);
+		}
 		ast_free(supplement);
 	}
 	ast_sip_destroy_work(session->work);
@@ -860,6 +864,11 @@
 	default:
 		break;
 	}
+
+	if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
+		/* Session is dead. Let's get rid of the reference to the session */
+		ao2_cleanup(session);
+	}
 }
 
 static void session_inv_on_new_session(pjsip_inv_session *inv, pjsip_event *e)




More information about the svn-commits mailing list