Autodetect if zaptel is recent enough
authorMark Spencer <markster@digium.com>
Thu, 20 Mar 2003 14:21:57 +0000 (14:21 +0000)
committerMark Spencer <markster@digium.com>
Thu, 20 Mar 2003 14:21:57 +0000 (14:21 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@663 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 8af5c67..4a2f44c 100755 (executable)
@@ -3460,10 +3460,12 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
        if (iaxtrunkdebug)
                ast_verbose("Beginning trunk processing\n");
        if (events & AST_IO_PRI) {
+#ifdef ZT_TIMERACK
                /* Great, this is a timing interface, just call the ioctl */
                if (ioctl(fd, ZT_TIMERACK, x)) 
                        ast_log(LOG_WARNING, "Unable to acknowledge zap timer\n");
                res = 0;
+#endif         
        } else {
                /* Read and ignore from the pseudo channel for timing */
                res = read(fd, buf, sizeof(buf));
@@ -4891,7 +4893,10 @@ static void set_timing(void)
 #ifdef IAX_TRUNKING
        int bs = trunkfreq * 8;
        if (timingfd > -1) {
-               if (ioctl(timingfd, ZT_TIMERCONFIG, &bs) &&
+               if (
+#ifdef ZT_TIMERACK
+                       ioctl(timingfd, ZT_TIMERCONFIG, &bs) &&
+#endif                 
                        ioctl(timingfd, ZT_SET_BLOCKSIZE, &bs))
                        ast_log(LOG_WARNING, "Unable to set blocksize on timing source\n");
        }
@@ -5428,8 +5433,10 @@ int load_module(void)
        sin.sin_addr.s_addr = INADDR_ANY;
 
 #ifdef IAX_TRUNKING
+#ifdef ZT_TIMERACK
        timingfd = open("/dev/zap/timer", O_RDWR);
        if (timingfd < 0)
+#endif
                timingfd = open("/dev/zap/pseudo", O_RDWR);
        if (timingfd < 0) 
                ast_log(LOG_WARNING, "Unable to open IAX timing interface: %s\n", strerror(errno));