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

FreeSWITCH SVN anthm at freeswitch.org
Sun Mar 22 11:23:25 PDT 2009


Author: anthm
Date: Sun Mar 22 13:23:24 2009
New Revision: 12713

Log:
tweak lua hangup hook

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:23:24 2009
@@ -133,10 +133,18 @@
 	CoreSession *coresession = NULL;
 	switch_channel_state_t state = switch_channel_get_state(channel);
 
-	if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
-		if (coresession->hook_state != state) {
+	if (session_hungup) {
+
+		channel = switch_core_session_get_channel(session_hungup);
+
+		if (channel) {
+			coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession");
+		}
+		
+		if (coresession && coresession->allocated && (state == CS_HANGUP || state == CS_ROUTING) && coresession->hook_state != state) {
 			coresession->hook_state = state;
 			coresession->check_hangup_hook();
+			switch_core_event_hook_remove_state_change(session_hungup, lua_hanguphook);
 		}
 	}
 



More information about the Freeswitch-trunk mailing list