00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _ASTERISK_DSP_H
00024 #define _ASTERISK_DSP_H
00025
00026 #define DSP_FEATURE_SILENCE_SUPPRESS (1 << 0)
00027 #define DSP_FEATURE_BUSY_DETECT (1 << 1)
00028 #define DSP_FEATURE_DIGIT_DETECT (1 << 3)
00029 #define DSP_FEATURE_FAX_DETECT (1 << 4)
00030
00031 #define DSP_DIGITMODE_DTMF 0
00032 #define DSP_DIGITMODE_MF 1
00033
00034 #define DSP_DIGITMODE_NOQUELCH (1 << 8)
00035 #define DSP_DIGITMODE_MUTECONF (1 << 9)
00036 #define DSP_DIGITMODE_MUTEMAX (1 << 10)
00037 #define DSP_DIGITMODE_RELAXDTMF (1 << 11)
00038
00039 #define DSP_PROGRESS_TALK (1 << 16)
00040 #define DSP_PROGRESS_RINGING (1 << 17)
00041 #define DSP_PROGRESS_BUSY (1 << 18)
00042 #define DSP_PROGRESS_CONGESTION (1 << 19)
00043 #define DSP_FEATURE_CALL_PROGRESS (DSP_PROGRESS_TALK | DSP_PROGRESS_RINGING | DSP_PROGRESS_BUSY | DSP_PROGRESS_CONGESTION)
00044
00045 #define DSP_FAXMODE_DETECT_CNG (1 << 0)
00046 #define DSP_FAXMODE_DETECT_CED (1 << 1)
00047 #define DSP_FAXMODE_DETECT_ALL (DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_CED)
00048
00049 #define DSP_TONE_STATE_SILENCE 0
00050 #define DSP_TONE_STATE_RINGING 1
00051 #define DSP_TONE_STATE_DIALTONE 2
00052 #define DSP_TONE_STATE_TALKING 3
00053 #define DSP_TONE_STATE_BUSY 4
00054 #define DSP_TONE_STATE_SPECIAL1 5
00055 #define DSP_TONE_STATE_SPECIAL2 6
00056 #define DSP_TONE_STATE_SPECIAL3 7
00057 #define DSP_TONE_STATE_HUNGUP 8
00058
00059 struct ast_dsp;
00060
00061 enum threshold {
00062
00063 THRESHOLD_SILENCE = 0,
00064
00065 THRESHOLD_MAX = 1,
00066 };
00067
00068 struct ast_dsp *ast_dsp_new(void);
00069 void ast_dsp_free(struct ast_dsp *dsp);
00070
00071
00072 void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold);
00073
00074
00075 void ast_dsp_set_busy_count(struct ast_dsp *dsp, int cadences);
00076
00077
00078 void ast_dsp_set_busy_compare(struct ast_dsp *dsp, int compare);
00079
00080
00081 void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, int tonelength, int quietlength, int fuzzy);
00082
00083
00084 int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf);
00085
00086
00087 int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone);
00088
00089
00090
00091 struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf);
00092
00093
00094
00095 int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence);
00096
00097
00098
00099
00100
00101
00102 int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise);
00103
00104
00105
00106 int ast_dsp_busydetect(struct ast_dsp *dsp);
00107
00108
00109 int ast_dsp_digitdetect(struct ast_dsp *dsp, struct ast_frame *f);
00110
00111
00112 void ast_dsp_reset(struct ast_dsp *dsp);
00113
00114
00115 void ast_dsp_digitreset(struct ast_dsp *dsp);
00116
00117
00118 void ast_dsp_set_features(struct ast_dsp *dsp, int features);
00119
00120
00121 int ast_dsp_getdigits(struct ast_dsp *dsp, char *buf, int max);
00122
00123
00124
00125
00126 int ast_dsp_set_digitmode(struct ast_dsp *dsp, int digitmode);
00127
00128
00129 int ast_dsp_set_faxmode(struct ast_dsp *dsp, int faxmode);
00130
00131
00132
00133
00134
00135
00136 int ast_dsp_was_muted(struct ast_dsp *dsp);
00137
00138
00139 int ast_dsp_get_tstate(struct ast_dsp *dsp);
00140
00141
00142 int ast_dsp_get_tcount(struct ast_dsp *dsp);
00143
00144
00145
00146
00147
00148 int ast_dsp_get_threshold_from_settings(enum threshold which);
00149
00150
00151
00152
00153
00154 int ast_dsp_reload(void);
00155
00156
00157
00158
00159
00160 int ast_dsp_init(void);
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 void ast_dsp_frame_freed(struct ast_frame *fr);
00174 #endif