Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
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/stasis_channels.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_HITS_REQ , 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) , OPT_HITS_REQ = (1 << 8) , OPT_SIT = (1 << 9) , OPT_BUSY = (1 << 10) , OPT_DIALTONE = (1 << 11) , OPT_RINGING = (1 << 12) } |
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 | parse_signal_features (struct ast_flags *flags) |
static int | remove_detect (struct ast_channel *chan) |
static int | scan_exec (struct ast_channel *chan, const char *data) |
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 char * | scanapp = "ToneScan" |
static const struct ast_app_option | td_opts [128] = { [ 'a' ] = { .flag = OPT_SIT }, [ 'b' ] = { .flag = OPT_BUSY }, [ 'c' ] = { .flag = OPT_DIALTONE }, [ '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 }, [ 'n' ] = { .flag = OPT_HITS_REQ , .arg_index = OPT_ARG_HITS_REQ + 1 }, [ 'p' ] = { .flag = OPT_RINGING }, [ '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 res_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_DECIBEL | |
OPT_ARG_GOTO_RX | |
OPT_ARG_GOTO_TX | |
OPT_ARG_HITS_REQ | |
OPT_ARG_ARRAY_SIZE |
Definition at line 308 of file res_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_APP_DECIBEL | |
OPT_APP_SQUELCH |
Definition at line 746 of file res_tonedetect.c.
anonymous enum |
Enumerator | |
---|---|
OPT_APP_ARG_DECIBEL | |
OPT_APP_ARG_ARRAY_SIZE |
Definition at line 751 of file res_tonedetect.c.
enum td_opts |
Enumerator | |
---|---|
OPT_TX | |
OPT_RX | |
OPT_END_FILTER | |
OPT_GOTO_RX | |
OPT_GOTO_TX | |
OPT_DECIBEL | |
OPT_SQUELCH | |
OPT_HITS_REQ | |
OPT_SIT | |
OPT_BUSY | |
OPT_DIALTONE | |
OPT_RINGING |
Definition at line 293 of file res_tonedetect.c.
AST_MODULE_INFO_STANDARD_EXTENDED | ( | ASTERISK_GPL_KEY | , |
"Tone detection module" | |||
) |
|
static |
Definition at line 332 of file res_tonedetect.c.
References ast_audiohook_destroy(), ast_audiohook_detach(), ast_audiohook_lock, ast_audiohook_unlock, ast_dsp_free(), ast_free, and di.
|
static |
Definition at line 355 of file res_tonedetect.c.
References ao2_ref, ast_async_parseable_goto(), AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_STATUS_DONE, ast_channel_blob_create_from_cache(), ast_channel_datastore_find(), ast_channel_name(), ast_channel_tone_detect(), ast_channel_topic(), ast_channel_uniqueid(), ast_debug, ast_dsp_get_tcount(), ast_dsp_get_tstate(), ast_dsp_process(), AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frdup, ast_frfree, ast_log, ast_datastore::data, detect_datastore, di, DSP_FEATURE_WAITDIALTONE, DSP_PROGRESS_BUSY, DSP_PROGRESS_CONGESTION, DSP_PROGRESS_RINGING, DSP_TONE_STATE_BUSY, DSP_TONE_STATE_DIALTONE, DSP_TONE_STATE_RINGING, DSP_TONE_STATE_SPECIAL3, ast_frame::frametype, ast_frame_subclass::integer, LOG_ERROR, match(), NULL, result, stasis_publish(), ast_audiohook::status, and ast_frame::subclass.
Referenced by detect_write().
|
static |
Definition at line 575 of file res_tonedetect.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_log, ast_datastore::data, detect_datastore, di, LOG_WARNING, and NULL.
|
static |
Definition at line 625 of file res_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, ast_datastore::data, db, detect_callback(), detect_datastore, di, DSP_FEATURE_FREQ_DETECT, ast_flags::flags, freq_parser(), ast_dsp::freqs, goto_parser(), LOG_WARNING, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_DECIBEL, OPT_ARG_GOTO_RX, OPT_ARG_GOTO_TX, OPT_ARG_HITS_REQ, OPT_DECIBEL, OPT_END_FILTER, OPT_GOTO_RX, OPT_GOTO_TX, OPT_HITS_REQ, OPT_RX, OPT_SQUELCH, OPT_TX, options, parse_signal_features(), and remove_detect().
|
static |
Definition at line 501 of file res_tonedetect.c.
References ast_log, ast_str_to_int(), ast_strdupa, ast_strlen_zero(), detect_information::freq1, detect_information::freq2, LOG_ERROR, LOG_WARNING, and strsep().
Referenced by detect_write(), and wait_exec().
|
static |
Definition at line 538 of file res_tonedetect.c.
References ast_channel_context(), ast_channel_exten(), ast_channel_lock, ast_channel_unlock, ast_log, ast_malloc, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, LOG_ERROR, NULL, and strsep().
Referenced by detect_write().
|
static |
Definition at line 1061 of file res_tonedetect.c.
References ast_custom_function_register, ast_register_application_xml, detect_function, scan_exec(), scanapp, wait_exec(), and waitapp.
|
static |
Definition at line 605 of file res_tonedetect.c.
References ast_test_flag, DSP_FEATURE_WAITDIALTONE, DSP_PROGRESS_BUSY, DSP_PROGRESS_CONGESTION, DSP_PROGRESS_RINGING, OPT_BUSY, OPT_DIALTONE, OPT_RINGING, and OPT_SIT.
Referenced by detect_write().
|
static |
Definition at line 472 of file res_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, detect_datastore, NULL, and SCOPED_CHANNELLOCK.
Referenced by detect_write().
|
static |
Definition at line 866 of file res_tonedetect.c.
References args, AST_APP_ARG, ast_channel_name(), ast_debug, AST_DECLARE_APP_ARGS, ast_dsp_free(), ast_dsp_get_tcount(), ast_dsp_get_tstate(), ast_dsp_new(), ast_dsp_process(), ast_dsp_set_call_progress_zone(), ast_dsp_set_faxmode(), ast_dsp_set_features(), ast_dsp_set_freqmode(), AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frdup, ast_frfree, ast_log, ast_read(), ast_remaining_ms(), AST_STANDARD_APP_ARGS, ast_str_to_int(), ast_strdupa, ast_strlen_zero(), ast_tvnow(), ast_waitfor(), DSP_FAXMODE_DETECT_CED, DSP_FEATURE_FAX_DETECT, DSP_FEATURE_FREQ_DETECT, DSP_FEATURE_WAITDIALTONE, DSP_PROGRESS_BUSY, DSP_PROGRESS_CONGESTION, DSP_PROGRESS_RINGING, DSP_PROGRESS_TALK, DSP_TONE_STATE_BUSY, DSP_TONE_STATE_DIALTONE, DSP_TONE_STATE_HUNGUP, DSP_TONE_STATE_RINGING, DSP_TONE_STATE_SPECIAL3, DSP_TONE_STATE_TALKING, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, match(), NULL, options, pbx_builtin_setvar_helper(), result, and ast_frame::subclass.
Referenced by load_module().
|
static |
Definition at line 1050 of file res_tonedetect.c.
References ast_custom_function_unregister(), ast_unregister_application(), detect_function, scanapp, and waitapp.
|
static |
Definition at line 762 of file res_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_frfree, 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(), db, DSP_FEATURE_FREQ_DETECT, ast_flags::flags, ast_frame::frametype, 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, ast_frame::subclass, and wait_exec_options.
Referenced by load_module().
|
static |
Definition at line 350 of file res_tonedetect.c.
Referenced by detect_callback(), detect_read(), detect_write(), and remove_detect().
|
static |
Definition at line 1044 of file res_tonedetect.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 864 of file res_tonedetect.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 330 of file res_tonedetect.c.
|
static |
Definition at line 760 of file res_tonedetect.c.
Referenced by wait_exec().
|
static |
Definition at line 863 of file res_tonedetect.c.
Referenced by load_module(), and unload_module().