switch_time_t started;
unsigned int elapsed;
int32 timeout = 60;
+ jsrefcount saveDepth;
METHOD_SANITY_CHECK();
JS_ValueToInt32(cx, argv[0], &timeout);
}
+ saveDepth = JS_SuspendRequest(cx);
for (;;) {
if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
switch_yield(1000);
}
+ JS_ResumeRequest(cx, saveDepth);
return JS_TRUE;
}
switch_time_t started;
unsigned int elapsed;
int32 timeout = 60;
+ jsrefcount saveDepth;
METHOD_SANITY_CHECK();
JS_ValueToInt32(cx, argv[0], &timeout);
}
+ saveDepth = JS_SuspendRequest(cx);
for (;;) {
if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
switch_yield(1000);
}
+ JS_ResumeRequest(cx, saveDepth);
return JS_TRUE;
}
const char *username = NULL;
char *to = NULL;
char *tmp;
-
+ jsrefcount saveDepth;
+ switch_status_t status;
+
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
if (JS_ValueToObject(cx, argv[0], &session_obj)) {
caller_profile = switch_caller_profile_new(pool,username, dialplan, cid_name, cid_num, network_addr,
ani, aniii, rdnis, modname, context, dest);
- if (switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, SOF_NONE)
- != SWITCH_STATUS_SUCCESS) {
+ saveDepth = JS_SuspendRequest(cx);
+ status = switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, SOF_NONE);
+ JS_ResumeRequest(cx, saveDepth);
+
+ if (status != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
goto done;
}