[Freeswitch-svn] [commit] r8137 - freeswitch/trunk/src/mod/languages/mod_spidermonkey

Freeswitch SVN anthm at freeswitch.org
Mon Apr 21 15:26:32 EDT 2008


Author: anthm
Date: Mon Apr 21 15:26:32 2008
New Revision: 8137

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

Log:
fix MODLANG-56

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Mon Apr 21 15:26:32 2008
@@ -2721,7 +2721,7 @@
 
 		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
 			struct js_session *old_jss = NULL;
-			if ((old_jss = JS_GetPrivate(cx, session_obj)) && old_jss->session) {
+			if (session_obj && (old_jss = JS_GetPrivate(cx, session_obj)) && old_jss->session) {
 				session = old_jss->session;
 				orig_caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
 				dialplan = orig_caller_profile->dialplan;
@@ -2774,9 +2774,10 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
 			goto done;
 		}
-
+		
 		jss->session = peer_session;
 		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+		switch_channel_set_state(switch_core_session_get_channel(jss->session), CS_TRANSMIT);
 
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing Args\n");
@@ -2803,8 +2804,8 @@
 				
 				switch_channel_set_private(channel, "jss", NULL);
 				switch_core_event_hook_remove_state_change(session, hanguphook);
-
-				if (switch_test_flag(jss, S_HUP)) {
+				
+				if (switch_test_flag(jss, S_HUP) || switch_channel_get_state(channel) != CS_EXECUTE) {
 					switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 				}
 



More information about the Freeswitch-svn mailing list