uint32_t chan_id;
uint32_t physical_span_id;
uint32_t physical_chan_id;
+ uint32_t rate;
zap_chan_type_t type;
zap_socket_t sockfd;
zap_channel_flag_t flags;
--- /dev/null
+#include "openzap.h"
+
+int main(int argc, char *argv[])
+{
+ zap_fsk_data_state_t state = {0};
+ int fd;
+ int16_t buf[160] = {0};
+ ssize_t len = 0;
+ int type, mlen;
+ char str[128];
+ char fbuf[256];
+
+ if (argc < 2 || zap_fsk_demod_init(&state, 8000, fbuf, sizeof(fbuf))) {
+ printf("wtf\n");
+ return 0;
+ }
+
+ if ((fd = open(argv[1], O_RDONLY)) < 0) {
+ fprintf(stderr, "cant open file %s\n", argv[1]);
+ exit (-1);
+ }
+
+ while((len = read(fd, buf, sizeof(buf))) > 0) {
+ if (zap_fsk_demod_feed(&state, buf, len / 2) != ZAP_SUCCESS) {
+ break;
+ }
+ }
+
+ while(zap_fsk_data_parse(&state, &type, &mlen, str, sizeof(str)) == ZAP_SUCCESS) {
+ printf("TYPE %d LEN %d VAL [%s]\n", type, mlen, str);
+ }
+
+
+ close(fd);
+}
memset(&zchan->tone_session, 0, sizeof(zchan->tone_session));
teletone_init_session(&zchan->tone_session, 0, NULL, NULL);
- zchan->tone_session.rate = 8000;
+ zchan->tone_session.rate = zchan->rate;
zchan->tone_session.duration = zchan->dtmf_on * (zchan->tone_session.rate / 1000);
zchan->tone_session.wait = zchan->dtmf_off * (zchan->tone_session.rate / 1000);
/*
if (!zap_channel_test_feature(zchan, ZAP_CHANNEL_FEATURE_DTMF)) {
zap_tone_type_t tt = ZAP_COMMAND_OBJ_INT;
if (tt == ZAP_TONE_DTMF) {
- teletone_dtmf_detect_init (&zchan->dtmf_detect, 8000);
+ teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_set_flag_locked(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_set_flag_locked(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
if (!zap_channel_test_feature(zchan, ZAP_CHANNEL_FEATURE_DTMF)) {
zap_tone_type_t tt = ZAP_COMMAND_OBJ_INT;
if (tt == ZAP_TONE_DTMF) {
- teletone_dtmf_detect_init (&zchan->dtmf_detect, 8000);
+ teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_clear_flag(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_clear_flag(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
#include "openzap.h"
#include "zap_wanpipe.h"
-#include <sangoma_tdm_api.h>
+/*#include <sangoma_tdm_api.h>*/
+#include <wanpipe_tdm_api.h>
static struct {
uint32_t codec_ms;
zap_log(ZAP_LOG_INFO, "configuring device s%dc%d as OpenZAP device %d:%d fd:%d\n", spanno, x, chan->span_id, chan->chan_id, sockfd);
chan->physical_span_id = spanno;
chan->physical_chan_id = x;
+ chan->rate = 8000;
+
if (type == ZAP_CHAN_TYPE_FXS || type == ZAP_CHAN_TYPE_FXO) {
wanpipe_tdm_api_t tdm_api;
}
zap_log(ZAP_LOG_INFO, "configuring device %s as OpenZAP device %d:%d fd:%d\n", path, chan->span_id, chan->chan_id, sockfd);
+ chan->rate = 8000;
chan->physical_span_id = ztp.span_no;
chan->physical_chan_id = ztp.chan_no;