Index: channels/chan_zap.c =================================================================== --- channels/chan_zap.c (revision 74801) +++ channels/chan_zap.c (working copy) @@ -1607,14 +1607,23 @@ static inline int zt_set_hook(int fd, int hs) { - int x, res; + int x, res, count = 0; + x = hs; res = ioctl(fd, ZT_HOOK, &x); - if (res < 0) - { + + while (res < 0 && count < 20) { + usleep(100000); /* 1/10 sec. */ + x = hs; + res = ioctl(fd, ZT_HOOK, &x); + count++; + } + + if (res < 0) { if (errno == EINPROGRESS) return 0; ast_log(LOG_WARNING, "zt hook failed: %s\n", strerror(errno)); } + return res; }