42#include <speex/speex_preprocess.h> 
   49#define DEFAULT_AGC_LEVEL 8000.0 
  126        speex_preprocess_state_destroy(si->
rx->
state);
 
  130        speex_preprocess_state_destroy(si->
tx->
state);
 
 
  166    si = datastore->
data;
 
  177            speex_preprocess_state_destroy(sdi->
state);
 
  184        speex_preprocess_ctl(sdi->
state, SPEEX_PREPROCESS_SET_AGC, &sdi->
agc);
 
  187            speex_preprocess_ctl(sdi->
state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &sdi->
agclevel);
 
  190        speex_preprocess_ctl(sdi->
state, SPEEX_PREPROCESS_SET_DENOISE, &sdi->
denoise);
 
  194    snprintf(source, 
sizeof(source), 
"%s/speex", frame->
src);
 
 
  216    if (strcasecmp(data, 
"rx") && strcasecmp(data, 
"tx")) {
 
  240        si = datastore->
data;
 
  243    if (!strcasecmp(data, 
"rx")) {
 
  259    if (!strcasecmp(cmd, 
"agc")) {
 
  260        if (!sscanf(
value, 
"%30f", &(*sdi)->agclevel))
 
  263        if ((*sdi)->agclevel > 32768.0) {
 
  264            ast_log(
LOG_WARNING, 
"AGC(%s)=%.01f is greater than 32768... setting to 32768 instead\n",
 
  265                    ((*sdi == si->
rx) ? 
"rx" : 
"tx"), (*sdi)->agclevel);
 
  266            (*sdi)->agclevel = 32768.0;
 
  269        (*sdi)->agc = !!((*sdi)->agclevel);
 
  272            speex_preprocess_ctl((*sdi)->state, SPEEX_PREPROCESS_SET_AGC, &(*sdi)->agc);
 
  274                speex_preprocess_ctl((*sdi)->state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &(*sdi)->agclevel);
 
  277    } 
else if (!strcasecmp(cmd, 
"denoise")) {
 
  281            speex_preprocess_ctl((*sdi)->state, SPEEX_PREPROCESS_SET_DENOISE, &(*sdi)->denoise);
 
  285    if (!(*sdi)->agc && !(*sdi)->denoise) {
 
  287            speex_preprocess_state_destroy((*sdi)->state);
 
  293    if (!si->
rx && !si->
tx) {
 
  308        datastore->
data = si;
 
 
  336    si = datastore->
data;
 
  338    if (!strcasecmp(data, 
"tx"))
 
  340    else if (!strcasecmp(data, 
"rx"))
 
  347    if (!strcasecmp(cmd, 
"agc"))
 
 
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_calloc(num, len)
A wrapper for calloc()
@ AST_AUDIOHOOK_MANIPULATE_ALL_RATES
int ast_audiohook_init(struct ast_audiohook *audiohook, enum ast_audiohook_type type, const char *source, enum ast_audiohook_init_flags flags)
Initialize an audiohook structure.
int ast_audiohook_remove(struct ast_channel *chan, struct ast_audiohook *audiohook)
Remove an audiohook from a specified channel.
@ AST_AUDIOHOOK_DIRECTION_READ
int ast_audiohook_detach(struct ast_audiohook *audiohook)
Detach audiohook from channel.
int ast_audiohook_attach(struct ast_channel *chan, struct ast_audiohook *audiohook)
Attach audiohook to channel.
int ast_audiohook_destroy(struct ast_audiohook *audiohook)
Destroys an audiohook structure.
@ AST_AUDIOHOOK_TYPE_MANIPULATE
@ AST_AUDIOHOOK_STATUS_DONE
General Asterisk PBX channel definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
#define ast_channel_lock(chan)
#define ast_channel_unlock(chan)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
static int speex_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static struct ast_custom_function agc_function
#define DEFAULT_AGC_LEVEL
static struct ast_custom_function denoise_function
static int speex_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static void destroy_callback(void *data)
static int load_module(void)
static int speex_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
static int unload_module(void)
static const struct ast_datastore_info speex_datastore
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Core PBX routines and definitions.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
ast_audiohook_manipulate_callback manipulate_callback
enum ast_audiohook_status status
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
union ast_frame::@239 data
SpeexPreprocessState * state
struct speex_direction_info * rx
struct ast_audiohook audiohook
struct speex_direction_info * tx