Asterisk - The Open Source Telephony Project
18.5.0
|
Tone detection module. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/module.h"
#include "asterisk/frame.h"
#include "asterisk/format_cache.h"
#include "asterisk/channel.h"
#include "asterisk/dsp.h"
#include "asterisk/pbx.h"
#include "asterisk/audiohook.h"
#include "asterisk/app.h"
#include "asterisk/indications.h"
#include "asterisk/conversions.h"
Go to the source code of this file.
Data Structures | |
struct | detect_information |
Enumerations | |
enum | { OPT_ARG_DECIBEL, OPT_ARG_GOTO_RX, OPT_ARG_GOTO_TX, OPT_ARG_ARRAY_SIZE } |
enum | { OPT_APP_DECIBEL = (1 << 0), OPT_APP_SQUELCH = (1 << 1) } |
enum | { OPT_APP_ARG_DECIBEL, OPT_APP_ARG_ARRAY_SIZE } |
enum | td_opts { OPT_TX = (1 << 1), OPT_RX = (1 << 2), OPT_END_FILTER = (1 << 3), OPT_GOTO_RX = (1 << 4), OPT_GOTO_TX = (1 << 5), OPT_DECIBEL = (1 << 6), OPT_SQUELCH = (1 << 7) } |
Functions | |
AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "Tone detection module") | |
static void | destroy_callback (void *data) |
static int | detect_callback (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction) |
static int | detect_read (struct ast_channel *chan, const char *cmd, char *data, char *buffer, size_t buflen) |
static int | detect_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
static int | freq_parser (char *freqs, int *freq1, int *freq2) |
static char * | goto_parser (struct ast_channel *chan, char *loc) |
static int | load_module (void) |
static int | remove_detect (struct ast_channel *chan) |
static int | unload_module (void) |
static int | wait_exec (struct ast_channel *chan, const char *data) |
Variables | |
static const struct ast_datastore_info | detect_datastore |
static struct ast_custom_function | detect_function |
static const struct ast_app_option | td_opts [128] = { [ 'd' ] = { .flag = OPT_DECIBEL , .arg_index = OPT_ARG_DECIBEL + 1 }, [ 'g' ] = { .flag = OPT_GOTO_RX , .arg_index = OPT_ARG_GOTO_RX + 1 }, [ 'h' ] = { .flag = OPT_GOTO_TX , .arg_index = OPT_ARG_GOTO_TX + 1 }, [ 's' ] = { .flag = OPT_SQUELCH }, [ 't' ] = { .flag = OPT_TX }, [ 'r' ] = { .flag = OPT_RX }, [ 'x' ] = { .flag = OPT_END_FILTER }, } |
static const struct ast_app_option | wait_exec_options [128] = { [ 'd' ] = { .flag = OPT_APP_DECIBEL , .arg_index = OPT_APP_ARG_DECIBEL + 1 }, [ 's' ] = { .flag = OPT_APP_SQUELCH }, } |
static char * | waitapp = "WaitForTone" |
Tone detection module.
Definition in file app_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_DECIBEL | |
OPT_ARG_GOTO_RX | |
OPT_ARG_GOTO_TX | |
OPT_ARG_ARRAY_SIZE |
Definition at line 183 of file app_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_APP_DECIBEL | |
OPT_APP_SQUELCH |
Definition at line 508 of file app_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_APP_ARG_DECIBEL | |
OPT_APP_ARG_ARRAY_SIZE |
Definition at line 513 of file app_tonedetect.c.
enum td_opts |
Enumerator | |
---|---|
OPT_TX | |
OPT_RX | |
OPT_END_FILTER | |
OPT_GOTO_RX | |
OPT_GOTO_TX | |
OPT_DECIBEL | |
OPT_SQUELCH |
Definition at line 173 of file app_tonedetect.c.
AST_MODULE_INFO_STANDARD_EXTENDED | ( | ASTERISK_GPL_KEY | , |
"Tone detection module" | |||
) |
Referenced by load_module().
|
static |
Definition at line 201 of file app_tonedetect.c.
References ast_audiohook_destroy(), ast_audiohook_detach(), ast_audiohook_lock, ast_audiohook_unlock, ast_dsp_free(), ast_free, detect_information::audiohook, di, detect_information::dsp, detect_information::gotorx, and detect_information::gototx.
|
static |
Definition at line 224 of file app_tonedetect.c.
References ast_async_parseable_goto(), AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_STATUS_DONE, ast_channel_datastore_find(), ast_debug, ast_dsp_process(), AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frfree, ast_frisolate, ast_datastore::data, di, detect_information::dsp, ast_frame::frametype, detect_information::gotorx, detect_information::gototx, ast_frame_subclass::integer, NULL, result, detect_information::rx, detect_information::rxcount, ast_audiohook::status, ast_frame::subclass, detect_information::tx, and detect_information::txcount.
Referenced by detect_write().
|
static |
Definition at line 369 of file app_tonedetect.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_log, ast_datastore::data, di, LOG_WARNING, NULL, detect_information::rxcount, and detect_information::txcount.
|
static |
Definition at line 399 of file app_tonedetect.c.
References args, AST_APP_ARG, ast_app_parse_options(), ast_audiohook_attach(), ast_audiohook_init(), AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_AUDIOHOOK_TYPE_MANIPULATE, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), ast_debug, AST_DECLARE_APP_ARGS, ast_dsp_new(), ast_dsp_set_features(), ast_dsp_set_freqmode(), ast_log, AST_STANDARD_APP_ARGS, ast_str_to_int(), ast_strdupa, ast_strlen_zero, ast_test_flag, detect_information::audiohook, ast_datastore::data, detect_information::db, detect_callback(), di, detect_information::dsp, DSP_FEATURE_FREQ_DETECT, detect_information::duration, detect_information::freq1, detect_information::freq2, freq_parser(), ast_dsp::freqs, goto_parser(), detect_information::gotorx, detect_information::gototx, LOG_WARNING, ast_audiohook::manipulate_callback, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_DECIBEL, OPT_ARG_GOTO_RX, OPT_ARG_GOTO_TX, OPT_DECIBEL, OPT_END_FILTER, OPT_GOTO_RX, OPT_GOTO_TX, OPT_RX, OPT_SQUELCH, OPT_TX, options, parse(), remove_detect(), detect_information::rx, detect_information::rxcount, detect_information::squelch, detect_information::tx, and detect_information::txcount.
|
static |
Definition at line 299 of file app_tonedetect.c.
References ast_log, ast_str_to_int(), ast_strdupa, ast_strlen_zero, LOG_ERROR, LOG_WARNING, and strsep().
Referenced by detect_write(), and wait_exec().
|
static |
Definition at line 336 of file app_tonedetect.c.
References ast_channel_context(), ast_channel_exten(), ast_channel_lock, ast_channel_unlock, ast_malloc, ast_strdupa, ast_strlen_zero, context, exten, NULL, parse(), and strsep().
Referenced by detect_write().
|
static |
Definition at line 641 of file app_tonedetect.c.
References ast_custom_function_register, AST_MODULE_INFO_STANDARD_EXTENDED(), ast_register_application_xml, ASTERISK_GPL_KEY, and wait_exec().
|
static |
Definition at line 270 of file app_tonedetect.c.
References ast_audiohook_remove(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_name(), ast_datastore_free(), ast_log, AST_LOG_WARNING, detect_information::audiohook, ast_datastore::data, NULL, and SCOPED_CHANNELLOCK.
Referenced by detect_write().
|
static |
Definition at line 631 of file app_tonedetect.c.
References ast_custom_function_unregister(), and ast_unregister_application().
|
static |
Definition at line 524 of file app_tonedetect.c.
References args, AST_APP_ARG, ast_app_parse_options(), ast_channel_name(), ast_debug, AST_DECLARE_APP_ARGS, ast_dsp_free(), ast_dsp_new(), ast_dsp_process(), ast_dsp_set_features(), ast_dsp_set_freqmode(), AST_FRAME_DTMF, AST_FRAME_VOICE, ast_log, ast_read(), ast_remaining_ms(), AST_STANDARD_APP_ARGS, ast_str_to_int(), ast_strdupa, ast_strlen_zero, ast_test_flag, ast_tvnow(), ast_waitfor(), detect_information::db, detect_information::dsp, DSP_FEATURE_FREQ_DETECT, detect_information::duration, ast_frame::frametype, detect_information::freq1, detect_information::freq2, freq_parser(), ast_frame_subclass::integer, LOG_WARNING, NULL, OPT_APP_ARG_ARRAY_SIZE, OPT_APP_ARG_DECIBEL, OPT_APP_DECIBEL, OPT_APP_SQUELCH, options, pbx_builtin_setvar_helper(), result, detect_information::squelch, ast_frame::subclass, timeout, and wait_exec_options.
Referenced by load_module().
|
static |
Definition at line 219 of file app_tonedetect.c.
|
static |
Definition at line 625 of file app_tonedetect.c.
|
static |
Definition at line 199 of file app_tonedetect.c.
|
static |
Definition at line 522 of file app_tonedetect.c.
Referenced by wait_exec().
|
static |
Definition at line 623 of file app_tonedetect.c.