143 .stop_on_frame_timeout = 1,
150 .stop_on_frame_timeout = 0,
197 wait_for->
func(sildet, f, &dsptime);
202 ast_debug(1,
"Got %dms of %s < %dms required\n", dsptime, wait_for->
name, timereqd);
204 if (dsptime >= timereqd) {
205 ast_verb(3,
"Exiting with %dms of %s >= %dms required\n", dsptime, wait_for->
name, timereqd);
212 if (timeout && difftime(time(
NULL), waitstart) >= timeout) {
214 ast_debug(1,
"WAITSTATUS was set to TIMEOUT\n");
233 int iterations = 1, i;
248 if (sscanf(
args.timereqd,
"%30d", &timereqd) != 1 || timereqd < 0) {
249 ast_log(
LOG_ERROR,
"Argument '%srequired' must be an integer greater than or equal to zero.\n",
256 if (sscanf(
args.iterations,
"%30d", &iterations) != 1 || iterations < 1) {
257 ast_log(
LOG_ERROR,
"Argument 'iterations' must be an integer greater than 0.\n");
263 if (sscanf(
args.timeout,
"%30d", &timeout) != 1 || timeout < 0) {
264 ast_log(
LOG_ERROR,
"Argument 'timeout' must be an integer greater than or equal to zero.\n");
273 ast_verb(3,
"Waiting %d time(s) for %dms of %s with %ds timeout\n",
274 iterations, timereqd, wait_for->
name, timeout);
281 for (i = 0; i < iterations && res == 1; i++) {
282 res =
do_waiting(chan, timereqd, waitstart, timeout, wait_for);
289 return res > 0 ? 0 : res;
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
static int waitforsilence_exec(struct ast_channel *chan, const char *data)
static int unload_module(void)
void ast_dsp_free(struct ast_dsp *dsp)
Convenient Signal Processing routines.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static int waitfor_exec(struct ast_channel *chan, const char *data, const struct wait_type *wait_for)
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
ast_channel_state
ast_channel states
static const struct wait_type wait_for_noise
#define ast_opt_transmit_silence
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int stop_on_frame_timeout
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_verb(level,...)
static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, int timeout, const struct wait_type *wait_for)
#define ast_strlen_zero(foo)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
static char * app_silence
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_strdupa(s)
duplicate a string in memory from the stack
int(* func)(struct ast_dsp *, struct ast_frame *, int *)
Core PBX routines and definitions.
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
static void parse(struct mgcp_request *req)
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Wait For Silence/Noise")
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
Data structure associated with a single frame of data.
static const struct wait_type wait_for_silence
union ast_frame::@263 data
enum ast_frame_type frametype
static int load_module(void)
static int waitfornoise_exec(struct ast_channel *chan, const char *data)
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise)
Process the audio frame for noise.
#define AST_APP_ARG(name)
Define an application argument.