diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-13 19:10:00 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-13 19:10:00 +0000 |
commit | 4f5f8b2de563f345f5cfa3db6e0794a34488305b (patch) | |
tree | 6a9cfad28ef739a660a578b0bcd33c82370dd3e3 /channels | |
parent | 3e96dabccc9ed955ebc946bbf8e120187506ae54 (diff) |
(closes issue #9660)
Reported by: mmacvicar
Patches submitted by: bbryant, russell
Tested by: mmacvicar, marco, arcivanov, jmhunter, explidous
When using a TDM400P (and probably other analog cards) there was a chance that
you could hang up and pick the phone back up where it has been long enough to
be not considered a flash hook, but too soon such that the device reports that
it is busy and the person on the phone will only hear silence. This patch
makes chan_zap more tolerant of this and gives the device a couple of seconds
to succeed so the person on the phone happily gets their dialtone.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@75052 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_zap.c | 15 |
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; } |