1 diff -urN asterisk-1.4.11.org/channels/chan_zap.c asterisk-1.4.11/channels/chan_zap.c
2 --- asterisk-1.4.11.org/channels/chan_zap.c 2007-08-17 23:01:43.000000000 +0200
3 +++ asterisk-1.4.11/channels/chan_zap.c 2007-10-06 06:09:46.353781463 +0200
5 * is entirely unwilling to provide any assistance with their channel banks
6 * even though their web site says they support their products for life.
8 -/* #define ZHONE_HACK */
12 * Define if you want to check the hook state for an FXO (FXS signalled) interface
13 @@ -3700,21 +3700,17 @@
14 ast_log(LOG_DEBUG, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, index);
16 if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) {
17 - p->pulsedial = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
18 + int pulse = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
20 - ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
22 - if (!p->proceeding && p->sig == SIG_PRI && p->pri && p->pri->overlapdial) {
26 - p->subs[index].f.frametype = AST_FRAME_DTMF_END;
27 - p->subs[index].f.subclass = res & 0xff;
29 + ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", pulse ? "pulse ": "", res & 0xff);
31 + if (res & 0xff != 1) {
32 + /* try to reset zhone */
33 + zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
35 + zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
38 - zt_handle_dtmfup(ast, index, &f);
43 if (res & ZT_EVENT_DTMFDOWN) {
44 --- asterisk/channels/chan_zap.c.org 2007-09-26 09:08:42.423698383 +0200
45 +++ asterisk/channels/chan_zap.c 2007-09-26 09:09:43.422303554 +0200
46 @@ -1607,11 +1607,18 @@
48 static inline int zt_set_hook(int fd, int hs)
51 + int x, res, count = 0;
54 res = ioctl(fd, ZT_HOOK, &x);
56 + while (res < 0 && count < 20) {
57 + usleep(100000); /* 1/10 sec. */
59 + res = ioctl(fd, ZT_HOOK, &x);
64 if (errno == EINPROGRESS)