[Freeswitch-trunk] [commit] r12714 - freeswitch/trunk/src/mod/languages/mod_lua

FreeSWITCH SVN anthm at freeswitch.org
Sun Mar 22 11:35:55 PDT 2009


Author: anthm
Date: Sun Mar 22 13:35:55 2009
New Revision: 12714

Log:
tweak lua hangup hook (part 2)

Modified:
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	Sun Mar 22 13:35:55 2009
@@ -24,6 +24,10 @@
 Session::~Session()
 {
 
+	if (channel) {
+		switch_channel_set_private(channel, "CoreSession", NULL);
+	}
+
 	if (hangup_func_str) {
 		if (session) {
 			switch_core_event_hook_remove_state_change(session, lua_hanguphook);
@@ -141,6 +145,10 @@
 			coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession");
 		}
 		
+		if (!(coresession && coresession->hook_state)) {
+			return SWITCH_STATUS_FALSE;
+		}
+
 		if (coresession && coresession->allocated && (state == CS_HANGUP || state == CS_ROUTING) && coresession->hook_state != state) {
 			coresession->hook_state = state;
 			coresession->check_hangup_hook();



More information about the Freeswitch-trunk mailing list