23#ifndef _ASTERISK_DSP_H
24#define _ASTERISK_DSP_H
26#define DSP_FEATURE_SILENCE_SUPPRESS (1 << 0)
27#define DSP_FEATURE_BUSY_DETECT (1 << 1)
28#define DSP_FEATURE_DIGIT_DETECT (1 << 3)
29#define DSP_FEATURE_FAX_DETECT (1 << 4)
31#define DSP_DIGITMODE_DTMF 0
32#define DSP_DIGITMODE_MF 1
34#define DSP_DIGITMODE_NOQUELCH (1 << 8)
35#define DSP_DIGITMODE_MUTECONF (1 << 9)
36#define DSP_DIGITMODE_MUTEMAX (1 << 10)
37#define DSP_DIGITMODE_RELAXDTMF (1 << 11)
39#define DSP_PROGRESS_TALK (1 << 16)
40#define DSP_PROGRESS_RINGING (1 << 17)
41#define DSP_PROGRESS_BUSY (1 << 18)
42#define DSP_PROGRESS_CONGESTION (1 << 19)
43#define DSP_FEATURE_CALL_PROGRESS (DSP_PROGRESS_TALK | DSP_PROGRESS_RINGING | DSP_PROGRESS_BUSY | DSP_PROGRESS_CONGESTION)
44#define DSP_FEATURE_WAITDIALTONE (1 << 20)
45#define DSP_FEATURE_FREQ_DETECT (1 << 21)
47#define DSP_FAXMODE_DETECT_CNG (1 << 0)
48#define DSP_FAXMODE_DETECT_CED (1 << 1)
49#define DSP_FAXMODE_DETECT_SQUELCH (1 << 2)
50#define DSP_FAXMODE_DETECT_ALL (DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_CED)
52#define DSP_TONE_STATE_SILENCE 0
53#define DSP_TONE_STATE_RINGING 1
54#define DSP_TONE_STATE_DIALTONE 2
55#define DSP_TONE_STATE_TALKING 3
56#define DSP_TONE_STATE_BUSY 4
57#define DSP_TONE_STATE_SPECIAL1 5
58#define DSP_TONE_STATE_SPECIAL2 6
59#define DSP_TONE_STATE_SPECIAL3 7
60#define DSP_TONE_STATE_HUNGUP 8
static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX]
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
void ast_dsp_free(struct ast_dsp *dsp)
int ast_dsp_get_tcount(struct ast_dsp *dsp)
Get tcount (Threshold counter)
int ast_dsp_getdigits(struct ast_dsp *dsp, char *buf, int max)
Get pending DTMF/MF digits.
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
void ast_dsp_digitreset(struct ast_dsp *dsp)
Reset DTMF detector.
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_silence_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy)
Process the audio frame for silence.
int ast_dsp_digitdetect(struct ast_dsp *dsp, struct ast_frame *f)
Return non-zero if DTMF hit was found.
int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf)
Scans for progress indication in audio.
void ast_dsp_reset(struct ast_dsp *dsp)
Reset total silence count.
void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence)
Set expected lengths of the busy tone.
unsigned int ast_dsp_get_sample_rate(const struct ast_dsp *dsp)
Retrieve the sample rate this DSP structure was created with.
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,...
int ast_dsp_get_features(struct ast_dsp *dsp)
Get features.
int ast_dsp_set_digitmode(struct ast_dsp *dsp, int digitmode)
Set digit mode.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise)
Process the audio frame for noise.
int ast_dsp_get_tstate(struct ast_dsp *dsp)
Get tstate (Tone State)
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) hap...
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 ...
int ast_dsp_set_faxmode(struct ast_dsp *dsp, int faxmode)
Set fax mode.
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_busy_count(struct ast_dsp *dsp, int cadences)
Set number of required cadences for busy.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone)
Set zone for doing progress detection.
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.