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

Freeswitch SVN anthm at freeswitch.org
Tue Jul 29 12:57:39 EDT 2008


Author: anthm
Date: Tue Jul 29 12:57:38 2008
New Revision: 9201

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

Log:
fix jira issue MODLANG-74

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	Tue Jul 29 12:57:38 2008
@@ -1095,10 +1095,10 @@
 	uintN argc = 0;
 	jsval argv[4];
 	JSObject *Event = NULL;
-	jsval nval, *rval = &nval;
+	jsval ret, nval, *rval = &nval;
 	JSContext *cx = cb_state->cx;
 	JSObject *obj = cb_state->obj;
-
+	
 	METHOD_SANITY_CHECK();
 
 	jss->stack_depth++;
@@ -1148,7 +1148,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (check_hangup_hook(jss, NULL) == JS_TRUE) {
+	JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
+	check_hangup_hook(jss, &ret);
+	cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
+
+	if (ret == JS_TRUE) {
 		JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
 		JS_CallFunction(cb_state->cx, cb_state->obj, cb_state->function, argc, argv, &cb_state->ret);
 		cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
@@ -1422,13 +1426,10 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-
-	}
+	
 	switch_ivr_record_file(jss->session, &fh, file_name, &args, limit);
-	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	return ret;
@@ -1480,14 +1481,9 @@
 	args.buf = bp;
 	args.buflen = len;
 
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-
-	}
-
 	switch_ivr_collect_digits_callback(jss->session, &args, to);
-	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	return ret;
@@ -1560,12 +1556,10 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-	}
+
 	switch_ivr_phrase_macro(jss->session, phrase_name, phrase_data, phrase_lang, &args);
-	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	return ret;
@@ -1704,13 +1698,9 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-	}
 	switch_ivr_play_file(jss->session, &fh, file_name, &args);
-	check_hangup_hook(jss, &ret);
-
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
@@ -1770,12 +1760,9 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-	}
 	switch_ivr_sleep(jss->session, ms, &args);
-	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	return ret;
@@ -1961,12 +1948,9 @@
 	args.buflen = len;
 
 	switch_core_speech_flush_tts(&jss->speech->sh);
-	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-		return JS_FALSE;
-	}
 	switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
-	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
+	check_hangup_hook(jss, &ret);
 	*rval = cb_state.ret;
 
 	return ret;
@@ -2234,8 +2218,8 @@
 				
 				saveDepth = JS_SuspendRequest(cx);
 				switch_core_session_exec(jss->session, application_interface, app_arg);
-				check_hangup_hook(jss, &ret);
 				JS_ResumeRequest(cx, saveDepth);
+				check_hangup_hook(jss, &ret);
 				retval = JS_TRUE;
 			}
 		}



More information about the Freeswitch-svn mailing list