FreeSWITCH API Documentation
1.7.0
|
#include <libteletone_detect.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
Go to the source code of this file.
Macros | |
#define | LOW_ENG 10000000 |
#define | ZC 2 |
#define | teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)) |
Functions | |
static void | goertzel_init (teletone_goertzel_state_t *goertzel_state, teletone_detection_descriptor_t *tdesc) |
void | teletone_goertzel_update (teletone_goertzel_state_t *goertzel_state, int16_t sample_buffer[], int samples) |
Step through the Goertzel Algorithm for each sample in a buffer. More... | |
void | teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate) |
Initilize a DTMF detection state object. More... | |
void | teletone_multi_tone_init (teletone_multi_tone_t *mt, teletone_tone_map_t *map) |
Initilize a multi-frequency tone detector. More... | |
int | teletone_multi_tone_detect (teletone_multi_tone_t *mt, int16_t sample_buffer[], int samples) |
Check a sample buffer for the presence of the mulit-frequency tone described by mt. More... | |
teletone_hit_type_t | teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, int16_t sample_buffer[], int samples) |
Check a sample buffer for the presence of DTMF digits. More... | |
int | teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, char *buf, unsigned int *dur) |
retrieve any collected digits into a string buffer More... | |
Variables | |
static teletone_detection_descriptor_t | dtmf_detect_row [GRID_FACTOR] |
static teletone_detection_descriptor_t | dtmf_detect_col [GRID_FACTOR] |
static teletone_detection_descriptor_t | dtmf_detect_row_2nd [GRID_FACTOR] |
static teletone_detection_descriptor_t | dtmf_detect_col_2nd [GRID_FACTOR] |
static float | dtmf_row [] = {697.0f, 770.0f, 852.0f, 941.0f} |
static float | dtmf_col [] = {1209.0f, 1336.0f, 1477.0f, 1633.0f} |
static char | dtmf_positions [] = "123A" "456B" "789C" "*0#D" |
#define LOW_ENG 10000000 |
Definition at line 103 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect().
#define teletone_goertzel_result | ( | gs | ) | (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)) |
Definition at line 137 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect(), and teletone_multi_tone_detect().
#define ZC 2 |
Definition at line 104 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect().
|
static |
Definition at line 115 of file libteletone_detect.c.
References teletone_goertzel_state_t::fac, teletone_detection_descriptor_t::fac, teletone_goertzel_state_t::v2, and teletone_goertzel_state_t::v3.
Referenced by teletone_dtmf_detect(), teletone_dtmf_detect_init(), teletone_multi_tone_detect(), and teletone_multi_tone_init().
teletone_hit_type_t teletone_dtmf_detect | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Check a sample buffer for the presence of DTMF digits.
dtmf_detect_state | the detection state object to check |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 307 of file libteletone_detect.c.
References BLOCK_LEN, DTMF_2ND_HARMONIC_COL, DTMF_2ND_HARMONIC_ROW, DTMF_NORMAL_TWIST, dtmf_positions, DTMF_RELATIVE_PEAK_COL, DTMF_RELATIVE_PEAK_ROW, DTMF_REVERSE_TWIST, DTMF_THRESHOLD, goertzel_init(), GRID_FACTOR, LOW_ENG, teletone_goertzel_result, TELETONE_MAX_DTMF_DIGITS, TT_HIT_BEGIN, TT_HIT_END, TT_HIT_MIDDLE, and ZC.
Referenced by inband_dtmf_callback().
void teletone_dtmf_detect_init | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
int | sample_rate | ||
) |
Initilize a DTMF detection state object.
dtmf_detect_state | the DTMF detection state to initilize |
sample_rate | the desired sample rate |
Definition at line 139 of file libteletone_detect.c.
References dtmf_col, dtmf_row, teletone_detection_descriptor_t::fac, goertzel_init(), GRID_FACTOR, and M_TWO_PI.
Referenced by switch_ivr_inband_dtmf_session().
int teletone_dtmf_get | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
char * | buf, | ||
unsigned int * | dur | ||
) |
retrieve any collected digits into a string buffer
dtmf_detect_state | the detection state object to check |
buf | the string buffer to write to |
max | the maximum length of buf |
Definition at line 462 of file libteletone_detect.c.
Referenced by inband_dtmf_callback().
void teletone_goertzel_update | ( | teletone_goertzel_state_t * | goertzel_state, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Step through the Goertzel Algorithm for each sample in a buffer.
goertzel_state | the goertzel state to step the samples through |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 120 of file libteletone_detect.c.
int teletone_multi_tone_detect | ( | teletone_multi_tone_t * | mt, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Check a sample buffer for the presence of the mulit-frequency tone described by mt.
mt | the multi-frequency tone descriptor |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 217 of file libteletone_detect.c.
References goertzel_init(), teletone_goertzel_result, and TELETONE_MAX_TONES.
Referenced by tone_detect_callback().
void teletone_multi_tone_init | ( | teletone_multi_tone_t * | mt, |
teletone_tone_map_t * | map | ||
) |
Initilize a multi-frequency tone detector.
mt | the multi-frequency tone descriptor |
map | a representation of the multi-frequency tone |
Definition at line 177 of file libteletone_detect.c.
References goertzel_init(), M_TWO_PI, and TELETONE_MAX_TONES.
Referenced by switch_ivr_tone_detect_session().
|
static |
Definition at line 111 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect_init().
|
static |
Definition at line 106 of file libteletone_detect.c.
|
static |
Definition at line 108 of file libteletone_detect.c.
|
static |
Definition at line 105 of file libteletone_detect.c.
|
static |
Definition at line 107 of file libteletone_detect.c.
|
static |
Definition at line 113 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect().
|
static |
Definition at line 110 of file libteletone_detect.c.
Referenced by teletone_dtmf_detect_init().