diff --git a/libs/openzap/Makefile b/libs/openzap/Makefile index 628702c594..5c259c578b 100644 --- a/libs/openzap/Makefile +++ b/libs/openzap/Makefile @@ -37,6 +37,9 @@ $(SRC)/zap_io.o \ $(SRC)/zap_isdn.o \ $(SRC)/zap_analog.o \ $(SRC)/zap_config.o \ +$(SRC)/zap_callerid.o \ +$(SRC)/dsp/fsk.o \ +$(SRC)/dsp/uart.o \ $(SRC)/g711.o \ $(SRC)/libteletone_detect.o \ $(SRC)/libteletone_generate.o \ @@ -61,7 +64,7 @@ HEADERS=$(SRC)/isdn/include/Q931.h \ $(SRC)/include/openzap.h PWD=$(shell pwd) -INCS=-I$(PWD)/$(SRC)//include -I$(PWD)/$(SRC)//isdn/include +INCS=-I$(PWD)/$(SRC)//include -I$(PWD)/$(SRC)//isdn/include -I$(PWD)/src/dsp CFLAGS=$(ZAP_CFLAGS) $(INCS) MYLIB=libopenzap.a LIBPRIA=libpri.a @@ -79,6 +82,9 @@ $(MYLIB): $(OBJS) $(HEADERS) testapp: $(SRC)/testapp.c $(MYLIB) $(CC) $(INCS) -L. $(SRC)/testapp.c -o testapp -lopenzap -lm -lpthread +testcid: $(SRC)/testcid.c $(MYLIB) + $(CC) $(INCS) -L. $(SRC)/testcid.c -o testcid -lopenzap -lm -lpthread + testisdn: $(SRC)/testisdn.c $(MYLIB) $(CC) $(INCS) -L. $(SRC)/testisdn.c -o testisdn -lopenzap -lm -lpthread @@ -124,6 +130,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 priserver testisdn testanalog + rm -f $(SRC)/*.o $(SRC)/isdn/*.o $(MYLIB) *~ \#* testapp testcid priserver testisdn testanalog @if [ -f $(LIBPRI)/$(LIBPRIA) ] ; then cd $(LIBPRI) && make clean ; fi diff --git a/libs/openzap/src/dsp/fsk.h b/libs/openzap/src/dsp/fsk.h index a2615b1fed..e9cf0c0c1c 100644 --- a/libs/openzap/src/dsp/fsk.h +++ b/libs/openzap/src/dsp/fsk.h @@ -1,4 +1,3 @@ - /* * bell202.h * @@ -84,5 +83,5 @@ void dsp_fsk_destroy(dsp_fsk_handle_t **handle); void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample); -#endif // __FSK_H__ +#endif diff --git a/libs/openzap/src/dsp/uart.h b/libs/openzap/src/dsp/uart.h index bfad94ef38..89c3a13abc 100644 --- a/libs/openzap/src/dsp/uart.h +++ b/libs/openzap/src/dsp/uart.h @@ -1,4 +1,3 @@ - /* * uart.h * @@ -73,5 +72,5 @@ void dsp_uart_destroy(dsp_uart_handle_t **handle); void dsp_uart_bit_handler(void *handle, int bit); -#endif // __UART_H__ +#endif diff --git a/libs/openzap/src/include/openzap.h b/libs/openzap/src/include/openzap.h index 53d2106d99..dcbbf41ef9 100644 --- a/libs/openzap/src/include/openzap.h +++ b/libs/openzap/src/include/openzap.h @@ -342,6 +342,11 @@ struct zap_io_interface { zio_span_next_event_t next_event; }; +zap_status_t zap_fsk_data_parse(zap_fsk_data_state_t *state, zap_size_t *type, zap_size_t *len, char *data, size_t datalen); +zap_status_t zap_fsk_demod_feed(zap_fsk_data_state_t *state, int16_t *data, size_t samples); +zap_status_t zap_fsk_demod_destroy(zap_fsk_data_state_t *state); +int zap_fsk_demod_init(zap_fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize); + zap_status_t zap_channel_outgoing_call(zap_channel_t *zchan); void zap_channel_rotate_tokens(zap_channel_t *zchan); void zap_channel_clear_detected_tones(zap_channel_t *zchan); diff --git a/libs/openzap/src/include/zap_types.h b/libs/openzap/src/include/zap_types.h index 607fa03366..6e4c8c1e0e 100644 --- a/libs/openzap/src/include/zap_types.h +++ b/libs/openzap/src/include/zap_types.h @@ -33,6 +33,7 @@ #ifndef ZAP_TYPES_H #define ZAP_TYPES_H +#include "fsk.h" #ifdef WIN32 #include @@ -57,6 +58,32 @@ struct zap_io_interface; typedef uint64_t zap_time_t; +typedef enum { + MDMF_DATETIME = 1, + MDMF_PHONE_NUM = 2, + MDMF_NO_NUM = 4, + MDMF_NAME = 7, + MDMF_NO_NAME = 8 +} zap_mdmf_type_t; + + +struct zap_fsk_data_state { + dsp_fsk_handle_t *fsk1200_handle; + uint8_t init; + uint8_t *buf; + size_t bufsize; + int blen; + int bpos; + int dlen; + int ppos; + uint8_t checksum; +}; +typedef struct zap_fsk_data_state zap_fsk_data_state_t; + +typedef int (*zap_fsk_data_decoder_t)(zap_fsk_data_state_t *state); + + + #define ZAP_TONEMAP_LEN 128 typedef enum { ZAP_TONEMAP_NONE, @@ -139,7 +166,7 @@ typedef enum { ZAP_MEMERR, ZAP_TIMEOUT, ZAP_NOTIMPL, - + ZAP_CHECKSUM_ERROR, ZAP_STATUS_COUNT } zap_status_t;