aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index e66e171db..695684ce8 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -1726,14 +1726,23 @@ static int restore_gains(struct zt_pvt *p)
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;
}