115 #define FREQ_ARRAY_SIZE 7 140 #define DEFAULT_THRESHOLD 512 151 #define DSP_HISTORY 15 153 #define TONE_THRESH 10.0 154 #define TONE_MIN_THRESH 1e8 166 #define MAX_DTMF_DIGITS 128 180 #define DTMF_THRESHOLD 8.0e7 181 #define TONE_THRESHOLD 7.8e7 183 #define DEF_DTMF_NORMAL_TWIST 6.31 184 #define DEF_RELAX_DTMF_NORMAL_TWIST 6.31 187 #define DEF_DTMF_REVERSE_TWIST 2.51 188 #define DEF_RELAX_DTMF_REVERSE_TWIST 6.61 190 #define DEF_DTMF_REVERSE_TWIST 2.51 191 #define DEF_RELAX_DTMF_REVERSE_TWIST 3.98 194 #define DTMF_RELATIVE_PEAK_ROW 6.3 195 #define DTMF_RELATIVE_PEAK_COL 6.3 196 #define DTMF_TO_TOTAL_ENERGY 42.0 198 #define BELL_MF_THRESHOLD 1.6e9 199 #define BELL_MF_TWIST 4.0 200 #define BELL_MF_RELATIVE_PEAK 12.6 202 #if defined(BUSYDETECT_TONEONLY) && defined(BUSYDETECT_COMPARE_TONE_AND_SILENCE) 203 #error You cant use BUSYDETECT_TONEONLY together with BUSYDETECT_COMPARE_TONE_AND_SILENCE 209 #define FAX_TONE_CNG_FREQ 1100 210 #define FAX_TONE_CNG_DURATION 500 211 #define FAX_TONE_CNG_DB 16 217 #define FAX_TONE_CED_FREQ 2100 218 #define FAX_TONE_CED_DURATION 2600 219 #define FAX_TONE_CED_DB 16 221 #define DEFAULT_SAMPLE_RATE 8000 227 #define DTMF_GSIZE 102 232 #define DEF_DTMF_HITS_TO_BEGIN 2 237 #define DEF_DTMF_MISSES_TO_END 3 245 #define CONFIG_FILE_NAME "dsp.conf" 318 697.0, 770.0, 852.0, 941.0
321 1209.0, 1336.0, 1477.0, 1633.0
324 700.0, 900.0, 1100.0, 1300.0, 1500.0, 1700.0
350 s->
v3 = (s->
fac * s->
v2) >> 15;
354 if (
abs(s->
v3) > (1 << 15)) {
373 return (
float)r.
value * (float)(1 << r.
power);
379 s->
fac = (int)(32768.0 * 2.0 *
cos(2.0 *
M_PI * freq / sample_rate));
452 int duration_samples;
454 int periods_in_block;
459 duration_samples = duration * sample_rate / 1000;
461 duration_samples = duration_samples * 9 / 10;
468 periods_in_block = s->
block_size * freq / sample_rate;
473 if (periods_in_block < 5) {
474 periods_in_block = 5;
478 s->
block_size = periods_in_block * sample_rate / freq;
505 x = pow(10.0, amp / 10.0);
535 for (i = 0; i < 4; i++) {
551 for (i = 0; i < 6; i++) {
590 for (start = 0; start < samples; start =
end) {
592 limit = samples - start;
598 for (i = limit, ptr = amp ; i > 0; i--, ptr++) {
670 if (mute.
end > samples) {
713 for (sample = 0; sample < samples; sample = limit) {
722 for (j = sample; j < limit; j++) {
745 for (best_row = best_col = 0, i = 1; i < 4; i++) {
747 if (row_energy[i] > row_energy[best_row]) {
751 if (col_energy[i] > col_energy[best_col]) {
755 ast_debug(10,
"DTMF best '%c' Erow=%.4E Ecol=%.4E Erc=%.4E Et=%.4E\n",
757 row_energy[best_row], col_energy[best_col],
758 row_energy[best_row] + col_energy[best_col], s->
td.
dtmf.
energy);
766 for (i = 0; i < 4; i++) {
767 if ((i != best_col &&
871 if (squelch && hit) {
881 for (i = 0; i < 4; i++) {
889 if (squelch && mute.
end) {
890 if (mute.
end > samples) {
901 int samples,
int squelch,
int relax)
920 for (sample = 0; sample < samples; sample = limit) {
930 for (j = sample; j < limit; j++) {
954 if (energy[0] > energy[1]) {
962 for (i = 2; i < 6; i++) {
964 if (energy[i] >= energy[best]) {
967 }
else if (energy[i] >= energy[second_best]) {
978 for (i = 0; i < 6; i++) {
979 if (i != best && i != second_best) {
990 if (second_best < best) {
995 best = best * 5 + second_best - 1;
1024 if (squelch && hit) {
1034 for (i = 0; i < 6; i++) {
1040 if (squelch && mute.
end) {
1041 if (mute.
end > samples) {
1051 static inline int pair_there(
float p1,
float p2,
float i1,
float i2,
float e)
1063 if ((p1 < i1) || (p1 < i2) || (p1 < e)) {
1067 if ((p2 < i1) || (p2 < i2) || (p2 < e)) {
1090 for (x = 0; x <
pass; x++) {
1093 for (y = 0; y < freqcount; y++) {
1109 }
else if (
pair_there(hz[HZ_440], hz[HZ_480], hz[HZ_350], hz[HZ_620], dsp->
genergy)) {
1111 }
else if (
pair_there(hz[HZ_350], hz[HZ_440], hz[HZ_480], hz[HZ_620], dsp->
genergy)) {
1150 if (newstate == dsp->
tstate) {
1193 ast_debug(1,
"Consider call as answered because of timeout after last ring\n");
1199 ast_debug(5,
"Start state %d\n", newstate);
1205 for (x = 0; x < 7; x++) {
1239 for (x = 0; x <
len; x++) {
1267 if (silence1 < silence2) {
1268 if (silence1 + silence1 *
BUSY_PERCENT / 100 >= silence2) {
1274 if (silence1 - silence1 *
BUSY_PERCENT / 100 <= silence2) {
1289 if (frames_energy) {
1290 *frames_energy = accum;
1298 #ifndef BUSYDETECT_TONEONLY 1299 int avgsilence = 0, hitsilence = 0;
1301 int avgtone = 0, hittone = 0;
1311 #ifndef BUSYDETECT_TONEONLY 1316 #ifndef BUSYDETECT_TONEONLY 1321 #ifndef BUSYDETECT_TONEONLY 1342 #ifndef BUSYDETECT_TONEONLY 1350 #ifdef BUSYDETECT_COMPARE_TONE_AND_SILENCE 1351 if (avgtone > avgsilence) {
1352 if (avgtone - avgtone*
BUSY_PERCENT/100 <= avgsilence) {
1356 if (avgtone + avgtone*
BUSY_PERCENT/100 >= avgsilence) {
1394 ast_debug(5,
"errors = %d max = %d\n", errors, errors_max);
1396 if (errors <= errors_max) {
1404 #ifdef BUSYDETECT_DEBUG 1405 ast_debug(5,
"busy detector: avgtone of %d not close enough to desired %d\n",
1411 #ifndef BUSYDETECT_TONEONLY 1415 #ifdef BUSYDETECT_DEBUG 1416 ast_debug(5,
"busy detector: avgsilence of %d not close enough to desired %d\n",
1423 #if !defined(BUSYDETECT_TONEONLY) && defined(BUSYDETECT_DEBUG) 1425 ast_debug(5,
"ast_dsp_busydetect detected busy, avgtone: %d, avgsilence %d\n", avgtone, avgsilence);
1427 ast_debug(5,
"busy detector: FAILED with avgtone: %d, avgsilence %d\n", avgtone, avgsilence);
1438 unsigned char *odata;
1457 for (x = 0; x <
len; x++) {
1462 for (x = 0; x <
len; x++) {
1466 ast_log(
LOG_WARNING,
"Can only calculate silence on signed-linear, alaw or ulaw frames :(\n");
1498 int digit = 0, fax_digit = 0, custom_freq_digit = 0;
1501 unsigned char *odata;
1520 for (x = 0; x <
len; x++) {
1525 for (x = 0; x <
len; x++) {
1546 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1553 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1573 custom_freq_digit =
'q';
1585 int event = 0, event_len = 0;
1586 char event_digit = 0;
1613 ast_debug(1,
"DTMF Detected - Reset busydetector\n");
1618 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1621 dsp->
f.
len = event_len;
1631 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1638 if (custom_freq_digit) {
1641 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1657 memset(&dsp->
f, 0,
sizeof(dsp->
f));
1660 dsp->
f.
src =
"dsp_progress";
1680 for (x = 0; x <
len; x++) {
1681 odata[x] =
AST_LIN2MU((
unsigned short) shortdata[x]);
1684 for (x = 0; x <
len; x++) {
1685 odata[x] =
AST_LIN2A((
unsigned short) shortdata[x]);
1805 for (i = 0; i < 6; i++) {
1814 for (i = 0; i < 4; i++) {
1836 for (x = 0; x < 4; x++) {
1872 if (dsp->
faxmode != faxmode) {
1933 if (!strcasecmp(v->
name,
"silencethreshold")) {
1934 if (sscanf(v->
value,
"%30d", &cfg_threshold) < 1) {
1936 }
else if (cfg_threshold < 0) {
1937 ast_log(
LOG_WARNING,
"Invalid silence threshold '%d' specified, using default\n", cfg_threshold);
1941 }
else if (!strcasecmp(v->
name,
"dtmf_normal_twist")) {
1942 if (sscanf(v->
value,
"%30f", &cfg_twist) < 1) {
1944 }
else if ((cfg_twist < 2.0) || (cfg_twist > 100.0)) {
1949 }
else if (!strcasecmp(v->
name,
"dtmf_reverse_twist")) {
1950 if (sscanf(v->
value,
"%30f", &cfg_twist) < 1) {
1952 }
else if ((cfg_twist < 2.0) || (cfg_twist > 100.0)) {
1957 }
else if (!strcasecmp(v->
name,
"relax_dtmf_normal_twist")) {
1958 if (sscanf(v->
value,
"%30f", &cfg_twist) < 1) {
1960 }
else if ((cfg_twist < 2.0) || (cfg_twist > 100.0)) {
1965 }
else if (!strcasecmp(v->
name,
"relax_dtmf_reverse_twist")) {
1966 if (sscanf(v->
value,
"%30f", &cfg_twist) < 1) {
1968 }
else if ((cfg_twist < 2.0) || (cfg_twist > 100.0)) {
1973 }
else if (!strcasecmp(v->
name,
"dtmf_hits_to_begin")) {
1974 if (sscanf(v->
value,
"%30d", &cfg_threshold) < 1) {
1976 }
else if (cfg_threshold < 1) {
1981 }
else if (!strcasecmp(v->
name,
"dtmf_misses_to_end")) {
1982 if (sscanf(v->
value,
"%30d", &cfg_threshold) < 1) {
1984 }
else if (cfg_threshold < 1) {
2001 #ifdef TEST_FRAMEWORK 2005 double sample_step = 2.0 *
M_PI * freq / rate;
2007 for (idx = 0; idx < samples; ++idx) {
2008 slin_buf[idx] = amplitude * sin(sample_step * idx);
2013 #ifdef TEST_FRAMEWORK 2017 double sample_step = 2.0 *
M_PI * freq / rate;
2019 for (idx = 0; idx < samples; ++idx) {
2020 slin_buf[idx] += amplitude * sin(sample_step * idx);
2025 #ifdef TEST_FRAMEWORK 2033 #ifdef TEST_FRAMEWORK 2034 #define TONE_AMPLITUDE_MAX 0x7fff 2035 #define TONE_AMPLITUDE_MIN 80 2047 { .amp_val = 10000, .detect = 1, },
2048 { .amp_val = 1000, .detect = 1, },
2049 { .amp_val = 100, .detect = 1, },
2051 { .amp_val = 75, .detect = 0, },
2052 { .amp_val = 10, .detect = 0, },
2053 { .amp_val = 1, .detect = 0, },
2058 for (idx = 0; idx <
ARRAY_LEN(amp_tests); ++idx) {
2062 ast_debug(1,
"Test %d Hz at amplitude %d\n",
2063 tone_state->
freq, amp_tests[idx].amp_val);
2065 tone_state->
freq, amp_tests[idx].amp_val);
2068 for (duration = 0; !detected && duration < tone_state->
hits_required + 3; ++duration) {
2071 if (amp_tests[idx].detect != detected) {
2079 "Test %d Hz at amplitude %d failed. Detected: %s\n",
2080 tone_state->
freq, amp_tests[idx].amp_val,
2081 detected ?
"yes" :
"no");
2083 "Test %d Hz at amplitude %d failed. Detected: %s\n",
2084 tone_state->
freq, amp_tests[idx].amp_val,
2085 detected ?
"yes" :
"no");
2095 #ifdef TEST_FRAMEWORK 2119 { .amp_val = 170, .digit = 0, },
2120 { .amp_val = 100, .digit = 0, },
2126 { .amp_val = 75, .digit = 0, },
2127 { .amp_val = 10, .digit = 0, },
2128 { .amp_val = 1, .digit = 0, },
2131 row = (digit_index >> 2) & 0x03;
2132 column = digit_index & 0x03;
2136 for (idx = 0; idx <
ARRAY_LEN(amp_tests); ++idx) {
2140 ast_debug(1,
"Test '%c' at amplitude %d\n",
2143 (
int)
dtmf_row[row], amp_tests[idx].amp_val,
2144 (
int)
dtmf_col[column], amp_tests[idx].amp_val);
2147 for (duration = 0; !digit && duration < 3; ++duration) {
2151 if (amp_tests[idx].digit != digit) {
2159 "Test '%c' at amplitude %d failed. Detected Digit: '%c'\n",
2163 "Test '%c' at amplitude %d failed. Detected Digit: '%c'\n",
2175 #ifdef TEST_FRAMEWORK 2195 { .amp_row = 1000 + 1800, .amp_col = 1000 + 0, .digit = 0, },
2196 { .amp_row = 1000 + 1700, .amp_col = 1000 + 0, .digit = 0, },
2198 { .amp_row = 1000 + 1400, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2199 { .amp_row = 1000 + 1300, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2200 { .amp_row = 1000 + 1200, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2201 { .amp_row = 1000 + 1100, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2202 { .amp_row = 1000 + 1000, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2203 { .amp_row = 1000 + 100, .amp_col = 1000 + 0, .digit =
dtmf_positions[digit_index], },
2204 { .amp_row = 1000 + 0, .amp_col = 1000 + 100, .digit =
dtmf_positions[digit_index], },
2205 { .amp_row = 1000 + 0, .amp_col = 1000 + 200, .digit =
dtmf_positions[digit_index], },
2206 { .amp_row = 1000 + 0, .amp_col = 1000 + 300, .digit =
dtmf_positions[digit_index], },
2207 { .amp_row = 1000 + 0, .amp_col = 1000 + 400, .digit =
dtmf_positions[digit_index], },
2208 { .amp_row = 1000 + 0, .amp_col = 1000 + 500, .digit =
dtmf_positions[digit_index], },
2209 { .amp_row = 1000 + 0, .amp_col = 1000 + 550, .digit =
dtmf_positions[digit_index], },
2211 { .amp_row = 1000 + 0, .amp_col = 1000 + 650, .digit = 0, },
2212 { .amp_row = 1000 + 0, .amp_col = 1000 + 700, .digit = 0, },
2213 { .amp_row = 1000 + 0, .amp_col = 1000 + 800, .digit = 0, },
2215 float save_normal_twist;
2216 float save_reverse_twist;
2223 row = (digit_index >> 2) & 0x03;
2224 column = digit_index & 0x03;
2228 for (idx = 0; idx <
ARRAY_LEN(twist_tests); ++idx) {
2232 ast_debug(1,
"Test '%c' twist row %d col %d amplitudes\n",
2234 twist_tests[idx].amp_row, twist_tests[idx].amp_col);
2236 (
int)
dtmf_row[row], twist_tests[idx].amp_row,
2237 (
int)
dtmf_col[column], twist_tests[idx].amp_col);
2240 for (duration = 0; !digit && duration < 3; ++duration) {
2244 if (twist_tests[idx].digit != digit) {
2252 "Test '%c' twist row %d col %d amplitudes failed. Detected Digit: '%c'\n",
2254 twist_tests[idx].amp_row, twist_tests[idx].amp_col,
2257 "Test '%c' twist row %d col %d amplitudes failed. Detected Digit: '%c'\n",
2259 twist_tests[idx].amp_row, twist_tests[idx].amp_col,
2273 #ifdef TEST_FRAMEWORK 2283 lower_freq = tone_state->
freq - 4;
2284 upper_freq = tone_state->
freq + 4;
2289 for (freq = 100; freq <= 3500; freq += 1) {
2292 int expect_detection;
2294 if (freq == tone_state->
freq) {
2299 expect_detection = (lower_freq <= freq && freq <= upper_freq) ? 1 : 0;
2301 ast_debug(1,
"Test %d Hz detection given %d Hz tone at amplitude %d. Range:%d-%d Expect detect: %s\n",
2302 tone_state->
freq, freq, amplitude, lower_freq, upper_freq,
2303 expect_detection ?
"yes" :
"no");
2308 for (duration = 0; !detected && duration < tone_state->
hits_required + 3; ++duration) {
2311 if (expect_detection != detected) {
2319 "Test %d Hz detection given %d Hz tone at amplitude %d failed. Range:%d-%d Detected: %s\n",
2320 tone_state->
freq, freq, amplitude, lower_freq, upper_freq,
2321 detected ?
"yes" :
"no");
2323 "Test %d Hz detection given %d Hz tone at amplitude %d failed. Range:%d-%d Detected: %s\n",
2324 tone_state->
freq, freq, amplitude, lower_freq, upper_freq,
2325 detected ?
"yes" :
"no");
2335 #ifdef TEST_FRAMEWORK 2344 info->category =
"/main/dsp/";
2345 info->summary =
"DSP fax tone detect unit test";
2347 "Tests fax tone detection code.";
2391 #ifdef TEST_FRAMEWORK 2400 info->name =
"dtmf";
2401 info->category =
"/main/dsp/";
2402 info->summary =
"DSP DTMF detect unit test";
2404 "Tests DTMF detection code.";
2465 .requires =
"extconfig",
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...
static void ast_digit_detect_init(digit_detect_state_t *s, int mf, unsigned int sample_rate)
static void mute_fragment(struct ast_dsp *dsp, fragment_t *fragment)
A-Law to Signed linear conversion.
struct ast_variable * next
#define DSP_PROGRESS_RINGING
Main Channel structure associated with a channel.
union digit_detect_state_t::@383 td
static float relax_dtmf_reverse_twist
AST_TEST_DEFINE(test_dsp_fax_detect)
static int unload_module(void)
Asterisk main include file. File version handling, generic pbx functions.
static int ast_dsp_silence_noise_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *total, int *frames_energy, int noise)
static int load_module(void)
static void test_tone_sample_gen(short *slin_buf, int samples, int rate, int freq, short amplitude)
#define DTMF_RELATIVE_PEAK_COL
struct ast_frame * ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *af)
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress...
#define FAX_TONE_CNG_FREQ
static int reload_module(void)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
static int test_dtmf_twist_sweep(struct ast_test *test, struct ast_dsp *dsp, int digit_index)
#define DSP_TONE_STATE_HUNGUP
#define DSP_DIGITMODE_DTMF
goertzel_state_t freqs[FREQ_ARRAY_SIZE]
#define DSP_FEATURE_DIGIT_DETECT
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
#define DTMF_RELATIVE_PEAK_ROW
Convenient Signal Processing routines.
#define DSP_DIGITMODE_MUTECONF
static const char bell_mf_positions[]
#define DSP_PROGRESS_BUSY
static const int DEFAULT_SILENCE_THRESHOLD
The default silence threshold we will use if an alternate configured value is not present or is inval...
int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone)
Set zone for doing progress detection.
#define DSP_PROGRESS_TALK
static void ast_freq_detect_init(struct ast_dsp *s, int freq, int dur, int db, int squelch)
#define CONFIG_STATUS_FILEINVALID
#define DSP_FEATURE_CALL_PROGRESS
#define DEF_DTMF_NORMAL_TWIST
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.
#define DSP_TONE_STATE_DIALTONE
#define DTMF_TO_TOTAL_ENERGY
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
Structure for variables, used for configurations and for channel variables.
static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)
int historicsilence[DSP_HISTORY]
#define DSP_PROGRESS_CONGESTION
#define AST_TEST_REGISTER(cb)
#define DSP_FAXMODE_DETECT_SQUELCH
#define DEF_DTMF_HITS_TO_BEGIN
static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[], int samples, int squelch, int relax)
static const char dtmf_positions[]
int freqs[FREQ_ARRAY_SIZE]
goertzel_state_t tone_out[6]
static int test_dtmf_amplitude_sweep(struct ast_test *test, struct ast_dsp *dsp, int digit_index)
#define FAX_TONE_CNG_DURATION
#define DSP_TONE_STATE_TALKING
#define FAX_TONE_CED_FREQ
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 ...
static void ast_dsp_prog_reset(struct ast_dsp *dsp)
static void goertzel_reset(goertzel_state_t *s)
static void test_tone_sample_gen_add(short *slin_buf, int samples, int rate, int freq, short amplitude)
void ast_dsp_reset(struct ast_dsp *dsp)
Reset total silence count.
digit_detect_state_t digit_state
int historicnoise[DSP_HISTORY]
struct ast_frame_subclass subclass
static int test_tone_freq_sweep(struct ast_test *test, struct ast_dsp *dsp, tone_detect_state_t *tone_state, short amplitude)
char digits[MAX_DTMF_DIGITS+1]
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
static const float dtmf_col[]
int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise)
Process the audio frame for noise.
static int dtmf_hits_to_begin
Configuration File Parser.
#define FAX_TONE_CED_DURATION
#define DSP_DIGITMODE_RELAXDTMF
#define ast_debug(level,...)
Log a DEBUG message.
#define DEF_DTMF_REVERSE_TWIST
#define DSP_TONE_STATE_SPECIAL2
static struct progress modes[]
u-Law to Signed linear conversion
static const float dtmf_row[]
enum gsamp_size gsamp_size
General Asterisk PBX channel definitions.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
#define DSP_TONE_STATE_RINGING
#define ast_test_status_update(a, b, c...)
static int dtmf_misses_to_end
#define DSP_TONE_STATE_BUSY
void ast_dsp_digitreset(struct ast_dsp *dsp)
Reset DTMF detector.
#define DEF_DTMF_MISSES_TO_END
#define DSP_FEATURE_SILENCE_SUPPRESS
Asterisk internal frame definitions.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define DSP_FEATURE_FAX_DETECT
static void ast_dtmf_detect_init(dtmf_detect_state_t *s, unsigned int sample_rate)
#define DSP_TONE_STATE_SPECIAL3
static struct progalias aliases[]
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
goertzel_state_t col_out[4]
#define DEFAULT_THRESHOLD
Default minimum average magnitude threshold to determine talking/noise by the DSP.
#define DEF_RELAX_DTMF_NORMAL_TWIST
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
#define CONFIG_STATUS_FILEUNCHANGED
static void store_digit(digit_detect_state_t *s, char digit)
void ast_dsp_free(struct ast_dsp *dsp)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
static void ast_tone_detect_init(tone_detect_state_t *s, int freq, int duration, int amp, unsigned int sample_rate)
static void goertzel_init(goertzel_state_t *s, float freq, unsigned int sample_rate)
static const float mf_tones[]
static float dtmf_normal_twist
#define DSP_DIGITMODE_MUTEMAX
static int mf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[], int samples, int squelch, int relax)
static float relax_dtmf_normal_twist
#define DSP_TONE_STATE_SPECIAL1
static int test_tone_amplitude_sweep(struct ast_test *test, struct ast_dsp *dsp, tone_detect_state_t *tone_state)
#define AST_TEST_UNREGISTER(cb)
int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf)
Scans for progress indication in audio.
#define TONE_AMPLITUDE_MIN
#define DSP_FAXMODE_DETECT_CED
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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.
static void ast_fax_detect_init(struct ast_dsp *s)
#define TONE_AMPLITUDE_MAX
unsigned int ast_dsp_get_sample_rate(const struct ast_dsp *dsp)
Retrieve the sample rate this DSP structure was created with.
#define ast_calloc(num, len)
A wrapper for calloc()
Module could not be loaded properly.
#define DSP_FEATURE_BUSY_DETECT
static int __ast_dsp_silence_noise(struct ast_dsp *dsp, short *s, int len, int *totalsilence, int *totalnoise, int *frames_energy)
int ast_dsp_set_faxmode(struct ast_dsp *dsp, int faxmode)
Set fax mode.
#define ast_frisolate(fr)
Makes a frame independent of any static storage.
#define DEFAULT_SAMPLE_RATE
int ast_dsp_get_tcount(struct ast_dsp *dsp)
Get tcount (Threshold counter)
tone_detect_state_t ced_tone_state
Structure used to handle boolean flags.
static int _dsp_init(int reload)
int ast_dsp_get_tstate(struct ast_dsp *dsp)
Get tstate (Tone State)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define CONFIG_STATUS_FILEMISSING
struct ast_dsp_busy_pattern busy_cadence
static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX]
static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp, int samples)
static void goertzel_sample(goertzel_state_t *s, short sample)
#define BELL_MF_RELATIVE_PEAK
static void test_dual_sample_gen(short *slin_buf, int samples, int rate, int f1, short a1, int f2, short a2)
#define BELL_MF_THRESHOLD
const char * ast_channel_name(const struct ast_channel *chan)
int display_inband_dtmf_warning
tone_detect_state_t cng_tone_state
Data structure associated with a single frame of data.
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
int digitlen[MAX_DTMF_DIGITS+1]
static float goertzel_result(goertzel_state_t *s)
Options provided by main asterisk program.
void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence)
Set expected lengths of the busy tone.
#define DSP_FAXMODE_DETECT_CNG
union ast_frame::@263 data
enum ast_frame_type frametype
#define DSP_TONE_STATE_SILENCE
#define DSP_DIGITMODE_NOQUELCH
static void ast_mf_detect_init(mf_detect_state_t *s, unsigned int sample_rate)
struct ast_format * format
#define DSP_FEATURE_FREQ_DETECT
#define DSP_FEATURE_WAITDIALTONE
static float dtmf_reverse_twist
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define DEF_RELAX_DTMF_REVERSE_TWIST
static int pair_there(float p1, float p2, float i1, float i2, float e)
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
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.
static struct ast_dsp * __ast_dsp_new(unsigned int sample_rate)
goertzel_state_t row_out[4]
static int thresholds[THRESHOLD_MAX]