]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 5 Jun 2007 03:04:35 +0000 (03:04 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 5 Jun 2007 03:04:35 +0000 (03:04 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@212 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/include/openzap.h
libs/openzap/src/testcid.c [new file with mode: 0644]
libs/openzap/src/zap_io.c
libs/openzap/src/zap_wanpipe.c
libs/openzap/src/zap_zt.c

index dcbbf41ef92f84e65a74b934147b4622b474d02e..f7a020d4c8b17b664c98a93ba12ebf10e90bfbec 100644 (file)
@@ -237,6 +237,7 @@ struct zap_channel {
        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;
diff --git a/libs/openzap/src/testcid.c b/libs/openzap/src/testcid.c
new file mode 100644 (file)
index 0000000..f91ee59
--- /dev/null
@@ -0,0 +1,35 @@
+#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);
+}
index 96089c5322337c56b8ba3e6fb96b53e9e2477f27..a792ab6b0f425c73bc0ecb8f0278d1524c57d778 100644 (file)
@@ -770,7 +770,7 @@ static zap_status_t zchan_activate_dtmf_buffer(zap_channel_t *zchan)
        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);
        /*
@@ -910,7 +910,7 @@ zap_status_t zap_channel_command(zap_channel_t *zchan, zap_command_t command, vo
                        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);
@@ -926,7 +926,7 @@ zap_status_t zap_channel_command(zap_channel_t *zchan, zap_command_t command, vo
                        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);
index 3e9e7501deefee400add1dc81b8a774b04fb7d49..c5883bdd86944b8fdc0e0aa37431b10187b061b1 100644 (file)
@@ -36,7 +36,8 @@
 #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;
@@ -74,6 +75,8 @@ static unsigned wp_open_range(zap_span_t *span, unsigned spanno, unsigned start,
                        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;
 
index 49d9edea60a0a438c70a0b83de0f7551aca53413..db940d5c54f2a416a9614748fb8c347b0997bee0 100644 (file)
@@ -90,6 +90,7 @@ static unsigned zt_open_range(zap_span_t *span, unsigned start, unsigned end, za
                        }
                        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;