Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
Function that raises events when talking is detected on a channel. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/audiohook.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
Go to the source code of this file.
Data Structures | |
struct | talk_detect_params |
Private data structure used with the function's datastore. More... | |
Macros | |
#define | DEFAULT_SILENCE_THRESHOLD 2500 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | datastore_destroy_cb (void *data) |
static int | load_module (void) |
static int | remove_talk_detect (struct ast_channel *chan) |
static int | set_talk_detect (struct ast_channel *chan, int dsp_silence_threshold, int dsp_talking_threshold) |
static int | talk_detect_audiohook_cb (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction) |
static int | talk_detect_fn_write (struct ast_channel *chan, const char *function, char *data, const char *value) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Talk detection dialplan function" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const struct ast_datastore_info | talk_detect_datastore |
The channel datastore the function uses to store state. More... | |
static struct ast_custom_function | talk_detect_function |
Definition of the TALK_DETECT function. More... | |
Function that raises events when talking is detected on a channel.
Definition in file func_talkdetect.c.
#define DEFAULT_SILENCE_THRESHOLD 2500 |
Definition at line 136 of file func_talkdetect.c.
|
static |
Definition at line 424 of file func_talkdetect.c.
|
static |
Definition at line 424 of file func_talkdetect.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 424 of file func_talkdetect.c.
|
static |
Definition at line 155 of file func_talkdetect.c.
References ast_audiohook_destroy(), ast_dsp_free(), ast_free, talk_detect_params::audiohook, and talk_detect_params::dsp.
|
static |
Definition at line 415 of file func_talkdetect.c.
References ast_custom_function_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and talk_detect_function.
|
static |
Definition at line 250 of file func_talkdetect.c.
References ast_audiohook_remove(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_name(), ast_datastore_free(), ast_log, AST_LOG_WARNING, talk_detect_params::audiohook, ast_datastore::data, NULL, SCOPED_CHANNELLOCK, and talk_detect_datastore.
Referenced by talk_detect_fn_write().
|
static |
Definition at line 281 of file func_talkdetect.c.
References ast_audiohook_attach(), ast_audiohook_init(), AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_AUDIOHOOK_TRIGGER_READ, AST_AUDIOHOOK_TYPE_MANIPULATE, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_rawreadformat(), ast_datastore_alloc, ast_datastore_free(), ast_dsp_new_with_rate(), ast_dsp_set_threshold(), ast_format_get_sample_rate(), ast_free, ast_set_flag, talk_detect_params::audiohook, ast_datastore::data, talk_detect_params::dsp, talk_detect_params::dsp_silence_threshold, talk_detect_params::dsp_talking_threshold, ast_audiohook::manipulate_callback, NULL, SCOPED_CHANNELLOCK, talk_detect_audiohook_cb(), and talk_detect_datastore.
Referenced by talk_detect_fn_write().
|
static |
Definition at line 180 of file func_talkdetect.c.
References ao2_ref, AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_STATUS_DONE, ast_channel_blob_create_from_cache(), ast_channel_datastore_find(), ast_channel_name(), ast_channel_talking_start(), ast_channel_talking_stop(), ast_channel_topic(), ast_channel_uniqueid(), ast_dsp_silence(), AST_FRAME_VOICE, ast_json_pack(), ast_json_unref(), ast_tvdiff_ms(), ast_tvnow(), ast_verb, ast_datastore::data, talk_detect_params::dsp, talk_detect_params::dsp_silence_threshold, ast_frame::frametype, NULL, stasis_publish(), ast_audiohook::status, talk_detect_datastore, talk_detect_params::talking, and talk_detect_params::talking_start.
Referenced by set_talk_detect().
|
static |
Definition at line 331 of file func_talkdetect.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_dsp_get_threshold_from_settings(), ast_log, AST_LOG_WARNING, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), DEFAULT_SILENCE_THRESHOLD, talk_detect_params::dsp_silence_threshold, talk_detect_params::dsp_talking_threshold, remove_talk_detect(), set_talk_detect(), THRESHOLD_SILENCE, and value.
|
static |
Definition at line 405 of file func_talkdetect.c.
References ast_custom_function_unregister(), and talk_detect_function.
|
static |
Definition at line 424 of file func_talkdetect.c.
|
static |
Definition at line 424 of file func_talkdetect.c.
|
static |
The channel datastore the function uses to store state.
Definition at line 167 of file func_talkdetect.c.
Referenced by remove_talk_detect(), set_talk_detect(), and talk_detect_audiohook_cb().
|
static |
Definition of the TALK_DETECT function.
Definition at line 399 of file func_talkdetect.c.
Referenced by load_module(), and unload_module().