add 1/2 of caller id code

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@209 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2007-06-05 00:57:02 +00:00
parent 4ec6fab273
commit 9923827d1e
5 changed files with 43 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -33,6 +33,7 @@
#ifndef ZAP_TYPES_H
#define ZAP_TYPES_H
#include "fsk.h"
#ifdef WIN32
#include <windows.h>
@ -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;