diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-13 19:19:51 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-13 19:19:51 +0000 |
commit | 4898d3cdccd72605ab051279a6e8fe499cabe6f2 (patch) | |
tree | 589f053ade8996f59e4ffc63ca2350fb3e37869b | |
parent | 61e1de4b7abf3f8dd7ba7887a28a5a4eaaa0606c (diff) |
Merged revisions 75053 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r75053 | russell | 2007-07-13 14:11:26 -0500 (Fri, 13 Jul 2007) | 20 lines
Merged revisions 75052 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r75052 | russell | 2007-07-13 14:10:00 -0500 (Fri, 13 Jul 2007) | 12 lines
(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/trunk@75054 f38db490-d61c-443f-a65b-d21fe96a405b
-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 a3578e220..c8b4feb76 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1757,14 +1757,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; } |