]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Nov 2007 22:05:41 +0000 (22:05 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Nov 2007 22:05:41 +0000 (22:05 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@328 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/Makefile
libs/openzap/src/detect_tones.c [new file with mode: 0644]

index 1eb5054414c6136df295e2da045076d95181ef01..32b70f0cc42ec7df68637406c33b0a89aee5392b 100644 (file)
@@ -98,18 +98,29 @@ $(SRC)/isdn/include/Q932.h
 
 PWD=$(shell pwd)
 INCS=-I$(PWD)/$(SRC)//include -I$(PWD)/$(SRC)//isdn/include
-CFLAGS=$(ZAP_CFLAGS) $(INCS)
+CFLAGS= $(INCS) $(ZAP_CFLAGS)
 MYLIB=libopenzap.a
 LIBPRIA=libpri.a
 LIBPRI=./libpri
 TMP=-I$(LIBPRI) -I$(SRC)/include -I./src -w
 
+PIKA_DIR=$(shell ls -d /usr/include/pika)
+PIKA_LIB=$(shell ls /usr/lib/libpikahmpapi.so)
+
+ifneq ($(PIKA_DIR),)
+ifneq ($(PIKA_LIB),)
+OBJS += $(SRC)/zap_pika.o
+CFLAGS += -DZAP_PIKA_SUPPORT -I$(PIKA_DIR)
+ADD_OBJS = $(PIKA_LIB)
+endif
+endif
+
 include general.makefile
 
 all: $(MYLIB)
 
 $(MYLIB): $(OBJS) $(HEADERS)
-       ar rcs $(MYLIB) $(OBJS) 
+       ar rcs $(MYLIB) $(OBJS) $(ADD_OBJS)
        ranlib $(MYLIB)
 
 testapp: $(SRC)/testapp.c $(MYLIB)
@@ -119,13 +130,16 @@ testcid: $(SRC)/testcid.c $(MYLIB)
        $(CC) $(INCS) -L. -g -ggdb $(SRC)/testcid.c -o testcid -lopenzap -lm -lpthread
 
 testtones: $(SRC)/testtones.c $(MYLIB)
-       $(CC) $(INCS) -L. $(SRC)/testtones.c -o testtones -lopenzap -lm -lpthread
+       $(CC) $(INCS) -L. $(SRC)/testtones.c -o testtones -lopenzap -lm
+
+detect_tones: $(SRC)/detect_tones.c $(MYLIB)
+       $(CC) $(INCS) -L. $(SRC)/detect_tones.c -o detect_tones -lopenzap -lm
 
 testisdn: $(SRC)/testisdn.c $(MYLIB)
        $(CC) $(INCS) $(ZAP_CFLAGS) -L. $(SRC)/testisdn.c -o testisdn -lopenzap -lm -lpthread
 
 testanalog: $(SRC)/testanalog.c $(MYLIB)
-       $(CC) $(INCS) -L. $(SRC)/testanalog.c -o testanalog -lopenzap -lm -lpthread
+       $(CC) $(INCS) -L. $(SRC)/testanalog.c -o testanalog -lopenzap -lm -lpthread 
 
 $(SRC)/priserver.o: $(SRC)/priserver.c
        $(CC) $(INCS) $(TMP) -c $(SRC)/priserver.c -o $(SRC)/priserver.o 
@@ -160,6 +174,6 @@ mod_openzap-clean:
        @if [ -f mod_openzap/mod_openzap.so ] ; then cd mod_openzap && make clean ; fi
 
 clean: mod_openzap-clean
-       rm -f $(SRC)/*.o $(SRC)/isdn/*.o $(MYLIB) *~ \#* testapp testcid testtones priserver testisdn testanalog
+       rm -f $(SRC)/*.o $(SRC)/isdn/*.o $(MYLIB) *~ \#* testapp testcid testtones detect_tones priserver testisdn testanalog
        @if [ -f $(LIBPRI)/$(LIBPRIA) ] ; then cd $(LIBPRI) && make clean ; fi
 
diff --git a/libs/openzap/src/detect_tones.c b/libs/openzap/src/detect_tones.c
new file mode 100644 (file)
index 0000000..52ccbcd
--- /dev/null
@@ -0,0 +1,31 @@
+//#include "openzap.h"
+#include "libteletone_detect.h"
+
+int main(int argc, char *argv[])
+{
+       teletone_generation_session_t ts;
+       teletone_multi_tone_t mt = {0};
+       teletone_tone_map_t map = {350.0, 440.0, 0.0};
+
+       int fd, b;
+       short sln[512] = {0};
+
+       if (argc < 2) {
+               fprintf(stderr, "Arg Error!\n");
+               exit(-1);
+       }
+
+       teletone_multi_tone_init(&mt, &map);
+
+
+       if ((fd = open(argv[1], O_RDONLY)) < 0) {
+               fprintf(stderr, "File Error!\n", strerror(errno));
+               exit(-1);
+       }
+
+       while((b = read(fd, sln, 320)) > 0) {
+               printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2));
+       }
+       close(fd);
+}
+