mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
pika-choo i choose you
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@331 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
32
libs/freetdm/src/detect_dtmf.c
Normal file
32
libs/freetdm/src/detect_dtmf.c
Normal file
@@ -0,0 +1,32 @@
|
||||
//#include "openzap.h"
|
||||
#include "libteletone_detect.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd, b;
|
||||
short sln[512] = {0};
|
||||
teletone_dtmf_detect_state_t dtmf_detect = {0};
|
||||
char digit_str[128] = "";
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Arg Error!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
teletone_dtmf_detect_init (&dtmf_detect, 8000);
|
||||
|
||||
if ((fd = open(argv[1], O_RDONLY)) < 0) {
|
||||
fprintf(stderr, "File Error!\n", strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
while((b = read(fd, sln, 320)) > 0) {
|
||||
teletone_dtmf_detect(&dtmf_detect, sln, b / 2);
|
||||
teletone_dtmf_get(&dtmf_detect, digit_str, sizeof(digit_str));
|
||||
if (*digit_str) {
|
||||
printf("digit: %s\n", digit_str);
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user