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