[Freeswitch-svn] [commit] r5623 - in freeswitch/trunk/src: . mod/languages/mod_spidermonkey
Freeswitch SVN
anthm at freeswitch.org
Mon Aug 20 12:04:02 EDT 2007
Author: anthm
Date: Mon Aug 20 12:04:02 2007
New Revision: 5623
Modified:
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
fix MODLANG-41
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 Aug 20 12:04:02 2007
@@ -2752,24 +2752,31 @@
struct input_callback_state cb_state = { 0 };
JSFunction *function;
+ *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
if (argc > 1) {
if (JS_ValueToObject(cx, argv[0], &session_obj_a)) {
if (!(jss_a = JS_GetPrivate(cx, session_obj_a))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Find Session [1]\n");
- return JS_FALSE;
+ eval_some_js("~throw new Error(\"Cannot find session A\");", cx, obj, rval);
+ return JS_TRUE;
}
}
if (JS_ValueToObject(cx, argv[1], &session_obj_b)) {
if (!(jss_b = JS_GetPrivate(cx, session_obj_b))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Find Session [1]\n");
- return JS_FALSE;
+ eval_some_js("~throw new Error(\"Cannot find session B\");", cx, obj, rval);
+ return JS_TRUE;
}
}
}
- if (!(jss_a && jss_b)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure! %s %s\n", jss_a ? "y" : "n", jss_b ? "y" : "n");
- return JS_FALSE;
+ if (!(jss_a && jss_a->session)) {
+ eval_some_js("~throw new Error(\"session A is not ready!\");", cx, obj, rval);
+ return JS_TRUE;
+ }
+
+ if (!(jss_b && jss_b->session)) {
+ eval_some_js("~throw new Error(\"session B is not ready!\");", cx, obj, rval);
+ return JS_TRUE;
}
@@ -2796,6 +2803,7 @@
switch_ivr_multi_threaded_bridge(jss_a->session, jss_b->session, dtmf_func, bp, bp);
JS_ResumeRequest(cx, cb_state.saveDepth);
+ *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
return JS_TRUE;
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Mon Aug 20 12:04:02 2007
@@ -551,6 +551,9 @@
int stream_id = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
+ assert(session != NULL);
+ assert(peer_session != NULL);
+
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
More information about the Freeswitch-svn
mailing list