FS-5216 don't allow recursive call to speek

This commit is contained in:
Anthony Minessale 2013-04-05 14:27:17 -05:00
parent 066319662d
commit 82bbb45d96
1 changed files with 8 additions and 0 deletions

View File

@ -1968,6 +1968,12 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval *
return JS_FALSE;
}
if (jss->speech && jss->speech->speaking) {
eval_some_js("~throw new Error(\"Recursive call not allowed\");", cx, obj, rval);
return JS_FALSE;
}
if (jss->speech && strcasecmp(jss->speech->sh.name, tts_name)) {
destroy_speech_engine(jss);
}
@ -2009,7 +2015,9 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval *
switch_core_speech_flush_tts(&jss->speech->sh);
if (switch_core_codec_ready(&jss->speech->codec)) {
jss->speech->speaking = 1;
switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
jss->speech->speaking = 0;
}
JS_ResumeRequest(cx, cb_state.saveDepth);
check_hangup_hook(jss, &ret);