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

Freeswitch SVN anthm at freeswitch.org
Tue Aug 21 15:00:06 EDT 2007


Author: anthm
Date: Tue Aug 21 15:00:06 2007
New Revision: 5653

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

Log:
let session.sayPhrase method take a blank language string

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 Aug 21 15:00:06 2007
@@ -1242,6 +1242,7 @@
 	char *phrase_name = NULL;
 	char *phrase_data = NULL;
 	char *phrase_lang = NULL;
+	char *tmp = NULL;
 	//char *input_callback = NULL;
 	void *bp = NULL;
 	int len = 0;
@@ -1268,11 +1269,20 @@
 
 
 	if (argc > 1) {
-		phrase_data = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		if (!switch_strlen_zero(tmp)) {
+			phrase_data = tmp;
+		} else {
+			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+			return JS_TRUE;
+		}
 	}
 
 	if (argc > 2) {
-		phrase_lang = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+		tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+		if (!switch_strlen_zero(tmp)) {
+			phrase_lang = tmp;
+		}
 	}
 
 	if (argc > 3) {



More information about the Freeswitch-svn mailing list