Author: anthm Date: Sat Jun 9 19:07:00 2007 New Revision: 5303 Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Log: add adjustable buffering to mod_shout (see example in config file) Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp (original) +++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp Sat Jun 9 19:07:00 2007 @@ -9,6 +9,7 @@ switch_input_args_t args = { 0 }, *ap = NULL; struct input_callback_state cb_state = { 0 }; switch_file_handle_t fh = { 0 }; + char *prebuf; sanity_check(-1); cb_state.funcargs = funcargs; @@ -31,6 +32,13 @@ ap = &args; } + if ((prebuf = switch_channel_get_variable(this->channel, "stream_prebuffer"))) { + int maybe = atoi(prebuf); + if (maybe > 0) { + fh.prebuf = maybe; + } + } + this->begin_allow_threads(); cb_state.threadState = threadState; // pass threadState so the dtmfhandler can pick it up 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 Sat Jun 9 19:07:00 2007 @@ -1357,6 +1357,7 @@ switch_file_handle_t fh = { 0 }; JSFunction *function; switch_input_args_t args = { 0 }; + char *prebuf; if (!jss || !jss->session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n"); @@ -1404,6 +1405,14 @@ JS_ValueToInt32(cx, argv[3], &samps); fh.samples = samps; } + + if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) { + int maybe = atoi(prebuf); + if (maybe > 0) { + fh.prebuf = maybe; + } + } + cb_state.extra = &fh; cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);