static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
switch_memory_pool *pool = NULL;
- int need_pool = 1;
if (argc > 2) {
struct js_session *jss = NULL;
JSObject *session_obj;
struct js_session *old_jss = NULL;
if ((old_jss = JS_GetPrivate(cx, session_obj))) {
session = old_jss->session;
- pool = switch_core_session_get_pool(session);
- need_pool = 0;
}
}
ani2 = JS_GetStringBytes(JS_ValueToString(cx, argv[8]));
}
- if (need_pool) {
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
- return JS_FALSE;
- }
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
+ return JS_FALSE;
}
caller_profile = switch_caller_profile_new(pool, dialplan, cid_name, cid_num, network_addr, ani, ani2, dest);