Asterisk - The Open Source Telephony Project
21.4.1
|
Convenient Signal Processing routines. More...
Go to the source code of this file.
Data Structures | |
struct | ast_dsp_busy_pattern |
Macros | |
#define | DSP_DIGITMODE_DTMF 0 |
#define | DSP_DIGITMODE_MF 1 |
#define | DSP_DIGITMODE_MUTECONF (1 << 9) |
#define | DSP_DIGITMODE_MUTEMAX (1 << 10) |
#define | DSP_DIGITMODE_NOQUELCH (1 << 8) |
#define | DSP_DIGITMODE_RELAXDTMF (1 << 11) |
#define | DSP_FAXMODE_DETECT_ALL (DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_CED) |
#define | DSP_FAXMODE_DETECT_CED (1 << 1) |
#define | DSP_FAXMODE_DETECT_CNG (1 << 0) |
#define | DSP_FAXMODE_DETECT_SQUELCH (1 << 2) |
#define | DSP_FEATURE_BUSY_DETECT (1 << 1) |
#define | DSP_FEATURE_CALL_PROGRESS (DSP_PROGRESS_TALK | DSP_PROGRESS_RINGING | DSP_PROGRESS_BUSY | DSP_PROGRESS_CONGESTION) |
#define | DSP_FEATURE_DIGIT_DETECT (1 << 3) |
#define | DSP_FEATURE_FAX_DETECT (1 << 4) |
#define | DSP_FEATURE_FREQ_DETECT (1 << 21) |
#define | DSP_FEATURE_SILENCE_SUPPRESS (1 << 0) |
#define | DSP_FEATURE_WAITDIALTONE (1 << 20) |
#define | DSP_PROGRESS_BUSY (1 << 18) |
#define | DSP_PROGRESS_CONGESTION (1 << 19) |
#define | DSP_PROGRESS_RINGING (1 << 17) |
#define | DSP_PROGRESS_TALK (1 << 16) |
#define | DSP_TONE_STATE_BUSY 4 |
#define | DSP_TONE_STATE_DIALTONE 2 |
#define | DSP_TONE_STATE_HUNGUP 8 |
#define | DSP_TONE_STATE_RINGING 1 |
#define | DSP_TONE_STATE_SILENCE 0 |
#define | DSP_TONE_STATE_SPECIAL1 5 |
#define | DSP_TONE_STATE_SPECIAL2 6 |
#define | DSP_TONE_STATE_SPECIAL3 7 |
#define | DSP_TONE_STATE_TALKING 3 |
Enumerations | |
enum | threshold { THRESHOLD_SILENCE = 0, THRESHOLD_MAX = 1 } |
Functions | |
int | ast_dsp_busydetect (struct ast_dsp *dsp) |
Return non-zero if historically this should be a busy, request that ast_dsp_silence has already been called. | |
int | ast_dsp_call_progress (struct ast_dsp *dsp, struct ast_frame *inf) |
Scans for progress indication in audio. | |
int | ast_dsp_digitdetect (struct ast_dsp *dsp, struct ast_frame *f) |
Return non-zero if DTMF hit was found. | |
void | ast_dsp_digitreset (struct ast_dsp *dsp) |
Reset DTMF detector. | |
void | ast_dsp_free (struct ast_dsp *dsp) |
int | ast_dsp_get_features (struct ast_dsp *dsp) |
Get features. | |
unsigned int | ast_dsp_get_sample_rate (const struct ast_dsp *dsp) |
Retrieve the sample rate this DSP structure was created with. | |
int | ast_dsp_get_tcount (struct ast_dsp *dsp) |
Get tcount (Threshold counter) | |
int | ast_dsp_get_threshold_from_settings (enum threshold which) |
Get silence threshold from dsp.conf. More... | |
int | ast_dsp_get_tstate (struct ast_dsp *dsp) |
Get tstate (Tone State) | |
int | ast_dsp_getdigits (struct ast_dsp *dsp, char *buf, int max) |
Get pending DTMF/MF digits. | |
struct ast_dsp * | ast_dsp_new (void) |
Allocates a new dsp, assumes 8khz for internal sample rate. | |
struct ast_dsp * | ast_dsp_new_with_rate (unsigned int sample_rate) |
Allocates a new dsp with a specific internal sample rate used during processing. | |
int | ast_dsp_noise (struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise) |
Process the audio frame for noise. More... | |
struct ast_frame * | ast_dsp_process (struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf) |
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress, all dependent upon which features are enabled. | |
void | ast_dsp_reset (struct ast_dsp *dsp) |
Reset total silence count. | |
void | ast_dsp_set_busy_count (struct ast_dsp *dsp, int cadences) |
Set number of required cadences for busy. | |
void | ast_dsp_set_busy_pattern (struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence) |
Set expected lengths of the busy tone. | |
int | ast_dsp_set_call_progress_zone (struct ast_dsp *dsp, char *zone) |
Set zone for doing progress detection. | |
int | ast_dsp_set_digitmode (struct ast_dsp *dsp, int digitmode) |
Set digit mode. More... | |
int | ast_dsp_set_faxmode (struct ast_dsp *dsp, int faxmode) |
Set fax mode. | |
void | ast_dsp_set_features (struct ast_dsp *dsp, int features) |
Select feature set. | |
int | ast_dsp_set_freqmode (struct ast_dsp *dsp, int freq, int dur, int db, int squelch) |
Set arbitrary frequency detection mode. | |
void | ast_dsp_set_threshold (struct ast_dsp *dsp, int threshold) |
Set the minimum average magnitude threshold to determine talking by the DSP. | |
int | ast_dsp_silence (struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence) |
Process the audio frame for silence. More... | |
int | ast_dsp_silence_with_energy (struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy) |
Process the audio frame for silence. More... | |
int | ast_dsp_was_muted (struct ast_dsp *dsp) |
Returns true if DSP code was muting any fragment of the last processed frame. Muting (squelching) happens when DSP code removes DTMF/MF/generic tones from the audio. More... | |
Convenient Signal Processing routines.
Definition in file dsp.h.
#define DSP_DIGITMODE_DTMF 0 |
Detect DTMF digits
Definition at line 31 of file dsp.h.
Referenced by ast_dsp_process(), ast_dsp_set_digitmode(), dahdi_setoption(), mbl_load_device(), and mkintf().
#define DSP_DIGITMODE_MF 1 |
Detect MF digits
Definition at line 32 of file dsp.h.
Referenced by ast_dsp_digitreset(), ast_dsp_process(), ast_dsp_set_digitmode(), and read_mf_digits().
#define DSP_DIGITMODE_MUTECONF (1 << 9) |
Mute conference
Definition at line 35 of file dsp.h.
Referenced by ast_dsp_set_digitmode(), and dahdi_setoption().
#define DSP_DIGITMODE_MUTEMAX (1 << 10) |
Delay audio by a frame to try to extra quelch
Definition at line 36 of file dsp.h.
Referenced by ast_dsp_set_digitmode(), and dahdi_setoption().
#define DSP_DIGITMODE_NOQUELCH (1 << 8) |
Do not quelch DTMF from in-band
Definition at line 34 of file dsp.h.
Referenced by ast_dsp_process().
#define DSP_DIGITMODE_RELAXDTMF (1 << 11) |
"Radio" mode (relaxed DTMF)
Definition at line 37 of file dsp.h.
Referenced by ast_dsp_process(), dahdi_setoption(), and mbl_load_device().
#define DSP_FEATURE_FREQ_DETECT (1 << 21) |
Enable arbitrary tone detection
Definition at line 45 of file dsp.h.
Referenced by ast_dsp_process(), and read_sf_digits().
#define DSP_FEATURE_WAITDIALTONE (1 << 20) |
#define DSP_PROGRESS_CONGESTION (1 << 19) |
#define DSP_PROGRESS_RINGING (1 << 17) |
int ast_dsp_get_threshold_from_settings | ( | enum threshold | which | ) |
Get silence threshold from dsp.conf.
Definition at line 2009 of file dsp.c.
Referenced by ast_record_review(), load_config(), and setup_privacy_args().
Process the audio frame for noise.
dsp | DSP processing audio media. |
f | Audio frame to process. |
totalnoise | Variable to set to the total accumulated noise in ms seen by the DSP since the last silence. |
int ast_dsp_set_digitmode | ( | struct ast_dsp * | dsp, |
int | digitmode | ||
) |
Set digit mode.
Definition at line 1857 of file dsp.c.
References DSP_DIGITMODE_DTMF, DSP_DIGITMODE_MF, DSP_DIGITMODE_MUTECONF, and DSP_DIGITMODE_MUTEMAX.
Referenced by dahdi_setoption(), mbl_load_device(), mkintf(), and read_mf_digits().
Process the audio frame for silence.
dsp | DSP processing audio media. |
f | Audio frame to process. |
totalsilence | Variable to set to the total accumulated silence in ms seen by the DSP since the last noise. |
Definition at line 1488 of file dsp.c.
Referenced by __ast_play_and_record().
int ast_dsp_silence_with_energy | ( | struct ast_dsp * | dsp, |
struct ast_frame * | f, | ||
int * | totalsilence, | ||
int * | frames_energy | ||
) |
Process the audio frame for silence.
dsp | DSP processing audio media. |
f | Audio frame to process. |
totalsilence | Variable to set to the total accumulated silence in ms seen by the DSP since the last noise. |
frames_energy | Variable to set to the average energy of the samples in the frame. |
int ast_dsp_was_muted | ( | struct ast_dsp * | dsp | ) |