36 #include "asterisk/lock.h"
78 static char *
app =
"BackgroundDetect";
86 struct timeval start = { 0, 0 };
87 struct timeval detection_start = { 0, 0 };
91 int analysistime = -1;
92 int continue_analysis = 1;
125 ast_debug(1,
"Preparing detect of '%s', sil=%d, min=%d, max=%d, analysistime=%d\n",
args.filename, sil, min, max, analysistime);
164 }
else if (res > 0) {
166 if (continue_analysis && analysistime >= 0) {
170 continue_analysis = 0;
171 ast_verb(3,
"BackgroundDetect: Talk analysis time complete on %s.\n", chan->
name);
193 if (res && (totalsilence > sil)) {
201 if ((ms > min) && ((max < 0) || (ms < max))) {
203 ast_debug(1,
"Found qualified token of %d ms\n", ms);
206 snprintf(ms_str,
sizeof(ms_str),
"%d", ms);
214 ast_debug(1,
"Found unqualified token of %d ms\n", ms);
union ast_frame_subclass subclass
Main Channel structure associated with a channel.
char * str
Subscriber phone number (Malloced)
#define AST_MODULE_INFO_STANDARD(keystr, desc)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk main include file. File version handling, generic pbx functions.
struct ast_party_caller caller
Channel Caller ID information.
Support for translation of data formats. translate.c.
void ast_dsp_free(struct ast_dsp *dsp)
Convenient Signal Processing routines.
char context[AST_MAX_CONTEXT]
static int unload_module(void)
struct ast_dsp * ast_dsp_new(void)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_verb(level,...)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
struct ast_party_id id
Caller party ID.
int ast_set_read_format(struct ast_channel *chan, format_t format)
Sets read format on channel chan Set read format for channel to whichever component of "format" is be...
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
struct sched_context * sched
int(* timingfunc)(const void *data)
static int load_module(void)
Core PBX routines and definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
char * ast_getformatname(format_t format)
Get the name of a format.
static int background_detect_exec(struct ast_channel *chan, const char *data)
enum ast_channel_state _state
const ast_string_field name
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
int ast_sched_runq(struct sched_context *con)
Runs the queue.
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)
Return non-zero if this is silence. Updates "totalsilence" with the total number of seconds of silenc...
#define AST_FORMAT_SLINEAR
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place Determine the number of s...
int ast_answer(struct ast_channel *chan)
Answer a channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
Data structure associated with a single frame of data.
#define AST_APP_ARG(name)
Define an application argument.
enum ast_frame_type frametype
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
struct ast_filestream * stream
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
unsigned char valid
TRUE if the number information is valid/present.
const ast_string_field language
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
struct ast_party_number number
Subscriber phone number.