From 7386b9f8f55e6b2648bcfb3f9dafaf62dccd772e Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Sun, 6 Feb 2011 01:26:55 -0500 Subject: [PATCH] Add session.ringReady() to check for CF_RING_READY --- src/mod/languages/mod_spidermonkey/mod_spidermonkey.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 1d6ee8d679..a818c1dcd1 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -2126,6 +2126,15 @@ static JSBool session_media_ready(JSContext * cx, JSObject * obj, uintN argc, js } +static JSBool session_ring_ready(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) +{ + struct js_session *jss = JS_GetPrivate(cx, obj); + + *rval = BOOLEAN_TO_JSVAL((jss && jss->session && switch_channel_test_flag(switch_core_session_get_channel(jss->session), CF_RING_READY)) ? JS_TRUE : JS_FALSE); + + return JS_TRUE; +} + static JSBool session_answered(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) { struct js_session *jss = JS_GetPrivate(cx, obj); @@ -2673,6 +2682,7 @@ static JSFunctionSpec session_methods[] = { {"ready", session_ready, 0}, {"answered", session_answered, 0}, {"mediaReady", session_media_ready, 0}, + {"ringReady", session_ring_ready, 0}, {"waitForAnswer", session_wait_for_answer, 0}, {"waitForMedia", session_wait_for_media, 0}, {"getEvent", session_get_event, 0},